getLocationFromCursor: If a cursor is a reference and has a referringDecl, using the referringDecl for the location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93520 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 86e0ddc..f24a742 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -409,6 +409,10 @@
SourceManager &SourceMgr,
NamedDecl *ND) {
if (clang_isReference(C.kind)) {
+
+ if (Decl *D = static_cast<Decl*>(C.referringDecl))
+ return D->getLocation();
+
switch (C.kind) {
case CXCursor_ObjCClassRef: {
if (isa<ObjCInterfaceDecl>(ND)) {