[PATCH] D126959: [C++20][Modules] Introduce an implementation module.

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 05:28:29 PDT 2022


iains created this revision.
Herald added a project: All.
iains added reviewers: urnathan, ChuanqiXu.
iains added a subscriber: clang-modules.
iains published this revision for review.
iains added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

we need to distinguish implementation and interface in code-gen.


During code-gen (for initializers) we need to process module implementation
units differently from interfaces.  At present, this is not possible since
the interface module is loaded as representing the "current module scope".

We cannot treat an implementation unit as if it was a regular source, since we
need to track module purview and associate definitions with the module.

The solution here is to create a module type for the implementation which
imports the interface per C++20:
[module.unit/8] 'A module-declaration that contains neither an export-keyword
nor a module-partition implicitly imports the primary module interface unit of
the module as if by a module-import-declaration.

Implementation modules are never serialized (-emit-module-interface for an
implementation unit is diagnosed and rejected).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126959

Files:
  clang/include/clang/Basic/Module.h
  clang/include/clang/Lex/ModuleMap.h
  clang/lib/AST/Decl.cpp
  clang/lib/Frontend/FrontendActions.cpp
  clang/lib/Lex/ModuleMap.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaModule.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126959.434002.patch
Type: text/x-patch
Size: 8315 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220603/ce2c4d8c/attachment.bin>


More information about the cfe-commits mailing list