From: Douglas Gregor Date: Mon, 7 Mar 2011 15:13:34 +0000 (+0000) Subject: When rebuilding a dependent template specialization type to another X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=944cdae86ecb2ab5deda96804099bd28f6a6cd39;p=clang When rebuilding a dependent template specialization type to another dependent template specialization type, make sure to set the keyword location. Fixes some valgrind issues introduced in r127150. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127159 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index cab63d060c..7f055c08cc 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -4516,7 +4516,7 @@ TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB, = TLB.push(NamedT); NamedTL.setLAngleLoc(TL.getLAngleLoc()); NamedTL.setRAngleLoc(TL.getRAngleLoc()); - for (unsigned I = 0, E = NamedTL.getNumArgs(); I != E; ++I) + for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I) NamedTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo()); // Copy information relevant to the elaborated type. @@ -4526,18 +4526,19 @@ TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB, } else if (isa(Result)) { DependentTemplateSpecializationTypeLoc SpecTL = TLB.push(Result); + SpecTL.setKeywordLoc(TL.getKeywordLoc()); SpecTL.setQualifierLoc(QualifierLoc); SpecTL.setLAngleLoc(TL.getLAngleLoc()); SpecTL.setRAngleLoc(TL.getRAngleLoc()); SpecTL.setNameLoc(TL.getNameLoc()); - for (unsigned I = 0, E = SpecTL.getNumArgs(); I != E; ++I) + for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I) SpecTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo()); } else { TemplateSpecializationTypeLoc SpecTL = TLB.push(Result); SpecTL.setLAngleLoc(TL.getLAngleLoc()); SpecTL.setRAngleLoc(TL.getRAngleLoc()); - for (unsigned I = 0, E = SpecTL.getNumArgs(); I != E; ++I) + for (unsigned I = 0, E = NewTemplateArgs.size(); I != E; ++I) SpecTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo()); } return Result;