[libclang] When indexing an objc property, also provide information about
the getter/setter objc method entities that the property is associated with.
rdar://10244558
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151634 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp
index 2963f3b..6797cc2 100644
--- a/tools/libclang/IndexingContext.cpp
+++ b/tools/libclang/IndexingContext.cpp
@@ -517,8 +517,26 @@
}
bool IndexingContext::handleObjCProperty(const ObjCPropertyDecl *D) {
- DeclInfo DInfo(/*isRedeclaration=*/false, /*isDefinition=*/false,
- /*isContainer=*/false);
+ ObjCPropertyDeclInfo DInfo;
+ EntityInfo GetterEntity;
+ EntityInfo SetterEntity;
+ ScratchAlloc SA(*this);
+
+ DInfo.ObjCPropDeclInfo.declInfo = &DInfo;
+
+ if (ObjCMethodDecl *Getter = D->getGetterMethodDecl()) {
+ getEntityInfo(Getter, GetterEntity, SA);
+ DInfo.ObjCPropDeclInfo.getter = &GetterEntity;
+ } else {
+ DInfo.ObjCPropDeclInfo.getter = 0;
+ }
+ if (ObjCMethodDecl *Setter = D->getSetterMethodDecl()) {
+ getEntityInfo(Setter, SetterEntity, SA);
+ DInfo.ObjCPropDeclInfo.setter = &SetterEntity;
+ } else {
+ DInfo.ObjCPropDeclInfo.setter = 0;
+ }
+
return handleDecl(D, D->getLocation(), getCursor(D), DInfo);
}