diff options
author | John McCall <rjmccall@apple.com> | 2011-05-01 22:35:37 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-05-01 22:35:37 +0000 |
commit | 8fb0d9d24ad0525b689c93b6c51e9c32ff61ac25 (patch) | |
tree | 238196380fe664192db3cf40564aa3e378a31546 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | bbf65b05014d929fb285a0a4c6b8925481fd3a31 (diff) | |
download | bcm5719-llvm-8fb0d9d24ad0525b689c93b6c51e9c32ff61ac25.tar.gz bcm5719-llvm-8fb0d9d24ad0525b689c93b6c51e9c32ff61ac25.zip |
Store a parameter index and function prototype depth in every
parameter node and use this to correctly mangle parameter
references in function template signatures.
A follow-up patch will improve the storage usage of these
fields; here I've just done the lazy thing.
llvm-svn: 130669
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index dbe51a82523..92ba095cd6c 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -757,6 +757,7 @@ namespace { QualType TransformFunctionProtoType(TypeLocBuilder &TLB, FunctionProtoTypeLoc TL); ParmVarDecl *TransformFunctionTypeParam(ParmVarDecl *OldParm, + int indexAdjustment, llvm::Optional<unsigned> NumExpansions); /// \brief Transforms a template type parameter type by performing @@ -1174,8 +1175,9 @@ QualType TemplateInstantiator::TransformFunctionProtoType(TypeLocBuilder &TLB, ParmVarDecl * TemplateInstantiator::TransformFunctionTypeParam(ParmVarDecl *OldParm, + int indexAdjustment, llvm::Optional<unsigned> NumExpansions) { - return SemaRef.SubstParmVarDecl(OldParm, TemplateArgs, + return SemaRef.SubstParmVarDecl(OldParm, TemplateArgs, indexAdjustment, NumExpansions); } @@ -1422,6 +1424,7 @@ TypeSourceInfo *Sema::SubstFunctionDeclType(TypeSourceInfo *T, ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm, const MultiLevelTemplateArgumentList &TemplateArgs, + int indexAdjustment, llvm::Optional<unsigned> NumExpansions) { TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo(); TypeSourceInfo *NewDI = 0; @@ -1492,6 +1495,9 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm, // FIXME: OldParm may come from a FunctionProtoType, in which case CurContext // can be anything, is this right ? NewParm->setDeclContext(CurContext); + + NewParm->setScopeInfo(OldParm->getFunctionScopeDepth(), + OldParm->getFunctionScopeIndex() + indexAdjustment); return NewParm; } |