Teach SourceManager::getSLocEntry() that it can fail due to problems
during deserialization from a precompiled header, and update all of
its callers to note when this problem occurs and recover (more)
gracefully. Fixes <rdar://problem/9119249>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129839 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndexInclusionStack.cpp b/tools/libclang/CIndexInclusionStack.cpp
index 9ea9019..6bc4f2e 100644
--- a/tools/libclang/CIndexInclusionStack.cpp
+++ b/tools/libclang/CIndexInclusionStack.cpp
@@ -40,10 +40,10 @@
i = 0;
for ( ; i < n ; ++i) {
-
- const SrcMgr::SLocEntry &SL = SM.getSLocEntry(i);
+ bool Invalid = false;
+ const SrcMgr::SLocEntry &SL = SM.getSLocEntry(i, &Invalid);
- if (!SL.isFile())
+ if (!SL.isFile() || Invalid)
continue;
const SrcMgr::FileInfo &FI = SL.getFile();