[cfe-commits] r125755 - in /cfe/trunk: include/clang/AST/Decl.h include/clang/AST/DeclCXX.h lib/AST/Decl.cpp lib/AST/DeclCXX.cpp
Douglas Gregor
dgregor at apple.com
Thu Feb 17 10:06:05 PST 2011
Author: dgregor
Date: Thu Feb 17 12:06:05 2011
New Revision: 125755
URL: http://llvm.org/viewvc/llvm-project?rev=125755&view=rev
Log:
Devirtualize TagDecl::completeDefinition().
Modified:
cfe/trunk/include/clang/AST/Decl.h
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclCXX.cpp
Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=125755&r1=125754&r2=125755&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Thu Feb 17 12:06:05 2011
@@ -2485,9 +2485,8 @@
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; }
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=125755&r1=125754&r2=125755&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Feb 17 12:06:05 2011
@@ -447,6 +447,9 @@
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 @@
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
///
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=125755&r1=125754&r2=125755&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Feb 17 12:06:05 2011
@@ -2128,13 +2128,6 @@
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 @@
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
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclCXX.cpp?rev=125755&r1=125754&r2=125755&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclCXX.cpp (original)
+++ cfe/trunk/lib/AST/DeclCXX.cpp Thu Feb 17 12:06:05 2011
@@ -819,13 +819,8 @@
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 @@
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())
More information about the cfe-commits
mailing list