summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-22 20:32:43 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-22 20:32:43 +0000
commiteb4089ad01a2570dfcdd02efb9071adf1f1b49e9 (patch)
treef682fc54173ce7c7a8ca1e2acfebbe5952b61413
parent0e4fcb8e3b9099051df0ec29aa8ccec873cb1c95 (diff)
downloadbcm5719-llvm-eb4089ad01a2570dfcdd02efb9071adf1f1b49e9.tar.gz
bcm5719-llvm-eb4089ad01a2570dfcdd02efb9071adf1f1b49e9.zip
Only trigger the initialize-an-array-via-elementwise-copy/move code
generation when we're dealing with an implicitly-defined copy or move constructor. And, actually set the implicitly-defined bit for implicitly-defined constructors and destructors. Should fix self-host. llvm-svn: 140334
-rw-r--r--clang/lib/CodeGen/CGClass.cpp3
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp5
2 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index 59d5ef78599..a831ebda84b 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -573,7 +573,8 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
llvm::Value *ArrayIndexVar = 0;
const ConstantArrayType *Array
= CGF.getContext().getAsConstantArrayType(FieldType);
- if (Array && Constructor->isCopyOrMoveConstructor()) {
+ if (Array && Constructor->isImplicitlyDefined() &&
+ Constructor->isCopyOrMoveConstructor()) {
llvm::Type *SizeTy
= CGF.ConvertType(CGF.getContext().getSizeType());
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index c197a4ea9fa..6f14e61630f 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -6963,7 +6963,7 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
SourceLocation Loc = Destructor->getLocation();
Destructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
-
+ Destructor->setImplicitlyDefined(true);
Destructor->setUsed();
MarkVTableUsed(CurrentLocation, ClassDecl);
@@ -8301,10 +8301,10 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
MultiStmtArg(*this, 0, 0),
/*isStmtExpr=*/false)
.takeAs<Stmt>());
+ CopyConstructor->setImplicitlyDefined(true);
}
CopyConstructor->setUsed();
-
if (ASTMutationListener *L = getASTMutationListener()) {
L->CompletedImplicitDefinition(CopyConstructor);
}
@@ -8464,6 +8464,7 @@ void Sema::DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
MultiStmtArg(*this, 0, 0),
/*isStmtExpr=*/false)
.takeAs<Stmt>());
+ MoveConstructor->setImplicitlyDefined(true);
}
MoveConstructor->setUsed();
OpenPOWER on IntegriCloud