diff options
| author | Douglas Gregor <dgregor@apple.com> | 2011-02-17 18:06:05 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2011-02-17 18:06:05 +0000 |
| commit | b494173c9310f90c69ce4541f6576d5856a41c8a (patch) | |
| tree | 056cd96f952458e90b9943dd13aafd49274bae92 /clang | |
| parent | fe590dfa84c0b42836289dcce28d950dee230d8e (diff) | |
| download | bcm5719-llvm-b494173c9310f90c69ce4541f6576d5856a41c8a.tar.gz bcm5719-llvm-b494173c9310f90c69ce4541f6576d5856a41c8a.zip | |
Devirtualize TagDecl::completeDefinition().
llvm-svn: 125755
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/AST/Decl.h | 5 | ||||
| -rw-r--r-- | clang/include/clang/AST/DeclCXX.h | 6 | ||||
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 14 | ||||
| -rw-r--r-- | clang/lib/AST/DeclCXX.cpp | 15 |
4 files changed, 20 insertions, 20 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index 32706d6c901..cca25cf73fc 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -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; } diff --git a/clang/include/clang/AST/DeclCXX.h b/clang/include/clang/AST/DeclCXX.h index 64bb1cbca32..3d730eff6fb 100644 --- a/clang/include/clang/AST/DeclCXX.h +++ b/clang/include/clang/AST/DeclCXX.h @@ -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 /// diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 8c55d0e7abf..d5e9dbf4fc7 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -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 //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp index fba73f59d56..1de3cc989ed 100644 --- a/clang/lib/AST/DeclCXX.cpp +++ b/clang/lib/AST/DeclCXX.cpp @@ -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()) |

