https://github.com/jansvoboda11 updated https://github.com/llvm/llvm-project/pull/217691
>From 2d7ca426059d5b969714ee8b9aefe5c454ea6ad5 Mon Sep 17 00:00:00 2001 From: Jan Svoboda <[email protected]> Date: Thu, 20 Aug 2026 18:44:22 +0200 Subject: [PATCH 1/2] [clang][lex] Fix repeated #import of header missing from umbrella --- .../repeated-include-missing-submodule.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 clang/test/Modules/repeated-include-missing-submodule.c diff --git a/clang/test/Modules/repeated-include-missing-submodule.c b/clang/test/Modules/repeated-include-missing-submodule.c new file mode 100644 index 0000000000000..44f04cec07b92 --- /dev/null +++ b/clang/test/Modules/repeated-include-missing-submodule.c @@ -0,0 +1,18 @@ +// Check that multiple include-once of a header not covered by an umbrella work. + +// RUN: rm -rf %t +// RUN: split-file %s %t + +// RUN: %clang_cc1 -fsyntax-only %t/tu.c -fmodules -fimplicit-module-maps \ +// RUN: -fmodules-cache-path=%t/cache -verify + +//--- module.modulemap +module M { + umbrella header "M.h" + module * { export * } +} +//--- M.h +//--- NotCovered.h +//--- tu.c +#import "NotCovered.h" // expected-warning{{missing submodule 'M.NotCovered'}} +#import "NotCovered.h" // expected-warning{{missing submodule 'M.NotCovered'}} >From c217fa9d7976b59233dee29115f428bfbd2f05fb Mon Sep 17 00:00:00 2001 From: Jan Svoboda <[email protected]> Date: Thu, 20 Aug 2026 19:07:04 +0200 Subject: [PATCH 2/2] The fix itself --- clang/lib/Lex/PPDirectives.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index 24e63b8bae711..8226c27742da3 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -2535,6 +2535,7 @@ Preprocessor::ImportAction Preprocessor::HandleHeaderIncludeOrImport( // actual module containing it exists (because the umbrella header is // incomplete). Treat this as a textual inclusion. ModuleToImport = nullptr; + UsableClangHeaderModule = false; } else if (Imported.isConfigMismatch()) { // On a configuration mismatch, enter the header textually. We still know // that it's part of the corresponding module. _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
