[clang] [clang][lex] Fix repeated #import of header missing from umbrella (PR #217691)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 20 09:46:52 PDT 2026
https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/217691
The PR https://github.com/swiftlang/llvm-project/pull/13914 fixed repeated #import of a header that belongs to a module in textual builds. One omission was not setting the boolean we now use to make the decision to import or skip when we tried importing a submodule but figured out it's not covered by the umbrella. This PR fixes that.
>From 2d7ca426059d5b969714ee8b9aefe5c454ea6ad5 Mon Sep 17 00:00:00 2001
From: Jan Svoboda <jan_svoboda at apple.com>
Date: Thu, 20 Aug 2026 18:44:22 +0200
Subject: [PATCH] [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'}}
More information about the cfe-commits
mailing list