[cfe-commits] r125770 - in /cfe/trunk: include/clang/Sema/Template.h lib/Sema/SemaTemplateInstantiate.cpp lib/Sema/SemaTemplateInstantiateDecl.cpp
Chris Lattner
sabre at nondot.org
Thu Feb 17 11:47:42 PST 2011
Author: lattner
Date: Thu Feb 17 13:47:42 2011
New Revision: 125770
URL: http://llvm.org/viewvc/llvm-project?rev=125770&view=rev
Log:
Inline LocalInstantiationScope::getInstantiationOf into its one
client, making room for future hacking.
Modified:
cfe/trunk/include/clang/Sema/Template.h
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
Modified: cfe/trunk/include/clang/Sema/Template.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Template.h?rev=125770&r1=125769&r2=125770&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Template.h (original)
+++ cfe/trunk/include/clang/Sema/Template.h Thu Feb 17 13:47:42 2011
@@ -253,6 +253,8 @@
~LocalInstantiationScope() {
Exit();
}
+
+ const Sema &getSema() const { return SemaRef; }
/// \brief Exit this local instantiation scope early.
void Exit() {
@@ -266,8 +268,6 @@
Exited = true;
}
- Decl *getInstantiationOf(const Decl *D);
-
/// \brief Find the instantiation of the declaration D within the current
/// instantiation scope.
///
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=125770&r1=125769&r2=125770&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Thu Feb 17 13:47:42 2011
@@ -2166,17 +2166,6 @@
return Instantiator.TransformTemplateArguments(Args, NumArgs, Result);
}
-Decl *LocalInstantiationScope::getInstantiationOf(const Decl *D) {
- llvm::PointerUnion<Decl *, DeclArgumentPack *> *Found= findInstantiationOf(D);
- assert(Found);
-
- if (Found->is<Decl *>())
- return Found->get<Decl *>();
-
- return (*Found->get<DeclArgumentPack *>())[
- SemaRef.ArgumentPackSubstitutionIndex];
-}
-
llvm::PointerUnion<Decl *, LocalInstantiationScope::DeclArgumentPack *> *
LocalInstantiationScope::findInstantiationOf(const Decl *D) {
for (LocalInstantiationScope *Current = this; Current;
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=125770&r1=125769&r2=125770&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Thu Feb 17 13:47:42 2011
@@ -2860,7 +2860,16 @@
(ParentDC->isFunctionOrMethod() && ParentDC->isDependentContext())) {
// D is a local of some kind. Look into the map of local
// declarations to their instantiations.
- return cast<NamedDecl>(CurrentInstantiationScope->getInstantiationOf(D));
+ typedef LocalInstantiationScope::DeclArgumentPack DeclArgumentPack;
+ llvm::PointerUnion<Decl *, DeclArgumentPack *> *Found
+ = CurrentInstantiationScope->findInstantiationOf(D);
+ assert(Found);
+
+ if (Decl *FD = Found->dyn_cast<Decl *>())
+ return cast<NamedDecl>(FD);
+
+ unsigned PackIdx = ArgumentPackSubstitutionIndex;
+ return cast<NamedDecl>((*Found->get<DeclArgumentPack *>())[PackIdx]);
}
if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(D)) {
More information about the cfe-commits
mailing list