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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 28 11:20:42 PDT 2022


aaron.ballman updated this revision to Diff 471608.
aaron.ballman marked 3 inline comments as done.
aaron.ballman added a comment.

Updated based on review feedback and reflection.

I think the standards wording here is a bit unclear as to what's intended and I had misunderstood the wording around which part of the path needs to be checked. Specifically:

`All module-names either beginning with an identifier consisting of std followed by zero or more digits or containing a reserved identifier ([lex.name]) are reserved and shall not be specified in a module-declaration; no diagnostic is required.`

I took this to mean all identifier components of a module name should check for std followed by zero or more digits, but I now believe it means only the first component in the path and it intends to only catch use of `std[0-9]+` and not `.*std[0-9]+.*`. e.g., `std.foo` is reserved while `foo.std` and `std12Three` are not. I've changed the patch accordingly while addressing the other review feedback.


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

https://reviews.llvm.org/D136953

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaModule.cpp
  clang/test/CodeGenCXX/cxx20-module-std-subst-1.cppm
  clang/test/Modules/pair-unambiguous-ctor.cppm
  clang/test/Modules/reserved-names-1.cpp
  clang/test/Modules/reserved-names-2.cpp
  clang/test/Modules/reserved-names-3.cpp
  clang/test/Modules/reserved-names-system-header-1.cpp
  clang/test/Modules/reserved-names-system-header-2.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136953.471608.patch
Type: text/x-patch
Size: 10157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221028/52058289/attachment.bin>


More information about the cfe-commits mailing list