summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-04 01:04:58 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-02-04 01:04:58 +0000
commitfcf8d1f82a6fe0b3ee03397116c523604188b7ea (patch)
treef1e8a506e764900c635d6097b6263b3dd007c52c
parentcc481596e4b8a4b1541d500cfe2e098c611a1c98 (diff)
downloadbcm5719-llvm-fcf8d1f82a6fe0b3ee03397116c523604188b7ea.tar.gz
bcm5719-llvm-fcf8d1f82a6fe0b3ee03397116c523604188b7ea.zip
[libclang] Stick to the silly notion that a forward class/protocol
declaration is a reference. rdar://10749990 llvm-svn: 149733
-rw-r--r--clang/tools/libclang/CIndex.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index a2c0fb0bdfb..675126de09d 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -560,6 +560,20 @@ bool CursorVisitor::VisitDeclContext(DeclContext *DC) {
if (D->getLexicalDeclContext() != DC)
continue;
CXCursor Cursor = MakeCXCursor(D, TU, RegionOfInterest);
+
+ // FIXME: ObjCClassRef/ObjCProtocolRef for forward class/protocol
+ // declarations is a mismatch with the compiler semantics.
+ if (Cursor.kind == CXCursor_ObjCInterfaceDecl) {
+ ObjCInterfaceDecl *ID = cast<ObjCInterfaceDecl>(D);
+ if (!ID->isThisDeclarationADefinition())
+ Cursor = MakeCursorObjCClassRef(ID, ID->getLocation(), TU);
+
+ } else if (Cursor.kind == CXCursor_ObjCProtocolDecl) {
+ ObjCProtocolDecl *PD = cast<ObjCProtocolDecl>(D);
+ if (!PD->isThisDeclarationADefinition())
+ Cursor = MakeCursorObjCProtocolRef(PD, PD->getLocation(), TU);
+ }
+
const llvm::Optional<bool> &V = shouldVisitCursor(Cursor);
if (!V.hasValue())
continue;
OpenPOWER on IntegriCloud