[all-commits] [llvm/llvm-project] f60dc3: [C++20][Modules] Adjust handling of exports of nam...

iains via All-commits all-commits at lists.llvm.org
Fri Apr 8 00:57:58 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f60dc3caa67374c0e2941ee3866b5eaef0c6ffe6
      https://github.com/llvm/llvm-project/commit/f60dc3caa67374c0e2941ee3866b5eaef0c6ffe6
  Author: Iain Sandoe <iain at sandoe.co.uk>
  Date:   2022-04-08 (Fri, 08 Apr 2022)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaModule.cpp
    M clang/test/CXX/module/module.interface/p3.cpp
    M clang/test/CXX/module/module.interface/p5.cpp
    M clang/test/CXX/module/module.interface/p6.cpp
    A clang/test/Modules/cxx20-10-2-ex1.cpp
    A clang/test/Modules/cxx20-10-2-ex3.cpp
    A clang/test/Modules/cxx20-10-2-ex4.cpp
    A clang/test/Modules/cxx20-10-2-ex5.cpp
    A clang/test/Modules/cxx20-10-2-ex6.cpp
    A clang/test/Modules/cxx20-10-2-ex7.cpp

  Log Message:
  -----------
  [C++20][Modules] Adjust handling of exports of namespaces and using-decls.

This adjusts the handling for:

export module  M;

export namespace {};

export namespace N {};
export using namespace N;

In the first case, we were allowing empty anonymous namespaces
as part of an extension allowing empty top-level entities, but that seems
inappropriate in this case, since the linkage would be internal for the
anonymous namespace.  We now report an error for this.

The second case was producing a warning diagnostic that this was
accepted as an extension - however the C++20 standard does allow this
as well-formed.

In the third case we keep the current practice that this is accepted with a
warning (as an extension). The C++20 standard says it's an error.

We also ensure that using decls are only applied to items with external linkage.

This adjusts error messages for exports involving redeclarations in modules to
be more specific about the reason that the decl has been rejected.

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




More information about the All-commits mailing list