[libclang] When pointing at an objc property don't return a cursor that points at the
synthesized method for the property. rdar://9771715
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137248 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 829649a..875cb47 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3471,6 +3471,13 @@
CXClientData client_data) {
GetCursorData *Data = static_cast<GetCursorData *>(client_data);
CXCursor *BestCursor = &Data->BestCursor;
+
+ if (clang_isDeclaration(cursor.kind)) {
+ // Avoid having the synthesized methods override the property decls.
+ if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(getCursorDecl(cursor)))
+ if (MD->isSynthesized())
+ return CXChildVisit_Break;
+ }
if (clang_isExpression(cursor.kind) &&
clang_isDeclaration(BestCursor->kind)) {