[clang] [C++20][Modules] Implement P1857R3 Modules Dependency Discovery (PR #107168)

Hubert Tong via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 18 20:55:44 PDT 2025


================
@@ -986,6 +989,14 @@ def warn_module_conflict : Warning<
   InGroup<ModuleConflict>;
 
 // C++20 modules
+def err_pp_module_name_is_macro : Error<
+  "%select{module|partition}0 name component %1 cannot be a object-like macro">;
+def err_pp_module_expected_ident : Error<
+  "expected %select{identifier after '.' in |}0module name">;
+def err_pp_module_decl_in_header
+    : Error<"module declaration must not come from an #include directive">;
+def err_pp_cond_span_module_decl
+    : Error<"preprocessor conditionals shall not span a module declaration">;
----------------
hubert-reinterpretcast wrote:

> IIUC, we should not touch the text in skipped block? Did you mean `#if 1`?

I don't mean `#if 1`. There is actually no "skipped block" in the above because the module directive is not a _text-line_ (https://wg21.link/cpp.pre#2) nor anything else that is allowed in a _group_ (https://eel.is/c++draft/cpp.pre#nt:group-part).


https://github.com/llvm/llvm-project/pull/107168


More information about the cfe-commits mailing list