[clang] [C++20][Modules] Implement P1857R3 Modules Dependency Discovery (PR #107168)
Hubert Tong via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 14 11:06:37 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:
These are both expressions of the fact that a `module` directive is neither a _control-line_ nor a _text-line_. Which is to say that there should be a preprocessor diagnostic (effective with `-E`) that triggers whenever a `module` directive is encountered where a _control-line_ or a _text-line_ is required.
In particular, such a diagnostic should only refer to "module directive"s and not to "module declaration"s.
A diagnostic is required for the following:
```cpp
module;
#if 0
export module m;
#endif
// expected-error at -2 {{}}
export module m2;
```
https://github.com/llvm/llvm-project/pull/107168
More information about the cfe-commits
mailing list