diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-27 22:43:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-27 22:43:10 +0000 |
commit | 375bb1413c041055262c8a416f20d10474a5eda9 (patch) | |
tree | 66e5d219fe54a005bd13828eaab0234e08ca13fc /tools/libclang/IndexingContext.cpp | |
parent | fedb6ecbed93c6bf12a02d61b2421d6f0da3b4fc (diff) |
Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/IndexingContext.cpp')
-rw-r--r-- | tools/libclang/IndexingContext.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 11b2ed3c35..49dfa05cf1 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/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); |