[cfe-commits] r99179 - /cfe/trunk/tools/CIndex/CIndex.cpp

Douglas Gregor dgregor at apple.com
Mon Mar 22 08:53:50 PDT 2010


Author: dgregor
Date: Mon Mar 22 10:53:50 2010
New Revision: 99179

URL: http://llvm.org/viewvc/llvm-project?rev=99179&view=rev
Log:
Use the cursor's ASTContext rather than the ASTContext computed from a
declaration, just in case invalid code makes the latter
incorrect. This may be the cause behind <rdar://problem/7777070>.

Modified:
    cfe/trunk/tools/CIndex/CIndex.cpp

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=99179&r1=99178&r2=99179&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Mon Mar 22 10:53:50 2010
@@ -1737,7 +1737,7 @@
   SourceLocation Loc = D->getLocation();
   if (ObjCInterfaceDecl *Class = dyn_cast<ObjCInterfaceDecl>(D))
     Loc = Class->getClassLoc();
-  return cxloc::translateSourceLocation(D->getASTContext(), Loc);
+  return cxloc::translateSourceLocation(getCursorContext(C), Loc);
 }
 
 CXSourceRange clang_getCursorExtent(CXCursor C) {
@@ -1800,7 +1800,7 @@
     return clang_getNullRange();
 
   Decl *D = getCursorDecl(C);
-  return cxloc::translateSourceRange(D->getASTContext(), D->getSourceRange());
+  return cxloc::translateSourceRange(getCursorContext(C), D->getSourceRange());
 }
 
 CXCursor clang_getCursorReferenced(CXCursor C) {





More information about the cfe-commits mailing list