[clang][CodeGen] Fix wrong memcpy size of no_unique_address in FieldMemcpyizer
authorSenran Zhang <zsrkmyn@gmail.com>
Tue, 26 Nov 2019 02:15:14 +0000 (10:15 +0800)
committerFangrui Song <maskray@google.com>
Tue, 26 Nov 2019 02:15:34 +0000 (18:15 -0800)
commit01d8e09fdba0c9d3fe316a86e5ce4481e6ed71d1
treec874d9f150926ac845ade10a276a597f9b4e5313
parent6f773205cd05e47912096d7c4091f03c28255ab2
[clang][CodeGen] Fix wrong memcpy size of no_unique_address in FieldMemcpyizer

When generating ctor, FieldMemcpyizer wrongly treated zero-sized class members
as what should be copied, and generated wrong memcpy size under some special
circumstances. This patch tries to fix it.

Reviewed By: MaskRay, rjmccall

Differential Revision: https://reviews.llvm.org/D70671
clang/lib/CodeGen/CGClass.cpp
clang/test/CodeGenCXX/no-unique-address-2.cpp [new file with mode: 0644]