[clang] [clang][Modules] Don't treat recovered module-end at EOF as an included header (PR #225099)
Macro Terra via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 28 02:51:35 PDT 2026
================
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -std=c++20 -fmodules -fsyntax-only -verify %s
+
+#pragma clang module build N // expected-error {{no matching '#pragma clang module endbuild'}}
+module N {}
+#pragma clang module contents
+#pragma clang module begin N // expected-error {{no matching '#pragma clang module end'}}
----------------
hongtaihu wrote:
Thanks, you are right. -verify is explicitly disabled for the nested module compilation, and the outer verifier ignores diagnostics from a different SourceManager, so the second expected-error was not actually checked.
I changed the test to capture stderr and use FileCheck for both the outer endbuild diagnostic and the nested module end diagnostic. I also verified that reverting the Sema fix makes the updated test reproduce the original assertion.
https://github.com/llvm/llvm-project/pull/225099
More information about the cfe-commits
mailing list