[cfe-commits] r148848 - /cfe/trunk/tools/libclang/CIndex.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Jan 24 11:40:15 PST 2012
Author: akirtzidis
Date: Tue Jan 24 13:40:15 2012
New Revision: 148848
URL: http://llvm.org/viewvc/llvm-project?rev=148848&view=rev
Log:
[libclang] When calling clang_getCursorReferenced on a class or protocol
forward reference, do give an interface or protocol cursor back, don't give
an 'UnexposedDecl' one.
rdar://10743193
Modified:
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=148848&r1=148847&r2=148848&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Tue Jan 24 13:40:15 2012
@@ -3918,14 +3918,23 @@
return MakeCXCursor(getCursorObjCSuperClassRef(C).first, tu);
case CXCursor_ObjCProtocolRef: {
- return MakeCXCursor(getCursorObjCProtocolRef(C).first, tu);
+ ObjCProtocolDecl *Prot = getCursorObjCProtocolRef(C).first;
+ if (ObjCProtocolDecl *Def = Prot->getDefinition())
+ return MakeCXCursor(Def, tu);
+
+ CXCursor C = MakeCXCursor(Prot, tu);
+ C.kind = CXCursor_ObjCProtocolDecl; // override "Unexposed".
+ return C;
+ }
case CXCursor_ObjCClassRef: {
ObjCInterfaceDecl *Class = getCursorObjCClassRef(C).first;
if (ObjCInterfaceDecl *Def = Class->getDefinition())
return MakeCXCursor(Def, tu);
- return MakeCXCursor(Class, tu);
+ CXCursor C = MakeCXCursor(Class, tu);
+ C.kind = CXCursor_ObjCInterfaceDecl; // override "Unexposed".
+ return C;
}
case CXCursor_TypeRef:
@@ -3960,7 +3969,6 @@
default:
// We would prefer to enumerate all non-reference cursor kinds here.
llvm_unreachable("Unhandled reference cursor kind");
- }
}
}
More information about the cfe-commits
mailing list