forked from OSchip/llvm-project
[index] Add SymbolSubKind for the GKInspectable annotation.
llvm-svn: 286518
This commit is contained in:
parent
c03b5c9c6f
commit
f42032abde
|
@ -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.
|
||||
|
|
|
@ -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<AnnotateAttr>()) {
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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 | <no-cgname> | Decl,RelChild | rel: 1
|
||||
@property (readonly) GKInspectable int gkIntProp;
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue