diff options
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 4 | ||||
-rw-r--r-- | clang/tools/libclang/IndexDecl.cpp | 2 | ||||
-rw-r--r-- | clang/tools/libclang/IndexingContext.cpp | 11 |
3 files changed, 11 insertions, 6 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 33feadfdf1b..f2e6b01329a 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -4126,8 +4126,8 @@ CXCursor clang_getCursorDefinition(CXCursor C) { return clang_getNullCursor(); case Decl::ObjCProtocol: - if (!cast<ObjCProtocolDecl>(D)->isForwardDecl()) - return C; + if (ObjCProtocolDecl *Def = cast<ObjCProtocolDecl>(D)->getDefinition()) + return MakeCXCursor(Def, TU); return clang_getNullCursor(); case Decl::ObjCInterface: { diff --git a/clang/tools/libclang/IndexDecl.cpp b/clang/tools/libclang/IndexDecl.cpp index 38868138cf2..ee37bba9426 100644 --- a/clang/tools/libclang/IndexDecl.cpp +++ b/clang/tools/libclang/IndexDecl.cpp @@ -102,7 +102,7 @@ public: bool VisitObjCProtocolDecl(ObjCProtocolDecl *D) { // Forward decls are handled at VisitObjCForwardProtocolDecl. - if (D->isForwardDecl()) + if (!D->isThisDeclarationADefinition()) return true; IndexCtx.handleObjCProtocol(D); diff --git a/clang/tools/libclang/IndexingContext.cpp b/clang/tools/libclang/IndexingContext.cpp index 49dfa05cf1c..28efe3fd569 100644 --- a/clang/tools/libclang/IndexingContext.cpp +++ b/clang/tools/libclang/IndexingContext.cpp @@ -368,8 +368,9 @@ bool IndexingContext::handleObjCInterface(const ObjCInterfaceDecl *D) { } ObjCProtocolList EmptyProtoList; - ObjCProtocolListInfo ProtInfo(D->hasDefinition() ? D->getReferencedProtocols() - : EmptyProtoList, + ObjCProtocolListInfo ProtInfo(D->isThisDeclarationADefinition() + ? D->getReferencedProtocols() + : EmptyProtoList, *this, SA); ObjCInterfaceDeclInfo InterInfo(D); @@ -401,7 +402,11 @@ bool IndexingContext::handleObjCForwardProtocol(const ObjCProtocolDecl *D, bool IndexingContext::handleObjCProtocol(const ObjCProtocolDecl *D) { ScratchAlloc SA(*this); - ObjCProtocolListInfo ProtListInfo(D->getReferencedProtocols(), *this, SA); + ObjCProtocolList EmptyProtoList; + ObjCProtocolListInfo ProtListInfo(D->isThisDeclarationADefinition() + ? D->getReferencedProtocols() + : EmptyProtoList, + *this, SA); ObjCProtocolDeclInfo ProtInfo(D); ProtInfo.ObjCProtoRefListInfo = ProtListInfo.getListInfo(); |