summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/IndexingContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-27 22:43:10 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-27 22:43:10 +0000
commitdeafd0b2a42b16568f416fbe218db82d56e2d89d (patch)
tree95d9f29e2f42e149a9aa1275d62d2b829da42c7f /clang/tools/libclang/IndexingContext.cpp
parent45146a12cf0f3c0ebacc83ef936650c69e3303c8 (diff)
downloadbcm5719-llvm-deafd0b2a42b16568f416fbe218db82d56e2d89d.tar.gz
bcm5719-llvm-deafd0b2a42b16568f416fbe218db82d56e2d89d.zip
Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an Objective-C class. llvm-svn: 147299
Diffstat (limited to 'clang/tools/libclang/IndexingContext.cpp')
-rw-r--r--clang/tools/libclang/IndexingContext.cpp30
1 files changed, 14 insertions, 16 deletions
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);
OpenPOWER on IntegriCloud