forked from OSchip/llvm-project
Make it so that we actually generate definitions for explicitly
defaulted default constructors. As it happens, making sure that we handle out-of-line defaulted functions properly will involved making sure that we actually parse them correctly, so that's coming after. llvm-svn: 131224
This commit is contained in:
parent
b315302bf9
commit
f92197cf96
|
@ -5263,6 +5263,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
|
|||
/*isInline=*/true,
|
||||
/*isImplicitlyDeclared=*/true);
|
||||
DefaultCon->setAccess(AS_public);
|
||||
DefaultCon->setDefaulted();
|
||||
DefaultCon->setImplicit();
|
||||
DefaultCon->setTrivial(ClassDecl->hasTrivialDefaultConstructor());
|
||||
|
||||
|
@ -5283,7 +5284,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor(
|
|||
|
||||
void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
|
||||
CXXConstructorDecl *Constructor) {
|
||||
assert((Constructor->isImplicit() && Constructor->isDefaultConstructor() &&
|
||||
assert((Constructor->isDefaulted() && Constructor->isDefaultConstructor() &&
|
||||
!Constructor->isUsed(false) && !Constructor->isDeleted()) &&
|
||||
"DefineImplicitDefaultConstructor - call it for implicit default ctor");
|
||||
|
||||
|
|
|
@ -9853,8 +9853,8 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) {
|
|||
// Note that this declaration has been used.
|
||||
if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(D)) {
|
||||
unsigned TypeQuals;
|
||||
if (Constructor->isImplicit() && Constructor->isDefaultConstructor()) {
|
||||
if (Constructor->getParent()->hasTrivialDefaultConstructor())
|
||||
if (Constructor->isDefaulted() && Constructor->isDefaultConstructor()) {
|
||||
if (Constructor->isTrivial())
|
||||
return;
|
||||
if (!Constructor->isUsed(false))
|
||||
DefineImplicitDefaultConstructor(Loc, Constructor);
|
||||
|
|
|
@ -4019,7 +4019,7 @@ InitializationSequence::Perform(Sema &S,
|
|||
// the definition for completely trivial constructors.
|
||||
CXXRecordDecl *ClassDecl = Constructor->getParent();
|
||||
assert(ClassDecl && "No parent class for constructor.");
|
||||
if (Constructor->isImplicit() && Constructor->isDefaultConstructor() &&
|
||||
if (Constructor->isDefaulted() && Constructor->isDefaultConstructor() &&
|
||||
ClassDecl->hasTrivialDefaultConstructor() &&
|
||||
!Constructor->isUsed(false))
|
||||
S.DefineImplicitDefaultConstructor(Loc, Constructor);
|
||||
|
|
Loading…
Reference in New Issue