[libclang] Indexing API:
-For indexDeclaration, also pass the declaration attributes as an array of cursors.
-Rename CXIndexOpt_OneRefPerFile -> CXIndexOpt_SuppressRedundantRefs, and only pass
a reference if a declaration/definition does not exist in the file.
-Other fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144942 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp
index b2a4530..20b2205 100644
--- a/tools/libclang/IndexDecl.cpp
+++ b/tools/libclang/IndexDecl.cpp
@@ -159,6 +159,32 @@
IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), D);
return true;
}
+
+ bool VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
+ ObjCPropertyDecl *PD = D->getPropertyDecl();
+ IndexCtx.handleSynthesizedObjCProperty(D);
+
+ if (D->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic)
+ return true;
+ assert(D->getPropertyImplementation() == ObjCPropertyImplDecl::Synthesize);
+
+ if (ObjCIvarDecl *IvarD = D->getPropertyIvarDecl()) {
+ if (!IvarD->getSynthesize())
+ IndexCtx.handleReference(IvarD, D->getPropertyIvarDeclLoc(), 0,
+ D->getDeclContext());
+ }
+
+ if (ObjCMethodDecl *MD = PD->getGetterMethodDecl()) {
+ if (MD->isSynthesized())
+ IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation());
+ }
+ if (ObjCMethodDecl *MD = PD->getSetterMethodDecl()) {
+ if (MD->isSynthesized())
+ IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation());
+ }
+
+ return true;
+ }
};
} // anonymous namespace