diff options
Diffstat (limited to 'tools/libclang')
-rw-r--r-- | tools/libclang/CIndex.cpp | 24 | ||||
-rw-r--r-- | tools/libclang/IndexDecl.cpp | 2 | ||||
-rw-r--r-- | tools/libclang/IndexingContext.h | 2 |
3 files changed, 14 insertions, 14 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index f74953fee6..a5b390a53a 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -299,12 +299,7 @@ void CursorVisitor::visitDeclsFromFileRegion(FileID File, // We handle forward decls via ObjCClassDecl. if (ObjCInterfaceDecl *InterD = dyn_cast<ObjCInterfaceDecl>(D)) { - if (InterD->isForwardDecl()) - continue; - // An interface that started as a forward decl may have changed location - // because its @interface was parsed. - if (InterD->isInitiallyForwardDecl() && - !SM.isInFileID(SM.getFileLoc(InterD->getLocation()), File)) + if (!InterD->isThisDeclarationADefinition()) continue; } @@ -3948,8 +3943,13 @@ CXCursor clang_getCursorReferenced(CXCursor C) { case CXCursor_ObjCProtocolRef: { return MakeCXCursor(getCursorObjCProtocolRef(C).first, tu); - case CXCursor_ObjCClassRef: - return MakeCXCursor(getCursorObjCClassRef(C).first, tu ); + case CXCursor_ObjCClassRef: { + ObjCInterfaceDecl *Class = getCursorObjCClassRef(C).first; + if (ObjCInterfaceDecl *Def = Class->getDefinition()) + return MakeCXCursor(Def, tu); + + return MakeCXCursor(Class, tu); + } case CXCursor_TypeRef: return MakeCXCursor(getCursorTypeRef(C).first, tu ); @@ -4147,8 +4147,8 @@ CXCursor clang_getCursorDefinition(CXCursor C) { // the definition; when we were provided with the interface, // produce the @implementation as the definition. if (WasReference) { - if (!cast<ObjCInterfaceDecl>(D)->isForwardDecl()) - return C; + if (ObjCInterfaceDecl *Def = cast<ObjCInterfaceDecl>(D)->getDefinition()) + return MakeCXCursor(Def, TU); } else if (ObjCImplementationDecl *Impl = cast<ObjCInterfaceDecl>(D)->getImplementation()) return MakeCXCursor(Impl, TU); @@ -4162,8 +4162,8 @@ CXCursor clang_getCursorDefinition(CXCursor C) { case Decl::ObjCCompatibleAlias: if (ObjCInterfaceDecl *Class = cast<ObjCCompatibleAliasDecl>(D)->getClassInterface()) - if (!Class->isForwardDecl()) - return MakeCXCursor(Class, TU); + if (ObjCInterfaceDecl *Def = Class->getDefinition()) + return MakeCXCursor(Def, TU); return clang_getNullCursor(); diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp index 0d6dacb775..96a21d8486 100644 --- a/tools/libclang/IndexDecl.cpp +++ b/tools/libclang/IndexDecl.cpp @@ -97,7 +97,7 @@ public: bool VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) { // Forward decls are handled at VisitObjCClassDecl. - if (D->isForwardDecl()) + if (!D->isThisDeclarationADefinition()) return true; IndexCtx.handleObjCInterface(D); diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h index f5498e5292..206e322337 100644 --- a/tools/libclang/IndexingContext.h +++ b/tools/libclang/IndexingContext.h @@ -128,7 +128,7 @@ struct ObjCInterfaceDeclInfo : public ObjCContainerDeclInfo { ObjCInterfaceDeclInfo(const ObjCInterfaceDecl *D) : ObjCContainerDeclInfo(Info_ObjCInterface, /*isForwardRef=*/false, - /*isRedeclaration=*/D->isInitiallyForwardDecl(), + /*isRedeclaration=*/D->getPreviousDeclaration() != 0, /*isImplementation=*/false) { } static bool classof(const DeclInfo *D) { |