raw_ostream &OS);
/// \brief Generate a USR fragment for an Objective-C property.
-void generateUSRForObjCProperty(StringRef Prop, raw_ostream &OS);
+void generateUSRForObjCProperty(StringRef Prop, bool isClassProp, raw_ostream &OS);
/// \brief Generate a USR fragment for an Objective-C protocol.
void generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS);
}
/// Generate a USR fragment for an Objective-C property.
- void GenObjCProperty(StringRef prop) {
- generateUSRForObjCProperty(prop, Out);
+ void GenObjCProperty(StringRef prop, bool isClassProp) {
+ generateUSRForObjCProperty(prop, isClassProp, Out);
}
/// Generate a USR for an Objective-C protocol.
Visit(ID);
else
Visit(cast<Decl>(D->getDeclContext()));
- GenObjCProperty(D->getName());
+ GenObjCProperty(D->getName(), D->isClassProperty());
}
void USRGenerator::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) {
OS << (IsInstanceMethod ? "(im)" : "(cm)") << Sel;
}
-void clang::index::generateUSRForObjCProperty(StringRef Prop, raw_ostream &OS) {
- OS << "(py)" << Prop;
+void clang::index::generateUSRForObjCProperty(StringRef Prop, bool isClassProp,
+ raw_ostream &OS) {
+ OS << (isClassProp ? "(cpy)" : "(py)") << Prop;
}
void clang::index::generateUSRForObjCProtocol(StringRef Prot, raw_ostream &OS) {
@class I5;
@interface I5
-(void)meth;
+@property (class) int c;
@end
// RUN: c-index-test -index-file %s -target x86_64-apple-macosx10.7 > %t
// CHECK-NOT: [indexDeclaration]: kind: objc-instance-method {{.*}} loc: 43:
// CHECK: [indexDeclaration]: kind: objc-instance-method | name: meth | {{.*}} loc: 54:1 | {{.*}} | isRedecl: 0 | isDef: 0 |
+// CHECK: [indexDeclaration]: kind: objc-property | name: c | USR: c:objc(cs)I5(cpy)c | lang: ObjC | cursor: ObjCPropertyDecl=c:55:23 [class,] | loc: 55:23
SmallString<128> Buf(getUSRSpacePrefix());
llvm::raw_svector_ostream OS(Buf);
OS << extractUSRSuffix(clang_getCString(classUSR));
- generateUSRForObjCProperty(property, OS);
+ generateUSRForObjCProperty(property, /*isClassProp=*/false, OS);
return cxstring::createDup(OS.str());
}