r297133 - [index] Mark categories of test classes with the 'UnitTest' symbol property as well.
Argyrios Kyrtzidis via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 7 01:38:08 PST 2017
Author: akirtzidis
Date: Tue Mar 7 03:38:08 2017
New Revision: 297133
URL: http://llvm.org/viewvc/llvm-project?rev=297133&view=rev
Log:
[index] Mark categories of test classes with the 'UnitTest' symbol property as well.
Modified:
cfe/trunk/lib/Index/IndexSymbol.cpp
cfe/trunk/test/Index/Core/index-subkinds.m
Modified: cfe/trunk/lib/Index/IndexSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexSymbol.cpp?rev=297133&r1=297132&r2=297133&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexSymbol.cpp (original)
+++ cfe/trunk/lib/Index/IndexSymbol.cpp Tue Mar 7 03:38:08 2017
@@ -185,10 +185,18 @@ SymbolInfo index::getSymbolInfo(const De
Info.Lang = SymbolLanguage::ObjC;
break;
case Decl::ObjCCategory:
- case Decl::ObjCCategoryImpl:
+ case Decl::ObjCCategoryImpl: {
Info.Kind = SymbolKind::Extension;
Info.Lang = SymbolLanguage::ObjC;
+ const ObjCInterfaceDecl *ClsD = nullptr;
+ if (auto *CatD = dyn_cast<ObjCCategoryDecl>(D))
+ ClsD = CatD->getClassInterface();
+ else
+ ClsD = cast<ObjCCategoryImplDecl>(D)->getClassInterface();
+ if (isUnitTestCase(ClsD))
+ Info.Properties |= (unsigned)SymbolProperty::UnitTest;
break;
+ }
case Decl::ObjCMethod:
if (cast<ObjCMethodDecl>(D)->isInstanceMethod()) {
const ObjCMethodDecl *MD = cast<ObjCMethodDecl>(D);
Modified: cfe/trunk/test/Index/Core/index-subkinds.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/Core/index-subkinds.m?rev=297133&r1=297132&r2=297133&view=diff
==============================================================================
--- cfe/trunk/test/Index/Core/index-subkinds.m (original)
+++ cfe/trunk/test/Index/Core/index-subkinds.m Tue Mar 7 03:38:08 2017
@@ -28,11 +28,11 @@
// CHECK: [[@LINE+3]]:12 | class(test)/ObjC | MyTestCase | c:objc(cs)MyTestCase | _OBJC_CLASS_$_MyTestCase | Ref,RelExt,RelCont | rel: 1
// CHECK-NEXT: RelExt,RelCont | cat | c:objc(cy)MyTestCase at cat
-// CHECK: [[@LINE+1]]:23 | extension/ObjC | cat | c:objc(cy)MyTestCase at cat | <no-cgname> | Decl | rel: 0
+// CHECK: [[@LINE+1]]:23 | extension(test)/ObjC | cat | c:objc(cy)MyTestCase at cat | <no-cgname> | Decl | rel: 0
@interface MyTestCase(cat)
@end
// CHECK: [[@LINE+2]]:17 | class(test)/ObjC | MyTestCase | c:objc(cs)MyTestCase | _OBJC_CLASS_$_MyTestCase | Ref,RelCont | rel: 1
-// CHECK: [[@LINE+1]]:28 | extension/ObjC | cat | c:objc(cy)MyTestCase at cat | <no-cgname> | Def | rel: 0
+// CHECK: [[@LINE+1]]:28 | extension(test)/ObjC | cat | c:objc(cy)MyTestCase at cat | <no-cgname> | Def | rel: 0
@implementation MyTestCase(cat)
// CHECK: [[@LINE+1]]:9 | instance-method(test)/ObjC | testInCat | c:objc(cs)MyTestCase(im)testInCat | -[MyTestCase(cat) testInCat] | Def,Dyn,RelChild | rel: 1
- (void)testInCat {}
More information about the cfe-commits
mailing list