r286153 - [index] Make sure to mark class template symbols as having 'generic' sub-kind.
Argyrios Kyrtzidis via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 7 13:20:08 PST 2016
Author: akirtzidis
Date: Mon Nov 7 15:20:08 2016
New Revision: 286153
URL: http://llvm.org/viewvc/llvm-project?rev=286153&view=rev
Log:
[index] Make sure to mark class template symbols as having 'generic' sub-kind.
Modified:
cfe/trunk/lib/Index/IndexSymbol.cpp
cfe/trunk/test/Index/Core/index-source.cpp
Modified: cfe/trunk/lib/Index/IndexSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexSymbol.cpp?rev=286153&r1=286152&r2=286153&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexSymbol.cpp (original)
+++ cfe/trunk/lib/Index/IndexSymbol.cpp Mon Nov 7 15:20:08 2016
@@ -74,9 +74,14 @@ SymbolInfo index::getSymbolInfo(const De
Info.Kind = SymbolKind::Enum; break;
}
- if (const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D))
- if (!CXXRec->isCLike())
+ if (const CXXRecordDecl *CXXRec = dyn_cast<CXXRecordDecl>(D)) {
+ if (!CXXRec->isCLike()) {
Info.Lang = SymbolLanguage::CXX;
+ if (CXXRec->getDescribedClassTemplate()) {
+ Info.SubKinds |= (unsigned)SymbolSubKind::Generic;
+ }
+ }
+ }
if (isa<ClassTemplatePartialSpecializationDecl>(D)) {
Info.SubKinds |= (unsigned)SymbolSubKind::Generic;
Modified: cfe/trunk/test/Index/Core/index-source.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-source.cpp?rev=286153&r1=286152&r2=286153&view=diff
==============================================================================
--- cfe/trunk/test/Index/Core/index-source.cpp (original)
+++ cfe/trunk/test/Index/Core/index-source.cpp Mon Nov 7 15:20:08 2016
@@ -2,12 +2,16 @@
template <typename TemplArg>
class TemplCls {
-// CHECK: [[@LINE-1]]:7 | class/C++ | TemplCls | c:@ST>1#T at TemplCls | <no-cgname> | Def | rel: 0
+// CHECK: [[@LINE-1]]:7 | class(Gen)/C++ | TemplCls | c:@ST>1#T at TemplCls | <no-cgname> | Def | rel: 0
+public:
TemplCls(int x);
// CHECK: [[@LINE-1]]:3 | constructor/C++ | TemplCls | c:@ST>1#T at TemplCls@F at TemplCls#I# | <no-cgname> | Decl,RelChild | rel: 1
// CHECK-NEXT: RelChild | TemplCls | c:@ST>1#T at TemplCls
};
+TemplCls<int> gtv(0);
+// CHECK: [[@LINE-1]]:1 | class(Gen)/C++ | TemplCls | c:@ST>1#T at TemplCls | <no-cgname> | Ref | rel: 0
+
template <typename T>
class BT {
struct KLR {
More information about the cfe-commits
mailing list