summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
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