[PATCH] D136953: [C++20] Diagnose invalid and reserved module names

Chuanqi Xu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 07:02:41 PDT 2022


ChuanqiXu added inline comments.


================
Comment at: clang/test/Modules/reserved-names-1.cpp:25
+                         expected-error {{module declaration must occur at the start of the translation unit}}
+export module std.foo;// expected-error {{'std' is a reserved name for a module}} \
+                         expected-error {{module declaration must occur at the start of the translation unit}}
----------------
aaron.ballman wrote:
> ChuanqiXu wrote:
> > It looks like the diagnostic message should be '`std.foo` is a ...'
> We tell the user which part of the path name is reserved instead of giving them the whole path name. That helps for cases like: `export module aaron.wrote.this.awesome.module;` If there's confusion from this, we could probably change the diagnostic to be `'this' is a reserved identifier within module name 'aaron.wrote.this.awesome.module'`, but because you can only declare one module at a time, that seemed like overkill.
Got it. Makes sense.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136953/new/

https://reviews.llvm.org/D136953



More information about the cfe-commits mailing list