aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/HeaderIncludeGen.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@apple.com>2022-12-14 21:28:02 -0800
committerAkira Hatanaka <ahatanaka@apple.com>2022-12-14 21:28:31 -0800
commit46b9d57976517f61d7478104cc95946d1bc03bf0 (patch)
treee899f05d60c11fdce21e5909434a4eaad3f554dc /clang/lib/Frontend/HeaderIncludeGen.cpp
parent6eb0b0a0452a4c53ceb1156afd17764fbff51111 (diff)
downloadllvm-46b9d57976517f61d7478104cc95946d1bc03bf0.zip
llvm-46b9d57976517f61d7478104cc95946d1bc03bf0.tar.gz
llvm-46b9d57976517f61d7478104cc95946d1bc03bf0.tar.bz2
Return early if FileID is invalid. NFC
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