diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-14 16:38:05 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-14 16:38:05 +0000 |
commit | ef96ee0be5f100789f451641542a69cd719144d2 (patch) | |
tree | 657c479e4155abe55bc69e1313498d0d997377ae /lib/Serialization/ASTWriterDecl.cpp | |
parent | 09dd3798e100ace40defdc5541277502346213f2 (diff) |
De-virtualize getPreviousDecl() and getMostRecentDecl() when we know
we have a redeclarable type, and only use the new virtual versions
(getPreviousDeclImpl() and getMostRecentDeclImpl()) when we don't have
that type information. This keeps us from penalizing users with strict
type information (and is the moral equivalent of a "final" method).
Plus, settle on the names getPreviousDecl() and getMostRecentDecl()
throughout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148187 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Serialization/ASTWriterDecl.cpp')
-rw-r--r-- | lib/Serialization/ASTWriterDecl.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 32432c0a4f..02d0c3cfef 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -186,7 +186,7 @@ void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) { if (!D->hasAttrs() && !D->isImplicit() && !D->isUsed(false) && - !D->getPreviousDeclaration() && + !D->getPreviousDecl() && !D->isInvalidDecl() && !D->isReferenced() && !D->isTopLevelDeclInObjCContainer() && @@ -236,7 +236,7 @@ void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) { !D->isImplicit() && !D->isUsed(false) && !D->hasExtInfo() && - !D->getPreviousDeclaration() && + !D->getPreviousDecl() && !D->isInvalidDecl() && !D->isReferenced() && !D->isTopLevelDeclInObjCContainer() && @@ -260,7 +260,7 @@ void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) { !D->isImplicit() && !D->isUsed(false) && !D->hasExtInfo() && - !D->getPreviousDeclaration() && + !D->getPreviousDecl() && !D->isInvalidDecl() && !D->isReferenced() && !D->isTopLevelDeclInObjCContainer() && @@ -692,7 +692,7 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) { !D->isModulePrivate() && D->getDeclName().getNameKind() == DeclarationName::Identifier && !D->hasExtInfo() && - !D->getPreviousDeclaration() && + !D->getPreviousDecl() && !D->hasCXXDirectInitializer() && D->getInit() == 0 && !isa<ParmVarDecl>(D) && @@ -748,7 +748,7 @@ void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) { assert(!D->isThreadSpecified() && "PARM_VAR_DECL can't be __thread"); assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private"); assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var"); - assert(D->getPreviousDeclaration() == 0 && "PARM_VAR_DECL can't be redecl"); + assert(D->getPreviousDecl() == 0 && "PARM_VAR_DECL can't be redecl"); assert(!D->isStaticDataMember() && "PARM_VAR_DECL can't be static data member"); } @@ -834,7 +834,7 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) { } if (Writer.hasChain() && D->isAnonymousNamespace() && - D == D->getMostRecentDeclaration()) { + D == D->getMostRecentDecl()) { // This is a most recent reopening of the anonymous namespace. If its parent // is in a previous PCH (or is the TU), mark that parent for update, because // the original namespace always points to the latest re-opening of its @@ -1118,7 +1118,7 @@ void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl( Record.push_back(D->getSequenceNumber()); // These are read/set from/to the first declaration. - if (D->getPreviousDeclaration() == 0) { + if (D->getPreviousDecl() == 0) { Writer.AddDeclRef(D->getInstantiatedFromMember(), Record); Record.push_back(D->isMemberSpecialization()); } @@ -1238,7 +1238,7 @@ void ASTDeclWriter::VisitDeclContext(DeclContext *DC, uint64_t LexicalOffset, template <typename T> void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) { enum { FirstDeclaration = 0, FirstInFile, PointsToPrevious }; - T *Prev = D->getPreviousDeclaration(); + T *Prev = D->getPreviousDecl(); T *First = D->getFirstDeclaration(); if (!Prev) { @@ -1246,7 +1246,7 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) { } else { Record.push_back(Prev->isFromASTFile()? FirstInFile : PointsToPrevious); Writer.AddDeclRef(First, Record); - Writer.AddDeclRef(D->getPreviousDeclaration(), Record); + Writer.AddDeclRef(D->getPreviousDecl(), Record); } if (D->RedeclLink.getPointer() != D && (!Prev || Prev->isFromASTFile())) { @@ -1254,7 +1254,7 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) { LocalRedeclarationsInfo LocalInfo = { Writer.GetDeclRef(First), Writer.GetDeclRef(static_cast<T*>(D)), - Writer.GetDeclRef(D->getMostRecentDeclaration()) + Writer.GetDeclRef(D->getMostRecentDecl()) }; Writer.LocalRedeclarations.push_back(LocalInfo); } |