[all-commits] [llvm/llvm-project] bf52ea: [C++20] [Modules] Support to export declarations i...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Thu Mar 2 18:34:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf52ead24ca4fe1b73bceec7bba3abfe15541649
      https://github.com/llvm/llvm-project/commit/bf52ead24ca4fe1b73bceec7bba3abfe15541649
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-03-03 (Fri, 03 Mar 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/Module.h
    M clang/include/clang/Lex/ModuleMap.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/Frontend/FrontendActions.cpp
    M clang/lib/Lex/ModuleMap.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExprCXX.cpp
    M clang/lib/Sema/SemaLookup.cpp
    M clang/lib/Sema/SemaModule.cpp
    A clang/test/Modules/export-language-linkage.cppm

  Log Message:
  -----------
  [C++20] [Modules] Support to export declarations in language linkage

Close https://github.com/llvm/llvm-project/issues/60405

See the discussion in the above link for the background.

What the patch does:
- Rename `Module::ModuleKind::GlobalModuleFragment` to
  `Module::ModuleKind::ExplicitGlobalModuleFragment`.
- Add another module kind `ImplicitGlobalModuleFragment` to
  `ModuleKind`.
- Create an implicit global module fragment for the language linkage
  declarations inside a module purview.
    - If the language linkage lives inside the scope of an export decl,
      the created modules is marked as exported to outer modules.
- In fact, Sema will only create at most 2 implicit global module
  fragments to avoid creating a lot of unnecessary modules in the edging
case.

Reviewed By: iains

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




More information about the All-commits mailing list