summaryrefslogtreecommitdiffstats
path: root/tools/libclang/IndexDecl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang/IndexDecl.cpp')
-rw-r--r--tools/libclang/IndexDecl.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp
index 756001c..89feb96 100644
--- a/tools/libclang/IndexDecl.cpp
+++ b/tools/libclang/IndexDecl.cpp
@@ -22,6 +22,15 @@ public:
explicit IndexingDeclVisitor(IndexingContext &indexCtx)
: IndexCtx(indexCtx) { }
+ /// \brief Returns true if the given method has been defined explicitly by the
+ /// user.
+ static bool hasUserDefined(const ObjCMethodDecl *D,
+ const ObjCImplDecl *Container) {
+ const ObjCMethodDecl *MD = Container->getMethod(D->getSelector(),
+ D->isInstanceMethod());
+ return MD && !MD->isImplicit() && MD->isThisDeclarationADefinition();
+ }
+
void handleDeclarator(const DeclaratorDecl *D, const NamedDecl *Parent = 0) {
if (!Parent) Parent = D;
@@ -234,12 +243,14 @@ public:
}
if (ObjCMethodDecl *MD = PD->getGetterMethodDecl()) {
- if (MD->isPropertyAccessor())
+ if (MD->isPropertyAccessor() &&
+ !hasUserDefined(MD, cast<ObjCImplDecl>(D->getDeclContext())))
IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation(),
D->getLexicalDeclContext());
}
if (ObjCMethodDecl *MD = PD->getSetterMethodDecl()) {
- if (MD->isPropertyAccessor())
+ if (MD->isPropertyAccessor() &&
+ !hasUserDefined(MD, cast<ObjCImplDecl>(D->getDeclContext())))
IndexCtx.handleSynthesizedObjCMethod(MD, D->getLocation(),
D->getLexicalDeclContext());
}
OpenPOWER on IntegriCloud