summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGClass.cpp5
-rw-r--r--clang/test/CodeGen/sanitize-address-field-padding.cpp1
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index dd1947172dc..e2af17c2759 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -1735,7 +1735,7 @@ void CodeGenFunction::EmitCXXConstructorCall(const CXXConstructorDecl *D,
bool Delegating, llvm::Value *This,
const CXXConstructExpr *E) {
// If this is a trivial constructor, just emit what's needed.
- if (D->isTrivial()) {
+ if (D->isTrivial() && !D->getParent()->mayInsertExtraPadding()) {
if (E->getNumArgs() == 0) {
// Trivial default constructor, no codegen required.
assert(D->isDefaultConstructor() &&
@@ -1785,7 +1785,8 @@ void
CodeGenFunction::EmitSynthesizedCXXCopyCtorCall(const CXXConstructorDecl *D,
llvm::Value *This, llvm::Value *Src,
const CXXConstructExpr *E) {
- if (D->isTrivial()) {
+ if (D->isTrivial() &&
+ !D->getParent()->mayInsertExtraPadding()) {
assert(E->getNumArgs() == 1 && "unexpected argcount for trivial ctor");
assert(D->isCopyOrMoveConstructor() &&
"trivial 1-arg ctor not a copy/move ctor");
diff --git a/clang/test/CodeGen/sanitize-address-field-padding.cpp b/clang/test/CodeGen/sanitize-address-field-padding.cpp
index 06830895856..d4eea1b9e69 100644
--- a/clang/test/CodeGen/sanitize-address-field-padding.cpp
+++ b/clang/test/CodeGen/sanitize-address-field-padding.cpp
@@ -229,6 +229,7 @@ struct ClassWithTrivialCopy {
void MakeTrivialCopy(ClassWithTrivialCopy *s1, ClassWithTrivialCopy *s2) {
*s1 = *s2;
+ ClassWithTrivialCopy s3(*s2);
}
// CHECK-LABEL: define void @_Z15MakeTrivialCopyP20ClassWithTrivialCopyS0_
OpenPOWER on IntegriCloud