diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-22 23:23:42 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-22 23:23:42 +0000 |
commit | 2fb5d1297e874d8f6d86a3586c7d25dcfb104f69 (patch) | |
tree | 7878a50e390e4fca2d97745cee8395b60b72b57e | |
parent | af22621352481e91488a54ea0e0b5e73f6551ab7 (diff) |
When modifying an implicit instantiation with information from an explicit one, make sure to reset the "right brace" location.
Otherwise the source range of the explicit instantiation may become invalid (begin location will be after the end location).
rdar://13706991
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180070 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaTemplate.cpp | 1 | ||||
-rw-r--r-- | test/Index/get-cursor.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index ae091e3da3..b9695cc1e1 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -6460,6 +6460,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, // Set source locations for keywords. Specialization->setExternLoc(ExternLoc); Specialization->setTemplateKeywordLoc(TemplateLoc); + Specialization->setRBraceLoc(SourceLocation()); if (Attr) ProcessDeclAttributeList(S, Specialization, Attr); diff --git a/test/Index/get-cursor.cpp b/test/Index/get-cursor.cpp index 37bb70f307..996ecc25ef 100644 --- a/test/Index/get-cursor.cpp +++ b/test/Index/get-cursor.cpp @@ -55,6 +55,16 @@ struct TS { template <bool (*tfn)(X*)> void TS<tfn>::foo() {} +template <typename T> +class TC { + void init(); +}; + +template<> void TC<char>::init(); + +#define EXTERN_TEMPLATE(...) extern template __VA_ARGS__; +EXTERN_TEMPLATE(class TC<char>) + // RUN: c-index-test -cursor-at=%s:6:4 %s | FileCheck -check-prefix=CHECK-COMPLETION-1 %s // CHECK-COMPLETION-1: CXXConstructor=X:6:3 // CHECK-COMPLETION-1-NEXT: Completion string: {TypedText X}{LeftParen (}{Placeholder int}{Comma , }{Placeholder int}{RightParen )} @@ -115,3 +125,6 @@ void TS<tfn>::foo() {} // RUN: c-index-test -cursor-at=%s:50:23 -cursor-at=%s:55:23 %s | FileCheck -check-prefix=CHECK-TEMPLPARAM %s // CHECK-TEMPLPARAM: 50:23 TypeRef=struct X:3:8 Extent=[50:23 - 50:24] Spelling=struct X ([50:23 - 50:24]) // CHECK-TEMPLPARAM: 55:23 TypeRef=struct X:3:8 Extent=[55:23 - 55:24] Spelling=struct X ([55:23 - 55:24]) + +// RUN: c-index-test -cursor-at=%s:66:23 %s | FileCheck -check-prefix=CHECK-TEMPLSPEC %s +// CHECK-TEMPLSPEC: 66:23 ClassDecl=TC:66:23 (Definition) [Specialization of TC:59:7] Extent=[66:1 - 66:31] Spelling=TC ([66:23 - 66:25]) |