aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/IndexingContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/libclang/IndexingContext.cpp')
-rw-r--r--tools/libclang/IndexingContext.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp
index 28efe3fd56..14dbc97002 100644
--- a/tools/libclang/IndexingContext.cpp
+++ b/tools/libclang/IndexingContext.cpp
@@ -390,17 +390,22 @@ bool IndexingContext::handleObjCImplementation(
return handleObjCContainer(D, D->getLocation(), getCursor(D), ContDInfo);
}
-bool IndexingContext::handleObjCForwardProtocol(const ObjCProtocolDecl *D,
- SourceLocation Loc,
- bool isRedeclaration) {
- ObjCContainerDeclInfo ContDInfo(/*isForwardRef=*/true,
- isRedeclaration,
- /*isImplementation=*/false);
- return handleObjCContainer(D, Loc, MakeCursorObjCProtocolRef(D, Loc, CXTU),
- ContDInfo);
-}
-
bool IndexingContext::handleObjCProtocol(const ObjCProtocolDecl *D) {
+ if (!D->isThisDeclarationADefinition()) {
+ if (suppressRefs() && markEntityOccurrenceInFile(D, D->getLocation()))
+ return false; // already occurred.
+
+ // FIXME: This seems like the wrong definition for redeclaration.
+ bool isRedeclaration = D->hasDefinition() || D->getPreviousDeclaration();
+ ObjCContainerDeclInfo ContDInfo(/*isForwardRef=*/true,
+ isRedeclaration,
+ /*isImplementation=*/false);
+ return handleObjCContainer(D, D->getLocation(),
+ MakeCursorObjCProtocolRef(D, D->getLocation(),
+ CXTU),
+ ContDInfo);
+ }
+
ScratchAlloc SA(*this);
ObjCProtocolList EmptyProtoList;
ObjCProtocolListInfo ProtListInfo(D->isThisDeclarationADefinition()