[clang] 46b9d57 - Return early if FileID is invalid. NFC
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 14 21:29:21 PST 2022
Author: Akira Hatanaka
Date: 2022-12-14T21:28:31-08:00
New Revision: 46b9d57976517f61d7478104cc95946d1bc03bf0
URL: https://github.com/llvm/llvm-project/commit/46b9d57976517f61d7478104cc95946d1bc03bf0
DIFF: https://github.com/llvm/llvm-project/commit/46b9d57976517f61d7478104cc95946d1bc03bf0.diff
LOG: Return early if FileID is invalid. NFC
Added:
Modified:
clang/lib/Frontend/HeaderIncludeGen.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/HeaderIncludeGen.cpp b/clang/lib/Frontend/HeaderIncludeGen.cpp
index 30fe5c75b9ac3..2ab4809402645 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
More information about the cfe-commits
mailing list