From: Argyrios Kyrtzidis Date: Thu, 10 Nov 2016 23:27:11 +0000 (+0000) Subject: [index] Add SymbolSubKind for the GKInspectable annotation. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f42032abdee3430829556df66ffa5f8d1aa7bdbb;p=platform%2Fupstream%2Fllvm.git [index] Add SymbolSubKind for the GKInspectable annotation. llvm-svn: 286518 --- diff --git a/clang/include/clang/Index/IndexSymbol.h b/clang/include/clang/Index/IndexSymbol.h index d539b49..2b383ac 100644 --- a/clang/include/clang/Index/IndexSymbol.h +++ b/clang/include/clang/Index/IndexSymbol.h @@ -66,8 +66,9 @@ enum class SymbolSubKind : uint8_t { UnitTest = 1 << 3, IBAnnotated = 1 << 4, IBOutletCollection = 1 << 5, + GKInspectable = 1 << 6, }; -static const unsigned SymbolSubKindBitNum = 6; +static const unsigned SymbolSubKindBitNum = 7; typedef unsigned SymbolSubKindSet; /// Set of roles that are attributed to symbol occurrences. diff --git a/clang/lib/Index/IndexSymbol.cpp b/clang/lib/Index/IndexSymbol.cpp index 4126bb6..f5153fb 100644 --- a/clang/lib/Index/IndexSymbol.cpp +++ b/clang/lib/Index/IndexSymbol.cpp @@ -165,6 +165,10 @@ SymbolInfo index::getSymbolInfo(const Decl *D) { Info.Kind = SymbolKind::InstanceProperty; Info.Lang = SymbolLanguage::ObjC; checkForIBOutlets(D, Info.SubKinds); + if (auto *Annot = D->getAttr()) { + if (Annot->getAnnotation() == "gk_inspectable") + Info.SubKinds |= (unsigned)SymbolSubKind::GKInspectable; + } break; case Decl::ObjCIvar: Info.Kind = SymbolKind::Field; @@ -380,6 +384,7 @@ void index::applyForEachSymbolSubKind(SymbolSubKindSet SubKinds, APPLY_FOR_SUBKIND(UnitTest); APPLY_FOR_SUBKIND(IBAnnotated); APPLY_FOR_SUBKIND(IBOutletCollection); + APPLY_FOR_SUBKIND(GKInspectable); #undef APPLY_FOR_SUBKIND } @@ -398,6 +403,7 @@ void index::printSymbolSubKinds(SymbolSubKindSet SubKinds, raw_ostream &OS) { case SymbolSubKind::UnitTest: OS << "test"; break; case SymbolSubKind::IBAnnotated: OS << "IB"; break; case SymbolSubKind::IBOutletCollection: OS << "IBColl"; break; + case SymbolSubKind::GKInspectable: OS << "GKI"; break; } }); } diff --git a/clang/test/Index/Core/index-subkinds.m b/clang/test/Index/Core/index-subkinds.m index a83da03..38be73b 100644 --- a/clang/test/Index/Core/index-subkinds.m +++ b/clang/test/Index/Core/index-subkinds.m @@ -50,3 +50,11 @@ // CHECK: [[@LINE+1]]:1 | instance-method(IB)/ObjC | doIt | c:objc(cs)IBCls(im)doIt | -[IBCls doIt] | Decl,Dyn,RelChild | rel: 1 -(IBAction)doIt; @end + + +#define GKInspectable __attribute__((annotate("gk_inspectable"))) + +@interface GKI +// CHECK: [[@LINE+1]]:40 | instance-property(GKI)/ObjC | gkIntProp | c:objc(cs)GKI(py)gkIntProp | | Decl,RelChild | rel: 1 +@property (readonly) GKInspectable int gkIntProp; +@end