Skip to content

Commit b26c7ba

Browse files
author
git apple-llvm automerger
committed
Merge commit 'd00f73eb6aad' from swift/release/6.2 into stable/20240723
2 parents bdf0f59 + d00f73e commit b26c7ba

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

clang/lib/Frontend/HeaderIncludeGen.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,11 @@ void HeaderIncludesCallback::FileSkipped(const FileEntryRef &SkippedFile, const
260260

261261
void HeaderIncludesJSONCallback::EndOfMainFile() {
262262
OptionalFileEntryRef FE = SM.getFileEntryRefForID(SM.getMainFileID());
263-
SmallString<256> MainFile(FE->getName());
264-
SM.getFileManager().makeAbsolutePath(MainFile);
263+
SmallString<256> MainFile;
264+
if (FE) {
265+
MainFile += FE->getName();
266+
SM.getFileManager().makeAbsolutePath(MainFile);
267+
}
265268

266269
std::string Str;
267270
llvm::raw_string_ostream OS(Str);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// RUN: %clang_cc1 -header-include-format=json -header-include-filtering=only-direct-system -header-include-file %t.txt -emit-module -x c -fmodules -fmodule-name=X %s -o /dev/null
2+
module X {}

0 commit comments

Comments
 (0)