From deafd0b2a42b16568f416fbe218db82d56e2d89d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 27 Dec 2011 22:43:10 +0000 Subject: Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299 --- clang/tools/libclang/IndexingContext.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'clang/tools/libclang/IndexingContext.cpp') diff --git a/clang/tools/libclang/IndexingContext.cpp b/clang/tools/libclang/IndexingContext.cpp index 11b2ed3c352..49dfa05cf1c 100644 --- a/clang/tools/libclang/IndexingContext.cpp +++ b/clang/tools/libclang/IndexingContext.cpp @@ -335,24 +335,22 @@ bool IndexingContext::handleTypedefName(const TypedefNameDecl *D) { return handleDecl(D, D->getLocation(), getCursor(D), DInfo); } -bool IndexingContext::handleObjCClass(const ObjCClassDecl *D) { - ObjCInterfaceDecl *IFaceD = D->getForwardInterfaceDecl(); - SourceLocation Loc = D->getNameLoc(); - bool isRedeclaration = IFaceD->getLocation() != Loc; - +bool IndexingContext::handleObjCInterface(const ObjCInterfaceDecl *D) { // For @class forward declarations, suppress them the same way as references. - if (suppressRefs()) { - if (markEntityOccurrenceInFile(IFaceD, Loc)) + if (!D->isThisDeclarationADefinition()) { + if (suppressRefs() && markEntityOccurrenceInFile(D, D->getLocation())) return false; // already occurred. - } - ObjCContainerDeclInfo ContDInfo(/*isForwardRef=*/true, isRedeclaration, - /*isImplementation=*/false); - return handleObjCContainer(IFaceD, Loc, - MakeCursorObjCClassRef(IFaceD, Loc, CXTU), ContDInfo); -} + // 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(), + MakeCursorObjCClassRef(D, D->getLocation(), + CXTU), + ContDInfo); + } -bool IndexingContext::handleObjCInterface(const ObjCInterfaceDecl *D) { ScratchAlloc SA(*this); CXIdxBaseClassInfo BaseClass; @@ -370,8 +368,8 @@ bool IndexingContext::handleObjCInterface(const ObjCInterfaceDecl *D) { } ObjCProtocolList EmptyProtoList; - ObjCProtocolListInfo ProtInfo(D->hasDefinition()? D->getReferencedProtocols() - : EmptyProtoList, + ObjCProtocolListInfo ProtInfo(D->hasDefinition() ? D->getReferencedProtocols() + : EmptyProtoList, *this, SA); ObjCInterfaceDeclInfo InterInfo(D); -- cgit v1.2.3