[all-commits] [llvm/llvm-project] b8ceb9: [C++20] Diagnose invalid and reserved module names

Aaron Ballman via All-commits all-commits at lists.llvm.org
Thu Nov 3 05:30:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b8ceb9f4e4bdb69b5c3ea1ccf8505fa244ca0a1e
      https://github.com/llvm/llvm-project/commit/b8ceb9f4e4bdb69b5c3ea1ccf8505fa244ca0a1e
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-11-03 (Thu, 03 Nov 2022)

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

  Log Message:
  -----------
  [C++20] Diagnose invalid and reserved module names

[module.unit]p1 specifies that module and import are invalid components
of a module name, that module names cannot contain reserved
identifiers, and that std followed by zero or more digits is reserved.

The first issue (module and import pseudo-keywords) requires a
diagnostic, the second issue (use of reserved identifiers) does not
require a diagnostic. We diagnose both the same -- the code is ill-
formed unless the module declaration is in a system "header". This
allows STL implementations to use the reserved module names while
preventing users from stealing them out from under us.

Differential Revision: https://reviews.llvm.org/D136953




More information about the All-commits mailing list