]> granicus.if.org Git - clang/commitdiff
Audit all callers of SourceManager::getBufferData(); fix the one that
authorDouglas Gregor <dgregor@apple.com>
Tue, 16 Mar 2010 20:26:15 +0000 (20:26 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 16 Mar 2010 20:26:15 +0000 (20:26 +0000)
needs better error recovery.

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

tools/CIndex/CIndex.cpp

index 663b32fa1a06eaed2a219e1b1eb9f1e1930f4e9d..db27ffe68a46c162c0741ba6d87b09d251eddf99 100644 (file)
@@ -2101,6 +2101,8 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
   bool Invalid = false;
   llvm::StringRef Buffer
     = SourceMgr.getBufferData(BeginLocInfo.first, &Invalid);
+  if (Invalid)
+    return;
   
   Lexer Lex(SourceMgr.getLocForStartOfFile(BeginLocInfo.first),
             CXXUnit->getASTContext().getLangOptions(),