diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-03-03 10:31:48 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-03-03 10:31:48 +0800 |
commit | bf52ead24ca4fe1b73bceec7bba3abfe15541649 (patch) | |
tree | 356336638558c02b5ad2f31be9060cd1642c2985 /clang/lib/Frontend/FrontendActions.cpp | |
parent | 87cf39aa349b83ae3b7d16c30ac7a8ffa0ad098c (diff) | |
download | llvm-bf52ead24ca4fe1b73bceec7bba3abfe15541649.zip llvm-bf52ead24ca4fe1b73bceec7bba3abfe15541649.tar.gz llvm-bf52ead24ca4fe1b73bceec7bba3abfe15541649.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Frontend/FrontendActions.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendActions.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp index ccb983d..2aae41f 100644 --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -765,8 +765,10 @@ static StringRef ModuleKindName(Module::ModuleKind MK) { return "Partition Implementation"; case Module::ModuleHeaderUnit: return "Header Unit"; - case Module::GlobalModuleFragment: + case Module::ExplicitGlobalModuleFragment: return "Global Module Fragment"; + case Module::ImplicitGlobalModuleFragment: + return "Implicit Module Fragment"; case Module::PrivateModuleFragment: return "Private Module Fragment"; } |