aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-24 19:40:15 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-01-24 19:40:15 +0000
commit98c16b8b4fe7bb26b17a479d6872e390816e57d4 (patch)
tree30a1a55fa3c2a6f55596c3f446b04bac411e9fde
parent466f45a06b654d85e9504e37ccf7255ffe4f0e2b (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148848 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/libclang/CIndex.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index db84ccdce6..fe4e373e8a 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3918,14 +3918,23 @@ CXCursor clang_getCursorReferenced(CXCursor C) {
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 @@ CXCursor clang_getCursorReferenced(CXCursor C) {
default:
// We would prefer to enumerate all non-reference cursor kinds here.
llvm_unreachable("Unhandled reference cursor kind");
- }
}
}