diff options
author | Senran Zhang <zsrkmyn@gmail.com> | 2019-11-26 10:15:14 +0800 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-11-25 18:15:34 -0800 |
commit | 01d8e09fdba0c9d3fe316a86e5ce4481e6ed71d1 (patch) | |
tree | c874d9f150926ac845ade10a276a597f9b4e5313 /clang/lib/CodeGen/CGClass.cpp | |
parent | 6f773205cd05e47912096d7c4091f03c28255ab2 (diff) | |
download | bcm5719-llvm-01d8e09fdba0c9d3fe316a86e5ce4481e6ed71d1.tar.gz bcm5719-llvm-01d8e09fdba0c9d3fe316a86e5ce4481e6ed71d1.zip |
[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
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 04ef912b18b..d07b1c665cc 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -914,6 +914,8 @@ namespace { } void addMemcpyableField(FieldDecl *F) { + if (F->isZeroSize(CGF.getContext())) + return; if (!FirstField) addInitialField(F); else |