summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-01-15 18:24:18 +0000
committerTed Kremenek <kremenek@apple.com>2010-01-15 18:24:18 +0000
commit63b15c3af73ee30a0fc98adaecd9494d76da2ad7 (patch)
tree9aa33aa9bb63c87dc8db99d9eb2a6a0cb852c05d
parent5c26eeefdd5748cae1ebe6df5cfcca7a007d909b (diff)
downloadbcm5719-llvm-63b15c3af73ee30a0fc98adaecd9494d76da2ad7.tar.gz
bcm5719-llvm-63b15c3af73ee30a0fc98adaecd9494d76da2ad7.zip
getLocationFromCursor: If a cursor is a reference and has a referringDecl, using the referringDecl for the location.
llvm-svn: 93520
-rw-r--r--clang/tools/CIndex/CIndex.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp
index 86e0ddc2020..f24a7425936 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<Decl*>(C.referringDecl))
+ return D->getLocation();
+
switch (C.kind) {
case CXCursor_ObjCClassRef: {
if (isa<ObjCInterfaceDecl>(ND)) {
OpenPOWER on IntegriCloud