summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/IndexDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-28 17:50:28 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-28 17:50:28 +0000
commitceeb19cf189ecbea878df707d28d1780862ef2e5 (patch)
treeeefe0c47302ec6e5a7d72df90ece4271e5aab243 /clang/tools/libclang/IndexDecl.cpp
parent0c52c0f0fd0862e7f37348b3014328f95eb75237 (diff)
downloadbcm5719-llvm-ceeb19cf189ecbea878df707d28d1780862ef2e5.tar.gz
bcm5719-llvm-ceeb19cf189ecbea878df707d28d1780862ef2e5.zip
[AST] Associate the getter/setter methods to a property of a objc class extension.
[libclang] Index the getter/setter methods of a property of a objc class extension. Fixes rdar://10907597 llvm-svn: 151633
Diffstat (limited to 'clang/tools/libclang/IndexDecl.cpp')
-rw-r--r--clang/tools/libclang/IndexDecl.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/clang/tools/libclang/IndexDecl.cpp b/clang/tools/libclang/IndexDecl.cpp
index dcc9a1dca3d..2bd71295e6c 100644
--- a/clang/tools/libclang/IndexDecl.cpp
+++ b/clang/tools/libclang/IndexDecl.cpp
@@ -41,6 +41,24 @@ public:
}
}
+ void handleObjCMethod(ObjCMethodDecl *D) {
+ IndexCtx.handleObjCMethod(D);
+ if (D->isImplicit())
+ return;
+
+ IndexCtx.indexTypeSourceInfo(D->getResultTypeSourceInfo(), D);
+ for (ObjCMethodDecl::param_iterator
+ I = D->param_begin(), E = D->param_end(); I != E; ++I)
+ handleDeclarator(*I, D);
+
+ if (D->isThisDeclarationADefinition()) {
+ const Stmt *Body = D->getBody();
+ if (Body) {
+ IndexCtx.indexBody(Body, D, D);
+ }
+ }
+ }
+
bool VisitFunctionDecl(FunctionDecl *D) {
IndexCtx.handleFunction(D);
handleDeclarator(D);
@@ -161,22 +179,22 @@ public:
}
bool VisitObjCMethodDecl(ObjCMethodDecl *D) {
- IndexCtx.handleObjCMethod(D);
- IndexCtx.indexTypeSourceInfo(D->getResultTypeSourceInfo(), D);
- for (ObjCMethodDecl::param_iterator
- I = D->param_begin(), E = D->param_end(); I != E; ++I)
- handleDeclarator(*I, D);
+ // Methods associated with a property, even user-declared ones, are
+ // handled when we handle the property.
+ if (D->isSynthesized())
+ return true;
- if (D->isThisDeclarationADefinition()) {
- const Stmt *Body = D->getBody();
- if (Body) {
- IndexCtx.indexBody(Body, D, D);
- }
- }
+ handleObjCMethod(D);
return true;
}
bool VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
+ if (ObjCMethodDecl *MD = D->getGetterMethodDecl())
+ if (MD->getLexicalDeclContext() == D->getLexicalDeclContext())
+ handleObjCMethod(MD);
+ if (ObjCMethodDecl *MD = D->getSetterMethodDecl())
+ if (MD->getLexicalDeclContext() == D->getLexicalDeclContext())
+ handleObjCMethod(MD);
IndexCtx.handleObjCProperty(D);
IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), D);
return true;
OpenPOWER on IntegriCloud