From 63b15c3af73ee30a0fc98adaecd9494d76da2ad7 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 15 Jan 2010 18:24:18 +0000 Subject: [PATCH] getLocationFromCursor: If a cursor is a reference and has a referringDecl, using the referringDecl for the location. llvm-svn: 93520 --- clang/tools/CIndex/CIndex.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp index 86e0ddc20205..f24a74259367 100644 --- a/clang/tools/CIndex/CIndex.cpp +++ b/clang/tools/CIndex/CIndex.cpp @@ -409,6 +409,10 @@ static SourceLocation getLocationFromCursor(CXCursor C, SourceManager &SourceMgr, NamedDecl *ND) { if (clang_isReference(C.kind)) { + + if (Decl *D = static_cast(C.referringDecl)) + return D->getLocation(); + switch (C.kind) { case CXCursor_ObjCClassRef: { if (isa(ND)) {