]> granicus.if.org Git - clang/commitdiff
Use the cursor's ASTContext rather than the ASTContext computed from a
authorDouglas Gregor <dgregor@apple.com>
Mon, 22 Mar 2010 15:53:50 +0000 (15:53 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 22 Mar 2010 15:53:50 +0000 (15:53 +0000)
declaration, just in case invalid code makes the latter
incorrect. This may be the cause behind <rdar://problem/7777070>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99179 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CIndex/CIndex.cpp

index 1000818692a0dac2627a7da804bf84e6d90a09dc..5a64caa342d857ad16bba2eb9244edd9a59aef18 100644 (file)
@@ -1737,7 +1737,7 @@ CXSourceLocation clang_getCursorLocation(CXCursor C) {
   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 @@ CXSourceRange clang_getCursorExtent(CXCursor C) {
     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) {