TRY_TO(handleReferencedProtocols(D->getReferencedProtocols(), D));
TRY_TO(IndexCtx.indexDeclContext(D));
} else {
- return IndexCtx.handleReference(D, D->getLocation(), nullptr, nullptr,
- SymbolRoleSet());
+ return IndexCtx.handleReference(D, D->getLocation(), nullptr,
+ D->getDeclContext(), SymbolRoleSet());
}
return true;
}
TRY_TO(handleReferencedProtocols(D->getReferencedProtocols(), D));
TRY_TO(IndexCtx.indexDeclContext(D));
} else {
- return IndexCtx.handleReference(D, D->getLocation(), nullptr, nullptr,
- SymbolRoleSet());
+ return IndexCtx.handleReference(D, D->getLocation(), nullptr,
+ D->getDeclContext(), SymbolRoleSet());
}
return true;
}
[I clsMeth];
}
+@protocol ForwardProt;
+
// RUN: c-index-test -index-file %s | FileCheck %s
// CHECK: [indexEntityReference]: kind: objc-protocol | name: Prot | {{.*}} | loc: 12:27
// CHECK: [indexEntityReference]: kind: struct | name: FooS | {{.*}} | loc: 13:18
// CHECK: [indexEntityReference]: kind: objc-class | name: I | {{.*}} | loc: 21:4
+
+// CHECK: [indexDeclaration]: kind: objc-protocol | name: ForwardProt | {{.*}} | loc: 24:11
+// CHECK-NEXT: <ObjCContainerInfo>: kind: forward-ref
return true;
}
}
+ if (auto *ObjCPD = dyn_cast_or_null<ObjCProtocolDecl>(ASTNode.OrigD)) {
+ if (!ObjCPD->isThisDeclarationADefinition() &&
+ ObjCPD->getLocation() == Loc) {
+ // The libclang API treats this as ObjCProtocolRef declaration.
+ IndexingDeclVisitor(*this, Loc, nullptr).Visit(ObjCPD);
+ return true;
+ }
+ }
CXIdxEntityRefKind Kind = CXIdxEntityRef_Direct;
if (Roles & (unsigned)SymbolRole::Implicit) {