diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-11-09 17:15:55 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2023-11-09 17:44:41 +0800 |
commit | 0f7aaeb3241c3803489a45753190e82dbc7fd5fa (patch) | |
tree | 241536efd4dd2fece6917eaeb4bbfd56056c776c /clang/lib/Lex/ModuleMap.cpp | |
parent | e3d750cc40e4cea281924142859dd4b9a6465f99 (diff) | |
download | llvm-0f7aaeb3241c3803489a45753190e82dbc7fd5fa.zip llvm-0f7aaeb3241c3803489a45753190e82dbc7fd5fa.tar.gz llvm-0f7aaeb3241c3803489a45753190e82dbc7fd5fa.tar.bz2 |
[C++20] [Modules] Allow export from language linkage
Close https://github.com/llvm/llvm-project/issues/71347
Previously I misread the concept of module purview. I thought if a
declaration attached to a unnamed module, it can't be part of the module
purview. But after the issue report, I recognized that module purview is
more of a concept about locations instead of semantics.
Concretely, the things in the language linkage after module declarations
can be exported.
This patch refactors `Module::isModulePurview()` and introduces some
possible code cleanups.
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index e4f3cdd..00e13c9 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -881,17 +881,17 @@ Module *ModuleMap::createGlobalModuleFragmentForModuleUnit(SourceLocation Loc, return Result; } -Module *ModuleMap::createImplicitGlobalModuleFragmentForModuleUnit( - SourceLocation Loc, bool IsExported, Module *Parent) { +Module * +ModuleMap::createImplicitGlobalModuleFragmentForModuleUnit(SourceLocation Loc, + Module *Parent) { assert(Parent && "We should only create an implicit global module fragment " "in a module purview"); // Note: Here the `IsExplicit` parameter refers to the semantics in clang // modules. All the non-explicit submodules in clang modules will be exported // too. Here we simplify the implementation by using the concept. - auto *Result = new Module(IsExported ? "<exported implicit global>" - : "<implicit global>", - Loc, Parent, /*IsFramework*/ false, - /*IsExplicit*/ !IsExported, NumCreatedModules++); + auto *Result = + new Module("<implicit global>", Loc, Parent, /*IsFramework=*/false, + /*IsExplicit=*/false, NumCreatedModules++); Result->Kind = Module::ImplicitGlobalModuleFragment; return Result; } |