diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-07 02:33:33 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-07 02:33:33 +0000 |
commit | 0a0367a479e2ad204a97f87ed72f18209169b775 (patch) | |
tree | 832884d37bf280e2d400a40eb78f073e9fd578db /lib | |
parent | 353ee246e754e38db9b738240d18f1ecf2bb389b (diff) |
When transforming a dependent template specialization type, make sure
to set the source-location information for the template arguments to
the *transformed* source-location information, not the original
source-location information. Fixes <rdar://problem/8986308> (a libc++
SFINAE issue) and the Boost.Polygon failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127150 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/TreeTransform.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 870f992c6d..cab63d060c 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -4513,19 +4513,32 @@ TransformDependentTemplateSpecializationType(TypeLocBuilder &TLB, // Copy information relevant to the template specialization. TemplateSpecializationTypeLoc NamedTL - = TLB.push<TemplateSpecializationTypeLoc>(NamedT); + = TLB.push<TemplateSpecializationTypeLoc>(NamedT); NamedTL.setLAngleLoc(TL.getLAngleLoc()); NamedTL.setRAngleLoc(TL.getRAngleLoc()); - for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) - NamedTL.setArgLocInfo(I, TL.getArgLocInfo(I)); + for (unsigned I = 0, E = NamedTL.getNumArgs(); I != E; ++I) + NamedTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo()); // Copy information relevant to the elaborated type. ElaboratedTypeLoc NewTL = TLB.push<ElaboratedTypeLoc>(Result); NewTL.setKeywordLoc(TL.getKeywordLoc()); NewTL.setQualifierLoc(QualifierLoc); + } else if (isa<DependentTemplateSpecializationType>(Result)) { + DependentTemplateSpecializationTypeLoc SpecTL + = TLB.push<DependentTemplateSpecializationTypeLoc>(Result); + 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) + SpecTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo()); } else { - TypeLoc NewTL(Result, TL.getOpaqueData()); - TLB.pushFullCopy(NewTL); + TemplateSpecializationTypeLoc SpecTL + = TLB.push<TemplateSpecializationTypeLoc>(Result); + SpecTL.setLAngleLoc(TL.getLAngleLoc()); + SpecTL.setRAngleLoc(TL.getRAngleLoc()); + for (unsigned I = 0, E = SpecTL.getNumArgs(); I != E; ++I) + SpecTL.setArgLocInfo(I, NewTemplateArgs[I].getLocInfo()); } return Result; } |