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/Sema/SemaTemplateInstantiateDecl.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/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 00addc2d83..c07ae75cb2 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -163,7 +163,7 @@ Decl *TemplateDeclInstantiator::InstantiateTypedefNameDecl(TypedefNameDecl *D, } } - if (TypedefNameDecl *Prev = D->getPreviousDeclaration()) { + if (TypedefNameDecl *Prev = D->getPreviousDecl()) { NamedDecl *InstPrev = SemaRef.FindInstantiatedDecl(D->getLocation(), Prev, TemplateArgs); if (!InstPrev) @@ -210,7 +210,7 @@ TemplateDeclInstantiator::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) { TypeAliasDecl *Pattern = D->getTemplatedDecl(); TypeAliasTemplateDecl *PrevAliasTemplate = 0; - if (Pattern->getPreviousDeclaration()) { + if (Pattern->getPreviousDecl()) { DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName()); if (Found.first != Found.second) { PrevAliasTemplate = dyn_cast<TypeAliasTemplateDecl>(*Found.first); @@ -739,7 +739,7 @@ Decl *TemplateDeclInstantiator::VisitClassTemplateDecl(ClassTemplateDecl *D) { CXXRecordDecl *PrevDecl = 0; ClassTemplateDecl *PrevClassTemplate = 0; - if (!isFriend && Pattern->getPreviousDeclaration()) { + if (!isFriend && Pattern->getPreviousDecl()) { DeclContext::lookup_result Found = Owner->lookup(Pattern->getDeclName()); if (Found.first != Found.second) { PrevClassTemplate = dyn_cast<ClassTemplateDecl>(*Found.first); @@ -976,9 +976,9 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) { CXXRecordDecl *PrevDecl = 0; if (D->isInjectedClassName()) PrevDecl = cast<CXXRecordDecl>(Owner); - else if (D->getPreviousDeclaration()) { + else if (D->getPreviousDecl()) { NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->getLocation(), - D->getPreviousDeclaration(), + D->getPreviousDecl(), TemplateArgs); if (!Prev) return 0; PrevDecl = cast<CXXRecordDecl>(Prev); @@ -1238,9 +1238,9 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, if (isFriend) { NamedDecl *PrevDecl; if (TemplateParams) - PrevDecl = FunctionTemplate->getPreviousDeclaration(); + PrevDecl = FunctionTemplate->getPreviousDecl(); else - PrevDecl = Function->getPreviousDeclaration(); + PrevDecl = Function->getPreviousDecl(); PrincipalDecl->setObjectOfFriendDecl(PrevDecl != 0); DC->makeDeclVisibleInContext(PrincipalDecl, /*Recoverable=*/ false); @@ -3340,12 +3340,12 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) { // Don't try to instantiate declarations if the most recent redeclaration // is invalid. - if (Var->getMostRecentDeclaration()->isInvalidDecl()) + if (Var->getMostRecentDecl()->isInvalidDecl()) continue; // Check if the most recent declaration has changed the specialization kind // and removed the need for implicit instantiation. - switch (Var->getMostRecentDeclaration()->getTemplateSpecializationKind()) { + switch (Var->getMostRecentDecl()->getTemplateSpecializationKind()) { case TSK_Undeclared: llvm_unreachable("Cannot instantitiate an undeclared specialization."); case TSK_ExplicitInstantiationDeclaration: @@ -3354,7 +3354,7 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) { case TSK_ExplicitInstantiationDefinition: // We only need an instantiation if the pending instantiation *is* the // explicit instantiation. - if (Var != Var->getMostRecentDeclaration()) continue; + if (Var != Var->getMostRecentDecl()) continue; case TSK_ImplicitInstantiation: break; } |