From 0f7aaeb3241c3803489a45753190e82dbc7fd5fa Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 9 Nov 2023 17:15:55 +0800 Subject: [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. --- clang/lib/Lex/ModuleMap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/lib/Lex/ModuleMap.cpp') 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 ? "" - : "", - Loc, Parent, /*IsFramework*/ false, - /*IsExplicit*/ !IsExported, NumCreatedModules++); + auto *Result = + new Module("", Loc, Parent, /*IsFramework=*/false, + /*IsExplicit=*/false, NumCreatedModules++); Result->Kind = Module::ImplicitGlobalModuleFragment; return Result; } -- cgit v1.1