[cfe-commits] r165139 - in /cfe/trunk: include/clang/Serialization/ASTReader.h lib/Serialization/ASTReaderDecl.cpp
Douglas Gregor
dgregor at apple.com
Wed Oct 3 11:38:43 PDT 2012
Author: dgregor
Date: Wed Oct 3 13:38:43 2012
New Revision: 165139
URL: http://llvm.org/viewvc/llvm-project?rev=165139&view=rev
Log:
Remove ASTReader::needPendingInstantiation(), introduced in r164993,
which is neither correct nor necessary. The use of this routine was
eliminated by r165137.
Modified:
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=165139&r1=165138&r2=165139&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Wed Oct 3 13:38:43 2012
@@ -917,10 +917,6 @@
void finishPendingActions();
- /// \brief Whether D needs to be instantiated, i.e. whether an instantiation
- /// for D does not exist yet.
- bool needPendingInstantiation(ValueDecl* D) const;
-
/// \brief Produce an error diagnostic and return true.
///
/// This routine should only be used for fatal errors that have to
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=165139&r1=165138&r2=165139&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Oct 3 13:38:43 2012
@@ -2510,60 +2510,3 @@
}
}
}
-
-/// \brief Return a template specialization of ND (should be a TemplateDecl)
-/// that matches FD or TD.
-static NamedDecl* findMatchingSpecialization(FunctionDecl* FD,
- ClassTemplateSpecializationDecl*TD,
- NamedDecl* ND) {
- TemplateDecl* Templt = dyn_cast<TemplateDecl>(ND);
- if (!Templt) return 0;
- if (FD) {
- FunctionTemplateDecl* FTD = dyn_cast<FunctionTemplateDecl>(Templt);
- if (!FTD) return 0;
- const TemplateArgumentList* TmpltArgs = FD->getTemplateSpecializationArgs();
- assert(TmpltArgs || "Template without arguments");
- void* InsertionPoint;
- return FTD->findSpecialization(TmpltArgs->data(), TmpltArgs->size(),
- InsertionPoint);
- } else {
- ClassTemplateDecl* CTD = dyn_cast<ClassTemplateDecl>(Templt);
- if (!CTD) return 0;
- const TemplateArgumentList& TmpltArgs = TD->getTemplateArgs();
- void* InsertionPoint;
- return CTD->findSpecialization(TmpltArgs.data(), TmpltArgs.size(),
- InsertionPoint);
- }
- return 0;
-}
-
-/// \brief Find out whether an instantiation (outside the module) already exists
-bool ASTReader::needPendingInstantiation(ValueDecl* D) const {
- DeclContext *DC = D->getDeclContext()->getRedeclContext();
- DeclarationName Name = D->getDeclName();
- assert(Name && "unnamed template");
-
- FunctionDecl* FD = dyn_cast<FunctionDecl>(D);
- ClassTemplateSpecializationDecl* CD
- = FD ? 0 : dyn_cast<ClassTemplateSpecializationDecl>(D);
-
- NamedDecl* FoundSpecialization = 0;
- if (DC->isTranslationUnit() && SemaObj) {
- IdentifierResolver &IdResolver = SemaObj->IdResolver;
- for (IdentifierResolver::iterator I = IdResolver.begin(Name),
- IEnd = IdResolver.end();
- I != IEnd && !FoundSpecialization; ++I)
- FoundSpecialization = findMatchingSpecialization(FD, CD, *I);
- } else {
- // templates are redeclarables, i.e. they must have been merged into
- // the primary context. Use localUncachedLookup to not pick up template
- // decls from modules again.
- llvm::SmallVector<NamedDecl*, 6> Results;
- DC->getPrimaryContext()->localUncachedLookup(Name, Results);
- for (llvm::SmallVector<NamedDecl *, 6>::const_iterator
- I = Results.begin(), E = Results.end();
- I != E && FoundSpecialization; ++I)
- FoundSpecialization = findMatchingSpecialization(FD, CD, *I);
- }
- return FoundSpecialization && isSameEntity(FoundSpecialization, D);
-}
More information about the cfe-commits
mailing list