summaryrefslogtreecommitdiffstats
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
commitd0a27f717e70ad95886d094af8d505b8d657ef48 (patch)
treee0612d5bbf14e126e76c204e931cf452786d23a8
parente2a7776effde7407a294e267f4f71e9a477625b2 (diff)
downloadbcm5719-llvm-d0a27f717e70ad95886d094af8d505b8d657ef48.tar.gz
bcm5719-llvm-d0a27f717e70ad95886d094af8d505b8d657ef48.zip
[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 llvm-svn: 148848
-rw-r--r--clang/tools/libclang/CIndex.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index db84ccdce6c..fe4e373e8ac 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/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");
- }
}
}
OpenPOWER on IntegriCloud