Devirtualize TagDecl::completeDefinition().

llvm-svn: 125755
This commit is contained in:
Douglas Gregor 2011-02-17 18:06:05 +00:00
parent fe590dfa84
commit b494173c93
4 changed files with 20 additions and 20 deletions

View File

@ -2485,9 +2485,8 @@ public:
return field_begin() == field_end();
}
/// completeDefinition - Notes that the definition of this type is
/// now complete.
virtual void completeDefinition();
/// \brief Indicates that the definition of this class is now complete.
void completeDefinition();
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
static bool classof(const RecordDecl *D) { return true; }

View File

@ -447,6 +447,9 @@ class CXXRecordDecl : public RecordDecl {
void markedVirtualFunctionPure();
friend void FunctionDecl::setPure(bool);
void completeDefinitionImpl(CXXFinalOverriderMap *FinalOverriders);
friend class RecordDecl;
protected:
CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
@ -994,9 +997,6 @@ public:
return (PathAccess > DeclAccess ? PathAccess : DeclAccess);
}
/// \brief Indicates that the definition of this class is now complete.
virtual void completeDefinition();
/// \brief Indicates that the definition of this class is now complete,
/// and provides a final overrider map to help determine
///

View File

@ -2128,13 +2128,6 @@ RecordDecl::field_iterator RecordDecl::field_begin() const {
return field_iterator(decl_iterator(FirstDecl));
}
/// completeDefinition - Notes that the definition of this type is now
/// complete.
void RecordDecl::completeDefinition() {
assert(!isDefinition() && "Cannot redefine record!");
TagDecl::completeDefinition();
}
void RecordDecl::LoadFieldsFromExternalStorage() const {
ExternalASTSource *Source = getASTContext().getExternalSource();
assert(hasExternalLexicalStorage() && Source && "No external storage?");
@ -2160,6 +2153,13 @@ void RecordDecl::LoadFieldsFromExternalStorage() const {
llvm::tie(FirstDecl, LastDecl) = BuildDeclChain(Decls);
}
void RecordDecl::completeDefinition() {
assert(!isDefinition() && "Cannot redefine record!");
TagDecl::completeDefinition();
if (CXXRecordDecl *CXXRecord = dyn_cast<CXXRecordDecl>(this))
CXXRecord->completeDefinitionImpl(0);
}
//===----------------------------------------------------------------------===//
// BlockDecl Implementation
//===----------------------------------------------------------------------===//

View File

@ -819,13 +819,8 @@ CXXDestructorDecl *CXXRecordDecl::getDestructor() const {
return Dtor;
}
void CXXRecordDecl::completeDefinition() {
completeDefinition(0);
}
void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
RecordDecl::completeDefinition();
void
CXXRecordDecl::completeDefinitionImpl(CXXFinalOverriderMap *FinalOverriders) {
// If the class may be abstract (but hasn't been marked as such), check for
// any pure final overriders.
if (mayBeAbstract()) {
@ -865,6 +860,12 @@ void CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
data().Conversions.setAccess(I, (*I)->getAccess());
}
void
CXXRecordDecl::completeDefinition(CXXFinalOverriderMap *FinalOverriders) {
TagDecl::completeDefinition();
completeDefinitionImpl(FinalOverriders);
}
bool CXXRecordDecl::mayBeAbstract() const {
if (data().Abstract || isInvalidDecl() || !data().Polymorphic ||
isDependentContext())