aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/HeaderIncludeGen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/HeaderIncludeGen.cpp')
-rw-r--r--clang/lib/Frontend/HeaderIncludeGen.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Frontend/HeaderIncludeGen.cpp b/clang/lib/Frontend/HeaderIncludeGen.cpp
index 30fe5c7..2ab4809 100644
--- a/clang/lib/Frontend/HeaderIncludeGen.cpp
+++ b/clang/lib/Frontend/HeaderIncludeGen.cpp
@@ -291,7 +291,8 @@ static bool shouldRecordNewFile(SrcMgr::CharacteristicKind NewFileType,
void HeaderIncludesJSONCallback::FileChanged(
SourceLocation Loc, FileChangeReason Reason,
SrcMgr::CharacteristicKind NewFileType, FileID PrevFID) {
- if (!shouldRecordNewFile(NewFileType, SM.getLocForStartOfFile(PrevFID), SM))
+ if (PrevFID.isInvalid() ||
+ !shouldRecordNewFile(NewFileType, SM.getLocForStartOfFile(PrevFID), SM))
return;
// Unless we are exiting a #include, make sure to skip ahead to the line the