summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-04-20 00:21:03 +0000
committerDouglas Gregor <dgregor@apple.com>2011-04-20 00:21:03 +0000
commit49f754f423ada6aba2e19ea6a6e8f2659778512c (patch)
tree5815e6d0ae6b6d6e8bd4050102ba415692c82c17 /clang/tools/libclang/CIndex.cpp
parentcd01ed5bd6134c4dab5e7b7baccef326ca205712 (diff)
downloadbcm5719-llvm-49f754f423ada6aba2e19ea6a6e8f2659778512c.tar.gz
bcm5719-llvm-49f754f423ada6aba2e19ea6a6e8f2659778512c.zip
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>. llvm-svn: 129839
Diffstat (limited to 'clang/tools/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index dc74cd35ea7..90d9881ce10 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -2773,8 +2773,9 @@ void clang_getInstantiationLocation(CXSourceLocation location,
// Check that the FileID is invalid on the instantiation location.
// This can manifest in invalid code.
FileID fileID = SM.getFileID(InstLoc);
- const SrcMgr::SLocEntry &sloc = SM.getSLocEntry(fileID);
- if (!sloc.isFile()) {
+ bool Invalid = false;
+ const SrcMgr::SLocEntry &sloc = SM.getSLocEntry(fileID, &Invalid);
+ if (!sloc.isFile() || Invalid) {
createNullLocation(file, line, column, offset);
return;
}
OpenPOWER on IntegriCloud