From e994624c001143ee2b8a7a4715aaad5efcd71f18 Mon Sep 17 00:00:00 2001 From: Abramo Bagnara Date: Fri, 18 Nov 2011 08:08:52 +0000 Subject: [PATCH] Fixed implicit instantiations source range. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144977 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiate.cpp | 4 +++- lib/Sema/SemaTemplateInstantiateDecl.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 301bf6a112..e86912a521 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -1818,8 +1818,10 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, if (!FieldsWithMemberInitializers.empty()) ActOnFinishDelayedMemberInitializers(Instantiation); - if (TSK == TSK_ImplicitInstantiation) + if (TSK == TSK_ImplicitInstantiation) { + Instantiation->setLocStart(Pattern->getInnerLocStart()); Instantiation->setRBraceLoc(Pattern->getRBraceLoc()); + } if (Instantiation->isInvalidDecl()) Invalid = true; diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 865d62e14b..c20033bbc2 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -2478,6 +2478,9 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, if (Inst) return; + // Copy the inner loc start from the pattern. + Function->setInnerLocStart(PatternDecl->getInnerLocStart()); + // If we're performing recursive template instantiation, create our own // queue of pending implicit instantiations that we will instantiate later, // while we're still within our own instantiation context. -- 2.40.0