summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2018-08-17 23:50:59 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2018-08-17 23:50:59 +0000
commitc0cd01764feffe4e481f1b5c02722783fe219434 (patch)
tree89d021f834cb084598a6bb4ac1284213f8fb48d4 /clang/lib
parent96bc076c3a9ab660f830f13a63aee8816a023cc0 (diff)
downloadbcm5719-llvm-c0cd01764feffe4e481f1b5c02722783fe219434.tar.gz
bcm5719-llvm-c0cd01764feffe4e481f1b5c02722783fe219434.zip
[index] For an ObjC message call, also record as receivers the protocols if they are present in the ObjC type
llvm-svn: 340109
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Index/IndexBody.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/clang/lib/Index/IndexBody.cpp b/clang/lib/Index/IndexBody.cpp
index d79f0c39671..dd8a1c7b3f7 100644
--- a/clang/lib/Index/IndexBody.cpp
+++ b/clang/lib/Index/IndexBody.cpp
@@ -259,8 +259,24 @@ public:
if (isDynamic(E)) {
Roles |= (unsigned)SymbolRole::Dynamic;
- if (auto *RecD = E->getReceiverInterface())
- Relations.emplace_back((unsigned)SymbolRole::RelationReceivedBy, RecD);
+
+ auto addReceivers = [&](const ObjCObjectType *Ty) {
+ if (!Ty)
+ return;
+ if (const auto *clsD = Ty->getInterface()) {
+ Relations.emplace_back((unsigned)SymbolRole::RelationReceivedBy,
+ clsD);
+ }
+ for (const auto *protD : Ty->quals()) {
+ Relations.emplace_back((unsigned)SymbolRole::RelationReceivedBy,
+ protD);
+ }
+ };
+ QualType recT = E->getReceiverType();
+ if (const auto *Ptr = recT->getAs<ObjCObjectPointerType>())
+ addReceivers(Ptr->getObjectType());
+ else
+ addReceivers(recT->getAs<ObjCObjectType>());
}
return IndexCtx.handleReference(MD, E->getSelectorStartLoc(),
OpenPOWER on IntegriCloud