]> granicus.if.org Git - clang/commitdiff
getLocationFromCursor: If a cursor is a reference and has a referringDecl, using...
authorTed Kremenek <kremenek@apple.com>
Fri, 15 Jan 2010 18:24:18 +0000 (18:24 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 15 Jan 2010 18:24:18 +0000 (18:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93520 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CIndex/CIndex.cpp

index 86e0ddc20205510f9498cf960f12bddc2c95c189..f24a74259367e41fedaefcbcb8a770ddd82d785e 100644 (file)
@@ -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)) {