]> granicus.if.org Git - clang/commitdiff
Switch return site to use clang_getNullCursor().
authorTed Kremenek <kremenek@apple.com>
Thu, 14 Jan 2010 01:51:23 +0000 (01:51 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 14 Jan 2010 01:51:23 +0000 (01:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93405 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CIndex/CIndex.cpp

index 321f871ae9f8560e862c31f7f9ccf78bd4bb2b47..86e0ddc20205510f9498cf960f12bddc2c95c189 100644 (file)
@@ -971,17 +971,17 @@ CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name,
   FileManager &FMgr = CXXUnit->getFileManager();
   const FileEntry *File = FMgr.getFile(source_name,
                                        source_name+strlen(source_name));
-  if (!File) {
-    CXCursor C = { CXCursor_InvalidFile, 0, 0, 0 };
-    return C;
-  }
+  if (!File)
+    return clang_getNullCursor();
+
   SourceLocation SLoc =
     CXXUnit->getSourceManager().getLocation(File, line, column);
 
   ASTLocation LastLoc = CXXUnit->getLastASTLocation();
-
   ASTLocation ALoc = ResolveLocationInAST(CXXUnit->getASTContext(), SLoc,
                                           &LastLoc);
+  
+  // FIXME: This doesn't look thread-safe.
   if (ALoc.isValid())
     CXXUnit->setLastASTLocation(ALoc);