diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-01-01 19:29:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-01-01 19:29:29 +0000 |
commit | 5e2a1ff9f28d2eab256d2553e76a9c9d54693875 (patch) | |
tree | 9b6a413be6f25d57bd1e0737cb63227d337493e5 /tools | |
parent | 27b7ce6199bfd008ba8d10c8bd91d926e2274df3 (diff) |
Move the data that corresponds to the definition of a protocol into a
separately-allocated DefinitionData structure. Introduce various
functions that will help with the separation of declarations from
definitions (isThisDeclarationADefinition(), hasDefinition(),
getDefinition()).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CIndex.cpp | 4 | ||||
-rw-r--r-- | tools/libclang/IndexDecl.cpp | 2 | ||||
-rw-r--r-- | tools/libclang/IndexingContext.cpp | 11 |
3 files changed, 11 insertions, 6 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 33feadfdf1..f2e6b01329 100644 --- a/tools/libclang/CIndex.cpp +++ b/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/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp index 38868138cf..ee37bba942 100644 --- a/tools/libclang/IndexDecl.cpp +++ b/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/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 49dfa05cf1..28efe3fd56 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/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(); |