diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 11 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 11 |
2 files changed, 10 insertions, 12 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 0ad9f7c53f..41e44ad6d1 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -2166,17 +2166,6 @@ bool Sema::Subst(const TemplateArgumentLoc *Args, unsigned NumArgs, 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; diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 14524235d5..9197b50330 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2860,7 +2860,16 @@ NamedDecl *Sema::FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, (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)) { |