Inline LocalInstantiationScope::getInstantiationOf into its one

client, making room for future hacking.

llvm-svn: 125770
This commit is contained in:
Chris Lattner 2011-02-17 19:47:42 +00:00
parent 15a776fff7
commit 50c3c1316a
3 changed files with 12 additions and 14 deletions

View File

@ -254,6 +254,8 @@ namespace clang {
Exit(); Exit();
} }
const Sema &getSema() const { return SemaRef; }
/// \brief Exit this local instantiation scope early. /// \brief Exit this local instantiation scope early.
void Exit() { void Exit() {
if (Exited) if (Exited)
@ -266,8 +268,6 @@ namespace clang {
Exited = true; Exited = true;
} }
Decl *getInstantiationOf(const Decl *D);
/// \brief Find the instantiation of the declaration D within the current /// \brief Find the instantiation of the declaration D within the current
/// instantiation scope. /// instantiation scope.
/// ///

View File

@ -2166,17 +2166,6 @@ bool Sema::Subst(const TemplateArgumentLoc *Args, unsigned NumArgs,
return Instantiator.TransformTemplateArguments(Args, NumArgs, Result); 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 *> * llvm::PointerUnion<Decl *, LocalInstantiationScope::DeclArgumentPack *> *
LocalInstantiationScope::findInstantiationOf(const Decl *D) { LocalInstantiationScope::findInstantiationOf(const Decl *D) {
for (LocalInstantiationScope *Current = this; Current; for (LocalInstantiationScope *Current = this; Current;

View File

@ -2860,7 +2860,16 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D,
(ParentDC->isFunctionOrMethod() && ParentDC->isDependentContext())) { (ParentDC->isFunctionOrMethod() && ParentDC->isDependentContext())) {
// D is a local of some kind. Look into the map of local // D is a local of some kind. Look into the map of local
// declarations to their instantiations. // 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)) { if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(D)) {