diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-05-11 21:32:35 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-05-11 21:32:35 +0000 |
commit | 380c2139959d8608782292984b457640a143a70d (patch) | |
tree | 9d19ddf00d7bec1e6a550bfe5c595295e736909a /lib/Sema/SemaDeclCXX.cpp | |
parent | 9430d5a61598c47d827e1cd05f7cf3f110eeec9e (diff) |
Speculatively revert r103497, "Do not mark the virtual members of an
implicitly-instantiated class as ...", which seems to have broken bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 59 |
1 files changed, 8 insertions, 51 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index dc27dca195..e32a308af5 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -4146,9 +4146,7 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, assert(ClassDecl && "DefineImplicitDefaultConstructor - invalid constructor"); ImplicitlyDefinedFunctionScope Scope(*this, Constructor); - ErrorTrap Trap(*this); - if (SetBaseOrMemberInitializers(Constructor, 0, 0, /*AnyErrors=*/false) || - Trap.hasErrorOccurred()) { + if (SetBaseOrMemberInitializers(Constructor, 0, 0, /*AnyErrors=*/false)) { Diag(CurrentLocation, diag::note_member_synthesized_at) << CXXConstructor << Context.getTagDeclType(ClassDecl); Constructor->setInvalidDecl(); @@ -4164,16 +4162,14 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation, CXXRecordDecl *ClassDecl = Destructor->getParent(); assert(ClassDecl && "DefineImplicitDestructor - invalid destructor"); - if (Destructor->isInvalidDecl()) - return; - ImplicitlyDefinedFunctionScope Scope(*this, Destructor); - ErrorTrap Trap(*this); MarkBaseAndMemberDestructorsReferenced(Destructor->getLocation(), Destructor->getParent()); - if (CheckDestructor(Destructor) || Trap.hasErrorOccurred()) { + // FIXME: If CheckDestructor fails, we should emit a note about where the + // implicit destructor was needed. + if (CheckDestructor(Destructor)) { Diag(CurrentLocation, diag::note_member_synthesized_at) << CXXDestructor << Context.getTagDeclType(ClassDecl); @@ -4400,7 +4396,6 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CopyAssignOperator->setUsed(); ImplicitlyDefinedFunctionScope Scope(*this, CopyAssignOperator); - ErrorTrap Trap(*this); // C++0x [class.copy]p30: // The implicitly-defined or explicitly-defaulted copy assignment operator @@ -4624,13 +4619,6 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation, } } - if (Trap.hasErrorOccurred()) { - Diag(CurrentLocation, diag::note_member_synthesized_at) - << CXXCopyAssignment << Context.getTagDeclType(ClassDecl); - CopyAssignOperator->setInvalidDecl(); - return; - } - if (Invalid) { CopyAssignOperator->setInvalidDecl(); return; @@ -4654,10 +4642,8 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, assert(ClassDecl && "DefineImplicitCopyConstructor - invalid constructor"); ImplicitlyDefinedFunctionScope Scope(*this, CopyConstructor); - ErrorTrap Trap(*this); - if (SetBaseOrMemberInitializers(CopyConstructor, 0, 0, /*AnyErrors=*/false) || - Trap.hasErrorOccurred()) { + if (SetBaseOrMemberInitializers(CopyConstructor, 0, 0, /*AnyErrors=*/false)) { Diag(CurrentLocation, diag::note_member_synthesized_at) << CXXCopyConstructor << Context.getTagDeclType(ClassDecl); CopyConstructor->setInvalidDecl(); @@ -6082,30 +6068,10 @@ void Sema::MaybeMarkVirtualMembersReferenced(SourceLocation Loc, return; TemplateSpecializationKind kind = RD->getTemplateSpecializationKind(); - if (kind == TSK_ImplicitInstantiation) { - CXXRecordDecl *CanonRD = cast<CXXRecordDecl>(RD->getCanonicalDecl()); - if (UnmarkedClassesRequiringVtable.insert(CanonRD)) - ClassesWithUnmarkedVirtualMembers.push_back(std::make_pair(RD, Loc)); - } else - MarkVirtualMembersReferenced(Loc, RD); -} - -void Sema::MaybeMarkVirtualMembersReferenced(SourceLocation Loc, - CXXRecordDecl *RD) { - if (RD->isDependentContext() || !RD->isDynamicClass()) - return; - - if (RD->getTemplateSpecializationKind() != TSK_ImplicitInstantiation) - return; - - // Classes with a key function will be dealt with when we see the - // definition of the key function. - if (Context.getKeyFunction(RD)) - return; - - CXXRecordDecl *CanonRD = cast<CXXRecordDecl>(RD->getCanonicalDecl()); - if (UnmarkedClassesRequiringVtable.insert(CanonRD)) + if (kind == TSK_ImplicitInstantiation) ClassesWithUnmarkedVirtualMembers.push_back(std::make_pair(RD, Loc)); + else + MarkVirtualMembersReferenced(Loc, RD); } bool Sema::ProcessPendingClassesWithUnmarkedVirtualMembers() { @@ -6116,15 +6082,6 @@ bool Sema::ProcessPendingClassesWithUnmarkedVirtualMembers() { CXXRecordDecl *RD = ClassesWithUnmarkedVirtualMembers.back().first; SourceLocation Loc = ClassesWithUnmarkedVirtualMembers.back().second; ClassesWithUnmarkedVirtualMembers.pop_back(); - - // If an implicitly-instantiated class doesn't require a vtable, - // don't mark its virtual members as referenced. - if (RD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) { - CXXRecordDecl *CanonRD = cast<CXXRecordDecl>(RD->getCanonicalDecl()); - if (!UnmarkedClassesRequiringVtable.count(CanonRD)) - continue; - } - MarkVirtualMembersReferenced(Loc, RD); } |