From cf55f2614a17bc877fc6428adc1157b995e60df6 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Mon, 7 Nov 2016 21:20:08 +0000 Subject: [PATCH] [index] Make sure to mark class template symbols as having 'generic' sub-kind. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286153 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexSymbol.cpp | 9 +++++++-- test/Index/Core/index-source.cpp | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/Index/IndexSymbol.cpp b/lib/Index/IndexSymbol.cpp index 65f5241037..d98d7c0724 100644 --- a/lib/Index/IndexSymbol.cpp +++ b/lib/Index/IndexSymbol.cpp @@ -74,9 +74,14 @@ SymbolInfo index::getSymbolInfo(const Decl *D) { Info.Kind = SymbolKind::Enum; break; } - if (const CXXRecordDecl *CXXRec = dyn_cast(D)) - if (!CXXRec->isCLike()) + if (const CXXRecordDecl *CXXRec = dyn_cast(D)) { + if (!CXXRec->isCLike()) { Info.Lang = SymbolLanguage::CXX; + if (CXXRec->getDescribedClassTemplate()) { + Info.SubKinds |= (unsigned)SymbolSubKind::Generic; + } + } + } if (isa(D)) { Info.SubKinds |= (unsigned)SymbolSubKind::Generic; diff --git a/test/Index/Core/index-source.cpp b/test/Index/Core/index-source.cpp index 11ac89529d..61b9675240 100644 --- a/test/Index/Core/index-source.cpp +++ b/test/Index/Core/index-source.cpp @@ -2,12 +2,16 @@ template class TemplCls { -// CHECK: [[@LINE-1]]:7 | class/C++ | TemplCls | c:@ST>1#T@TemplCls | | Def | rel: 0 +// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | TemplCls | c:@ST>1#T@TemplCls | | Def | rel: 0 +public: TemplCls(int x); // CHECK: [[@LINE-1]]:3 | constructor/C++ | TemplCls | c:@ST>1#T@TemplCls@F@TemplCls#I# | | Decl,RelChild | rel: 1 // CHECK-NEXT: RelChild | TemplCls | c:@ST>1#T@TemplCls }; +TemplCls gtv(0); +// CHECK: [[@LINE-1]]:1 | class(Gen)/C++ | TemplCls | c:@ST>1#T@TemplCls | | Ref | rel: 0 + template class BT { struct KLR { -- 2.40.0