diff options
-rw-r--r-- | clang/include/clang/Index/USRGeneration.h | 2 | ||||
-rw-r--r-- | clang/lib/Index/USRGeneration.cpp | 11 | ||||
-rw-r--r-- | clang/test/Index/index-decls.m | 2 | ||||
-rw-r--r-- | clang/tools/libclang/CIndexUSRs.cpp | 2 |
4 files changed, 10 insertions, 7 deletions
diff --git a/clang/include/clang/Index/USRGeneration.h b/clang/include/clang/Index/USRGeneration.h index 55e35cc6d9b..be89068469c 100644 --- a/clang/include/clang/Index/USRGeneration.h +++ b/clang/include/clang/Index/USRGeneration.h @@ -44,7 +44,7 @@ void generateUSRForObjCMethod(StringRef Sel, bool IsInstanceMethod, 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); diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp index 11ee8731898..30f1add249b 100644 --- a/clang/lib/Index/USRGeneration.cpp +++ b/clang/lib/Index/USRGeneration.cpp @@ -138,8 +138,8 @@ public: } /// 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. @@ -411,7 +411,7 @@ void USRGenerator::VisitObjCPropertyDecl(const ObjCPropertyDecl *D) { Visit(ID); else Visit(cast<Decl>(D->getDeclContext())); - GenObjCProperty(D->getName()); + GenObjCProperty(D->getName(), D->isClassProperty()); } void USRGenerator::VisitObjCPropertyImplDecl(const ObjCPropertyImplDecl *D) { @@ -864,8 +864,9 @@ void clang::index::generateUSRForObjCMethod(StringRef Sel, 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) { diff --git a/clang/test/Index/index-decls.m b/clang/test/Index/index-decls.m index 3564117523e..a39d9e3bfa6 100644 --- a/clang/test/Index/index-decls.m +++ b/clang/test/Index/index-decls.m @@ -52,6 +52,7 @@ int test1() { @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 @@ -82,3 +83,4 @@ int test1() { // 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 diff --git a/clang/tools/libclang/CIndexUSRs.cpp b/clang/tools/libclang/CIndexUSRs.cpp index d7b65852844..69d60c9d44f 100644 --- a/clang/tools/libclang/CIndexUSRs.cpp +++ b/clang/tools/libclang/CIndexUSRs.cpp @@ -137,7 +137,7 @@ CXString clang_constructUSR_ObjCProperty(const char *property, 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()); } |