summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/IndexDecl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2017-01-11 21:01:07 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2017-01-11 21:01:07 +0000
commitde0f50886f4d122a1142c77fa5f36ad1533c96d7 (patch)
treef71e2bf9127a04d0d85c1cecf68e9d4e337b49cf /clang/lib/Index/IndexDecl.cpp
parent974e4c78999ad00af0505a9bf50b7432b219f717 (diff)
downloadbcm5719-llvm-de0f50886f4d122a1142c77fa5f36ad1533c96d7.tar.gz
bcm5719-llvm-de0f50886f4d122a1142c77fa5f36ad1533c96d7.zip
[index] Add 'IBTypeOf' relation for ObjC methods marked with IBAction and properties with IBOutletCollection.
llvm-svn: 291703
Diffstat (limited to 'clang/lib/Index/IndexDecl.cpp')
-rw-r--r--clang/lib/Index/IndexDecl.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp
index 1225391dc2a..6c5b2e520ef 100644
--- a/clang/lib/Index/IndexDecl.cpp
+++ b/clang/lib/Index/IndexDecl.cpp
@@ -46,10 +46,13 @@ public:
}
void handleDeclarator(const DeclaratorDecl *D,
- const NamedDecl *Parent = nullptr) {
+ const NamedDecl *Parent = nullptr,
+ bool isIBType = false) {
if (!Parent) Parent = D;
- IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), Parent);
+ IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), Parent,
+ Parent->getLexicalDeclContext(),
+ /*isBase=*/false, isIBType);
IndexCtx.indexNestedNameSpecifierLoc(D->getQualifierLoc(), Parent);
if (IndexCtx.shouldIndexFunctionLocalSymbols()) {
// Only index parameters in definitions, parameters in declarations are
@@ -92,8 +95,11 @@ public:
if (!IndexCtx.handleDecl(D, (unsigned)SymbolRole::Dynamic, Relations))
return false;
IndexCtx.indexTypeSourceInfo(D->getReturnTypeSourceInfo(), D);
- for (const auto *I : D->parameters())
- handleDeclarator(I, D);
+ bool hasIBActionAndFirst = D->hasAttr<IBActionAttr>();
+ for (const auto *I : D->parameters()) {
+ handleDeclarator(I, D, /*isIBType=*/hasIBActionAndFirst);
+ hasIBActionAndFirst = false;
+ }
if (D->isThisDeclarationADefinition()) {
const Stmt *Body = D->getBody();
@@ -333,6 +339,9 @@ public:
handleObjCMethod(MD, D);
if (!IndexCtx.handleDecl(D))
return false;
+ if (IBOutletCollectionAttr *attr = D->getAttr<IBOutletCollectionAttr>())
+ IndexCtx.indexTypeSourceInfo(attr->getInterfaceLoc(), D,
+ D->getLexicalDeclContext(), false, true);
IndexCtx.indexTypeSourceInfo(D->getTypeSourceInfo(), D);
return true;
}
OpenPOWER on IntegriCloud