aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorCraig Silverstein <csilvers2000@yahoo.com>2010-11-18 08:32:02 +0000
committerCraig Silverstein <csilvers2000@yahoo.com>2010-11-18 08:32:02 +0000
commit45ab4b5f8961dadcef6545ed6956da5daf95c6cb (patch)
tree287f071496fcba8bd8457626f8d05b0b4195fdf1 /lib/Sema/SemaTemplate.cpp
parentf89e55ab1bfb3ea997f8b02997c611a02254eb2d (diff)
In some situations, TemplateArgumentLoc wasn't setting TypeSourceLoc (see
http://llvm.org/bugs/show_bug.cgi?id=8558). This patch fixes it. Thanks to rjmccall for all the coaching! Approved by rjmccall git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119697 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index 4c25bc32df..daa1e726a0 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -1646,14 +1646,14 @@ Sema::ActOnTemplateIdType(TemplateTy TemplateD, SourceLocation TemplateLoc,
return CreateParsedType(Result, DI);
}
-TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult,
+TypeResult Sema::ActOnTagTemplateIdType(CXXScopeSpec &SS,
+ TypeResult TypeResult,
TagUseKind TUK,
TypeSpecifierType TagSpec,
SourceLocation TagLoc) {
if (TypeResult.isInvalid())
return ::TypeResult();
- // FIXME: preserve source info, ideally without copying the DI.
TypeSourceInfo *DI;
QualType Type = GetTypeFromParser(TypeResult.get(), &DI);
@@ -1678,7 +1678,12 @@ TypeResult Sema::ActOnTagTemplateIdType(TypeResult TypeResult,
= TypeWithKeyword::getKeywordForTagTypeKind(TagKind);
QualType ElabType = Context.getElaboratedType(Keyword, /*NNS=*/0, Type);
- return ParsedType::make(ElabType);
+ TypeSourceInfo *ElabDI = Context.CreateTypeSourceInfo(ElabType);
+ ElaboratedTypeLoc TL = cast<ElaboratedTypeLoc>(ElabDI->getTypeLoc());
+ TL.setKeywordLoc(TagLoc);
+ TL.setQualifierRange(SS.getRange());
+ TL.getNamedTypeLoc().initializeFullCopy(DI->getTypeLoc());
+ return CreateParsedType(ElabType, ElabDI);
}
ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,