From 954b5de0d816046962813ef8052eea3b636b7441 Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 4 Nov 2010 19:04:38 +0000 Subject: Use the real keyword location when rebuilding an elaborated type instead of making something up. Fixes PR8129. llvm-svn: 118258 --- clang/lib/Sema/SemaTemplateInstantiate.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp') diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index f78fe81aa8b..af9af0ab83a 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -618,7 +618,8 @@ namespace { /// \brief Check for tag mismatches when instantiating an /// elaborated type. - QualType RebuildElaboratedType(ElaboratedTypeKeyword Keyword, + QualType RebuildElaboratedType(SourceLocation KeywordLoc, + ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType T); ExprResult TransformPredefinedExpr(PredefinedExpr *E); @@ -743,14 +744,14 @@ VarDecl *TemplateInstantiator::RebuildObjCExceptionDecl(VarDecl *ExceptionDecl, } QualType -TemplateInstantiator::RebuildElaboratedType(ElaboratedTypeKeyword Keyword, +TemplateInstantiator::RebuildElaboratedType(SourceLocation KeywordLoc, + ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType T) { if (const TagType *TT = T->getAs()) { TagDecl* TD = TT->getDecl(); - // FIXME: this location is very wrong; we really need typelocs. - SourceLocation TagLocation = TD->getTagKeywordLoc(); + SourceLocation TagLocation = KeywordLoc; // FIXME: type might be anonymous. IdentifierInfo *Id = TD->getIdentifier(); @@ -769,7 +770,8 @@ TemplateInstantiator::RebuildElaboratedType(ElaboratedTypeKeyword Keyword, } } - return TreeTransform::RebuildElaboratedType(Keyword, + return TreeTransform::RebuildElaboratedType(KeywordLoc, + Keyword, NNS, T); } -- cgit v1.2.3