forked from OSchip/llvm-project
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
This commit is contained in:
parent
0e4fcb8e3b
commit
eb4089ad01
|
@ -573,7 +573,8 @@ static void EmitMemberInitializer(CodeGenFunction &CGF,
|
||||||
llvm::Value *ArrayIndexVar = 0;
|
llvm::Value *ArrayIndexVar = 0;
|
||||||
const ConstantArrayType *Array
|
const ConstantArrayType *Array
|
||||||
= CGF.getContext().getAsConstantArrayType(FieldType);
|
= CGF.getContext().getAsConstantArrayType(FieldType);
|
||||||
if (Array && Constructor->isCopyOrMoveConstructor()) {
|
if (Array && Constructor->isImplicitlyDefined() &&
|
||||||
|
Constructor->isCopyOrMoveConstructor()) {
|
||||||
llvm::Type *SizeTy
|
llvm::Type *SizeTy
|
||||||
= CGF.ConvertType(CGF.getContext().getSizeType());
|
= CGF.ConvertType(CGF.getContext().getSizeType());
|
||||||
|
|
||||||
|
|
|
@ -6963,7 +6963,7 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
|
||||||
|
|
||||||
SourceLocation Loc = Destructor->getLocation();
|
SourceLocation Loc = Destructor->getLocation();
|
||||||
Destructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
|
Destructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
|
||||||
|
Destructor->setImplicitlyDefined(true);
|
||||||
Destructor->setUsed();
|
Destructor->setUsed();
|
||||||
MarkVTableUsed(CurrentLocation, ClassDecl);
|
MarkVTableUsed(CurrentLocation, ClassDecl);
|
||||||
|
|
||||||
|
@ -8301,10 +8301,10 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
|
||||||
MultiStmtArg(*this, 0, 0),
|
MultiStmtArg(*this, 0, 0),
|
||||||
/*isStmtExpr=*/false)
|
/*isStmtExpr=*/false)
|
||||||
.takeAs<Stmt>());
|
.takeAs<Stmt>());
|
||||||
|
CopyConstructor->setImplicitlyDefined(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyConstructor->setUsed();
|
CopyConstructor->setUsed();
|
||||||
|
|
||||||
if (ASTMutationListener *L = getASTMutationListener()) {
|
if (ASTMutationListener *L = getASTMutationListener()) {
|
||||||
L->CompletedImplicitDefinition(CopyConstructor);
|
L->CompletedImplicitDefinition(CopyConstructor);
|
||||||
}
|
}
|
||||||
|
@ -8464,6 +8464,7 @@ void Sema::DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
|
||||||
MultiStmtArg(*this, 0, 0),
|
MultiStmtArg(*this, 0, 0),
|
||||||
/*isStmtExpr=*/false)
|
/*isStmtExpr=*/false)
|
||||||
.takeAs<Stmt>());
|
.takeAs<Stmt>());
|
||||||
|
MoveConstructor->setImplicitlyDefined(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveConstructor->setUsed();
|
MoveConstructor->setUsed();
|
||||||
|
|
Loading…
Reference in New Issue