diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-04 19:20:19 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-08 19:02:26 +0000 |
commit | 81ad626541db97eb356e2c1d4a20eb2a26a766ab (patch) | |
tree | 311b6a8987c32b1e1dcbab65c54cfac3fdb56175 /contrib/llvm-project/clang/lib/Sema/SemaModule.cpp | |
parent | 5fff09660e06a66bed6482da9c70df328e16bbb6 (diff) | |
parent | 145449b1e420787bb99721a429341fa6be3adfb6 (diff) |
Diffstat (limited to 'contrib/llvm-project/clang/lib/Sema/SemaModule.cpp')
-rw-r--r-- | contrib/llvm-project/clang/lib/Sema/SemaModule.cpp | 327 |
1 files changed, 261 insertions, 66 deletions
diff --git a/contrib/llvm-project/clang/lib/Sema/SemaModule.cpp b/contrib/llvm-project/clang/lib/Sema/SemaModule.cpp index 747734f2d0ff..3aa124d457b0 100644 --- a/contrib/llvm-project/clang/lib/Sema/SemaModule.cpp +++ b/contrib/llvm-project/clang/lib/Sema/SemaModule.cpp @@ -54,6 +54,23 @@ static void checkModuleImportContext(Sema &S, Module *M, } } +// We represent the primary and partition names as 'Paths' which are sections +// of the hierarchical access path for a clang module. However for C++20 +// the periods in a name are just another character, and we will need to +// flatten them into a string. +static std::string stringFromPath(ModuleIdPath Path) { + std::string Name; + if (Path.empty()) + return Name; + + for (auto &Piece : Path) { + if (!Name.empty()) + Name += "."; + Name += Piece.first->getName(); + } + return Name; +} + Sema::DeclGroupPtrTy Sema::ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc) { if (!ModuleScopes.empty() && @@ -73,22 +90,91 @@ Sema::ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc) { // All declarations created from now on are owned by the global module. auto *TU = Context.getTranslationUnitDecl(); - TU->setModuleOwnershipKind(Decl::ModuleOwnershipKind::Visible); + // [module.global.frag]p2 + // A global-module-fragment specifies the contents of the global module + // fragment for a module unit. The global module fragment can be used to + // provide declarations that are attached to the global module and usable + // within the module unit. + // + // So the declations in the global module shouldn't be visible by default. + TU->setModuleOwnershipKind(Decl::ModuleOwnershipKind::ReachableWhenImported); TU->setLocalOwningModule(GlobalModule); // FIXME: Consider creating an explicit representation of this declaration. return nullptr; } +void Sema::HandleStartOfHeaderUnit() { + assert(getLangOpts().CPlusPlusModules && + "Header units are only valid for C++20 modules"); + SourceLocation StartOfTU = + SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID()); + + StringRef HUName = getLangOpts().CurrentModule; + if (HUName.empty()) { + HUName = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID())->getName(); + const_cast<LangOptions &>(getLangOpts()).CurrentModule = HUName.str(); + } + + // TODO: Make the C++20 header lookup independent. + // When the input is pre-processed source, we need a file ref to the original + // file for the header map. + auto F = SourceMgr.getFileManager().getFile(HUName); + // For the sake of error recovery (if someone has moved the original header + // after creating the pre-processed output) fall back to obtaining the file + // ref for the input file, which must be present. + if (!F) + F = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()); + assert(F && "failed to find the header unit source?"); + Module::Header H{HUName.str(), HUName.str(), *F}; + auto &Map = PP.getHeaderSearchInfo().getModuleMap(); + Module *Mod = Map.createHeaderUnit(StartOfTU, HUName, H); + assert(Mod && "module creation should not fail"); + ModuleScopes.push_back({}); // No GMF + ModuleScopes.back().BeginLoc = StartOfTU; + ModuleScopes.back().Module = Mod; + ModuleScopes.back().ModuleInterface = true; + ModuleScopes.back().IsPartition = false; + VisibleModules.setVisible(Mod, StartOfTU); + + // From now on, we have an owning module for all declarations we see. + // All of these are implicitly exported. + auto *TU = Context.getTranslationUnitDecl(); + TU->setModuleOwnershipKind(Decl::ModuleOwnershipKind::Visible); + TU->setLocalOwningModule(Mod); +} + Sema::DeclGroupPtrTy Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, - ModuleDeclKind MDK, ModuleIdPath Path, bool IsFirstDecl) { + ModuleDeclKind MDK, ModuleIdPath Path, + ModuleIdPath Partition, ModuleImportState &ImportState) { assert((getLangOpts().ModulesTS || getLangOpts().CPlusPlusModules) && "should only have module decl in Modules TS or C++20"); - // A module implementation unit requires that we are not compiling a module - // of any kind. A module interface unit requires that we are not compiling a - // module map. + bool IsFirstDecl = ImportState == ModuleImportState::FirstDecl; + bool SeenGMF = ImportState == ModuleImportState::GlobalFragment; + // If any of the steps here fail, we count that as invalidating C++20 + // module state; + ImportState = ModuleImportState::NotACXX20Module; + + bool IsPartition = !Partition.empty(); + if (IsPartition) + switch (MDK) { + case ModuleDeclKind::Implementation: + MDK = ModuleDeclKind::PartitionImplementation; + break; + case ModuleDeclKind::Interface: + MDK = ModuleDeclKind::PartitionInterface; + break; + default: + llvm_unreachable("how did we get a partition type set?"); + } + + // A (non-partition) module implementation unit requires that we are not + // compiling a module of any kind. A partition implementation emits an + // interface (and the AST for the implementation), which will subsequently + // be consumed to emit a binary. + // A module interface unit requires that we are not compiling a module map. switch (getLangOpts().getCompilingModule()) { case LangOptions::CMK_None: // It's OK to compile a module interface as a normal translation unit. @@ -99,7 +185,7 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, break; // We were asked to compile a module interface unit but this is a module - // implementation unit. That indicates the 'export' is missing. + // implementation unit. Diag(ModuleLoc, diag::err_module_interface_implementation_mismatch) << FixItHint::CreateInsertion(ModuleLoc, "export "); MDK = ModuleDeclKind::Interface; @@ -110,6 +196,7 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, return nullptr; case LangOptions::CMK_HeaderModule: + case LangOptions::CMK_HeaderUnit: Diag(ModuleLoc, diag::err_module_decl_in_header_module); return nullptr; } @@ -134,9 +221,13 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleScopes.back().Module->Kind == Module::GlobalModuleFragment) GlobalModuleFragment = ModuleScopes.back().Module; + assert((!getLangOpts().CPlusPlusModules || getLangOpts().ModulesTS || + SeenGMF == (bool)GlobalModuleFragment) && + "mismatched global module state"); + // In C++20, the module-declaration must be the first declaration if there // is no global module fragment. - if (getLangOpts().CPlusPlusModules && !IsFirstDecl && !GlobalModuleFragment) { + if (getLangOpts().CPlusPlusModules && !IsFirstDecl && !SeenGMF) { Diag(ModuleLoc, diag::err_module_decl_not_at_start); SourceLocation BeginLoc = ModuleScopes.empty() @@ -151,19 +242,19 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, // Flatten the dots in a module name. Unlike Clang's hierarchical module map // modules, the dots here are just another character that can appear in a // module name. - std::string ModuleName; - for (auto &Piece : Path) { - if (!ModuleName.empty()) - ModuleName += "."; - ModuleName += Piece.first->getName(); + std::string ModuleName = stringFromPath(Path); + if (IsPartition) { + ModuleName += ":"; + ModuleName += stringFromPath(Partition); } - // If a module name was explicitly specified on the command line, it must be // correct. if (!getLangOpts().CurrentModule.empty() && getLangOpts().CurrentModule != ModuleName) { Diag(Path.front().second, diag::err_current_module_name_mismatch) - << SourceRange(Path.front().second, Path.back().second) + << SourceRange(Path.front().second, IsPartition + ? Partition.back().second + : Path.back().second) << getLangOpts().CurrentModule; return nullptr; } @@ -173,7 +264,8 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, Module *Mod; switch (MDK) { - case ModuleDeclKind::Interface: { + case ModuleDeclKind::Interface: + case ModuleDeclKind::PartitionInterface: { // We can't have parsed or imported a definition of this module or parsed a // module map defining it already. if (auto *M = Map.findModule(ModuleName)) { @@ -190,13 +282,19 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, // Create a Module for the module that we're defining. Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName, GlobalModuleFragment); + if (MDK == ModuleDeclKind::PartitionInterface) + Mod->Kind = Module::ModulePartitionInterface; assert(Mod && "module creation should not fail"); break; } - case ModuleDeclKind::Implementation: + case ModuleDeclKind::Implementation: { std::pair<IdentifierInfo *, SourceLocation> ModuleNameLoc( PP.getIdentifierInfo(ModuleName), Path[0].second); + // C++20 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. Mod = getModuleLoader().loadModule(ModuleLoc, {ModuleNameLoc}, Module::AllVisible, /*IsInclusionDirective=*/false); @@ -206,6 +304,14 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName, GlobalModuleFragment); } + } break; + + case ModuleDeclKind::PartitionImplementation: + // Create an interface, but note that it is an implementation + // unit. + Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName, + GlobalModuleFragment); + Mod->Kind = Module::ModulePartitionImplementation; break; } @@ -222,15 +328,22 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleScopes.back().BeginLoc = StartLoc; ModuleScopes.back().Module = Mod; ModuleScopes.back().ModuleInterface = MDK != ModuleDeclKind::Implementation; + ModuleScopes.back().IsPartition = IsPartition; VisibleModules.setVisible(Mod, ModuleLoc); // From now on, we have an owning module for all declarations we see. - // However, those declarations are module-private unless explicitly + // In C++20 modules, those declaration would be reachable when imported + // unless explicitily exported. + // Otherwise, those declarations are module-private unless explicitly // exported. auto *TU = Context.getTranslationUnitDecl(); - TU->setModuleOwnershipKind(Decl::ModuleOwnershipKind::ModulePrivate); + TU->setModuleOwnershipKind(Decl::ModuleOwnershipKind::ReachableWhenImported); TU->setLocalOwningModule(Mod); + // We are in the module purview, but before any other (non import) + // statements, so imports are allowed. + ImportState = ModuleImportState::ImportAllowed; + // FIXME: Create a ModuleDecl. return nullptr; } @@ -245,6 +358,9 @@ Sema::ActOnPrivateModuleFragmentDecl(SourceLocation ModuleLoc, : ModuleScopes.back().Module->Kind) { case Module::ModuleMapModule: case Module::GlobalModuleFragment: + case Module::ModulePartitionImplementation: + case Module::ModulePartitionInterface: + case Module::ModuleHeaderUnit: Diag(PrivateLoc, diag::err_private_module_fragment_not_module); return nullptr; @@ -299,24 +415,50 @@ Sema::ActOnPrivateModuleFragmentDecl(SourceLocation ModuleLoc, DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, SourceLocation ExportLoc, - SourceLocation ImportLoc, - ModuleIdPath Path) { - // Flatten the module path for a Modules TS module name. + SourceLocation ImportLoc, ModuleIdPath Path, + bool IsPartition) { + + bool Cxx20Mode = getLangOpts().CPlusPlusModules || getLangOpts().ModulesTS; + assert((!IsPartition || Cxx20Mode) && "partition seen in non-C++20 code?"); + + // For a C++20 module name, flatten into a single identifier with the source + // location of the first component. std::pair<IdentifierInfo *, SourceLocation> ModuleNameLoc; - if (getLangOpts().ModulesTS) { - std::string ModuleName; - for (auto &Piece : Path) { - if (!ModuleName.empty()) - ModuleName += "."; - ModuleName += Piece.first->getName(); - } + + std::string ModuleName; + if (IsPartition) { + // We already checked that we are in a module purview in the parser. + assert(!ModuleScopes.empty() && "in a module purview, but no module?"); + Module *NamedMod = ModuleScopes.back().Module; + // If we are importing into a partition, find the owning named module, + // otherwise, the name of the importing named module. + ModuleName = NamedMod->getPrimaryModuleInterfaceName().str(); + ModuleName += ":"; + ModuleName += stringFromPath(Path); + ModuleNameLoc = {PP.getIdentifierInfo(ModuleName), Path[0].second}; + Path = ModuleIdPath(ModuleNameLoc); + } else if (Cxx20Mode) { + ModuleName = stringFromPath(Path); ModuleNameLoc = {PP.getIdentifierInfo(ModuleName), Path[0].second}; Path = ModuleIdPath(ModuleNameLoc); } - Module *Mod = - getModuleLoader().loadModule(ImportLoc, Path, Module::AllVisible, - /*IsInclusionDirective=*/false); + // Diagnose self-import before attempting a load. + // [module.import]/9 + // A module implementation unit of a module M that is not a module partition + // shall not contain a module-import-declaration nominating M. + // (for an implementation, the module interface is imported implicitly, + // but that's handled in the module decl code). + + if (getLangOpts().CPlusPlusModules && isCurrentModulePurview() && + getCurrentModule()->Name == ModuleName) { + Diag(ImportLoc, diag::err_module_self_import_cxx20) + << ModuleName << !ModuleScopes.back().ModuleInterface; + return true; + } + + Module *Mod = getModuleLoader().loadModule( + ImportLoc, Path, Module::AllVisible, /*IsInclusionDirective=*/false); if (!Mod) return true; @@ -333,8 +475,8 @@ static const ExportDecl *getEnclosingExportDecl(const Decl *D) { DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, SourceLocation ExportLoc, - SourceLocation ImportLoc, - Module *Mod, ModuleIdPath Path) { + SourceLocation ImportLoc, Module *Mod, + ModuleIdPath Path) { VisibleModules.setVisible(Mod, ImportLoc); checkModuleImportContext(*this, Mod, ImportLoc, CurContext); @@ -342,10 +484,7 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, // FIXME: we should support importing a submodule within a different submodule // of the same top-level module. Until we do, make it an error rather than // silently ignoring the import. - // Import-from-implementation is valid in the Modules TS. FIXME: Should we - // warn on a redundant import of the current module? - // FIXME: Import of a module from an implementation partition of the same - // module is permitted. + // FIXME: Should we warn on a redundant import of the current module? if (Mod->getTopLevelModuleName() == getLangOpts().CurrentModule && (getLangOpts().isCompilingModule() || !getLangOpts().ModulesTS)) { Diag(ImportLoc, getLangOpts().isCompilingModule() @@ -355,22 +494,26 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, } SmallVector<SourceLocation, 2> IdentifierLocs; - Module *ModCheck = Mod; - for (unsigned I = 0, N = Path.size(); I != N; ++I) { - // If we've run out of module parents, just drop the remaining identifiers. - // We need the length to be consistent. - if (!ModCheck) - break; - ModCheck = ModCheck->Parent; - IdentifierLocs.push_back(Path[I].second); - } - - // If this was a header import, pad out with dummy locations. - // FIXME: Pass in and use the location of the header-name token in this case. if (Path.empty()) { - for (; ModCheck; ModCheck = ModCheck->Parent) { + // If this was a header import, pad out with dummy locations. + // FIXME: Pass in and use the location of the header-name token in this + // case. + for (Module *ModCheck = Mod; ModCheck; ModCheck = ModCheck->Parent) IdentifierLocs.push_back(SourceLocation()); + } else if (getLangOpts().CPlusPlusModules && !Mod->Parent) { + // A single identifier for the whole name. + IdentifierLocs.push_back(Path[0].second); + } else { + Module *ModCheck = Mod; + for (unsigned I = 0, N = Path.size(); I != N; ++I) { + // If we've run out of module parents, just drop the remaining + // identifiers. We need the length to be consistent. + if (!ModCheck) + break; + ModCheck = ModCheck->Parent; + + IdentifierLocs.push_back(Path[I].second); } } @@ -383,7 +526,18 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, if (!ModuleScopes.empty()) Context.addModuleInitializer(ModuleScopes.back().Module, Import); - if (!ModuleScopes.empty() && ModuleScopes.back().ModuleInterface) { + // A module (partition) implementation unit shall not be exported. + if (getLangOpts().CPlusPlusModules && ExportLoc.isValid() && + Mod->Kind == Module::ModuleKind::ModulePartitionImplementation) { + Diag(ExportLoc, diag::err_export_partition_impl) + << SourceRange(ExportLoc, Path.back().second); + } else if (!ModuleScopes.empty() && + (ModuleScopes.back().ModuleInterface || + (getLangOpts().CPlusPlusModules && + ModuleScopes.back().Module->isGlobalModule()))) { + assert((!ModuleScopes.back().Module->isGlobalModule() || + Mod->Kind == Module::ModuleKind::ModuleHeaderUnit) && + "should only be importing a header unit into the GMF"); // Re-export the module if the imported module is exported. // Note that we don't need to add re-exported module to Imports field // since `Exports` implies the module is imported already. @@ -395,9 +549,21 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, // [module.interface]p1: // An export-declaration shall inhabit a namespace scope and appear in the // purview of a module interface unit. - Diag(ExportLoc, diag::err_export_not_in_module_interface) << 0; + Diag(ExportLoc, diag::err_export_not_in_module_interface) + << (!ModuleScopes.empty() && + !ModuleScopes.back().ImplicitGlobalModuleFragment); + } else if (getLangOpts().isCompilingModule()) { + Module *ThisModule = PP.getHeaderSearchInfo().lookupModule( + getLangOpts().CurrentModule, ExportLoc, false, false); + (void)ThisModule; + assert(ThisModule && "was expecting a module if building one"); } + // In some cases we need to know if an entity was present in a directly- + // imported module (as opposed to a transitive import). This avoids + // searching both Imports and Exports. + DirectModuleImports.insert(Mod); + return Import; } @@ -433,6 +599,13 @@ void Sema::BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod) { getModuleLoader().makeModuleVisible(Mod, Module::AllVisible, DirectiveLoc); VisibleModules.setVisible(Mod, DirectiveLoc); + + if (getLangOpts().isCompilingModule()) { + Module *ThisModule = PP.getHeaderSearchInfo().lookupModule( + getLangOpts().CurrentModule, DirectiveLoc, false, false); + (void)ThisModule; + assert(ThisModule && "was expecting a module if building one"); + } } void Sema::ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod) { @@ -598,6 +771,7 @@ enum class UnnamedDeclKind { StaticAssert, Asm, UsingDirective, + Namespace, Context }; } @@ -627,6 +801,10 @@ unsigned getUnnamedDeclDiag(UnnamedDeclKind UDK, bool InBlock) { // Allow exporting using-directives as an extension. return diag::ext_export_using_directive; + case UnnamedDeclKind::Namespace: + // Anonymous namespace with no content. + return diag::introduces_no_names; + case UnnamedDeclKind::Context: // Allow exporting DeclContexts that transitively contain no declarations // as an extension. @@ -654,10 +832,12 @@ static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) { diagExportedUnnamedDecl(S, *UDK, D, BlockStart); // [...] shall not declare a name with internal linkage. + bool HasName = false; if (auto *ND = dyn_cast<NamedDecl>(D)) { // Don't diagnose anonymous union objects; we'll diagnose their members // instead. - if (ND->getDeclName() && ND->getFormalLinkage() == InternalLinkage) { + HasName = (bool)ND->getDeclName(); + if (HasName && ND->getFormalLinkage() == InternalLinkage) { S.Diag(ND->getLocation(), diag::err_export_internal) << ND; if (BlockStart.isValid()) S.Diag(BlockStart, diag::note_export); @@ -669,8 +849,10 @@ static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) { // shall have been introduced with a name having external linkage if (auto *USD = dyn_cast<UsingShadowDecl>(D)) { NamedDecl *Target = USD->getUnderlyingDecl(); - if (Target->getFormalLinkage() == InternalLinkage) { - S.Diag(USD->getLocation(), diag::err_export_using_internal) << Target; + Linkage Lk = Target->getFormalLinkage(); + if (Lk == InternalLinkage || Lk == ModuleLinkage) { + S.Diag(USD->getLocation(), diag::err_export_using_internal) + << (Lk == InternalLinkage ? 0 : 1) << Target; S.Diag(Target->getLocation(), diag::note_using_decl_target); if (BlockStart.isValid()) S.Diag(BlockStart, diag::note_export); @@ -678,10 +860,17 @@ static bool checkExportedDecl(Sema &S, Decl *D, SourceLocation BlockStart) { } // Recurse into namespace-scope DeclContexts. (Only namespace-scope - // declarations are exported.) - if (auto *DC = dyn_cast<DeclContext>(D)) - if (DC->getRedeclContext()->isFileContext() && !isa<EnumDecl>(D)) + // declarations are exported.). + if (auto *DC = dyn_cast<DeclContext>(D)) { + if (isa<NamespaceDecl>(D) && DC->decls().empty()) { + if (!HasName) + // We don't allow an empty anonymous namespace (we don't allow decls + // in them either, but that's handled in the recursion). + diagExportedUnnamedDecl(S, UnnamedDeclKind::Namespace, D, BlockStart); + // We allow an empty named namespace decl. + } else if (DC->getRedeclContext()->isFileContext() && !isa<EnumDecl>(D)) return checkExportedDeclContext(S, DC, BlockStart); + } return false; } @@ -720,19 +909,25 @@ Decl *Sema::ActOnFinishExportDecl(Scope *S, Decl *D, SourceLocation RBraceLoc) { Module *Sema::PushGlobalModuleFragment(SourceLocation BeginLoc, bool IsImplicit) { - ModuleMap &Map = PP.getHeaderSearchInfo().getModuleMap(); - Module *GlobalModule = - Map.createGlobalModuleFragmentForModuleUnit(BeginLoc, getCurrentModule()); - assert(GlobalModule && "module creation should not fail"); + // We shouldn't create new global module fragment if there is already + // one. + if (!GlobalModuleFragment) { + ModuleMap &Map = PP.getHeaderSearchInfo().getModuleMap(); + GlobalModuleFragment = Map.createGlobalModuleFragmentForModuleUnit( + BeginLoc, getCurrentModule()); + } + + assert(GlobalModuleFragment && "module creation should not fail"); // Enter the scope of the global module. - ModuleScopes.push_back({BeginLoc, GlobalModule, + ModuleScopes.push_back({BeginLoc, GlobalModuleFragment, /*ModuleInterface=*/false, + /*IsPartition=*/false, /*ImplicitGlobalModuleFragment=*/IsImplicit, - /*VisibleModuleSet*/{}}); - VisibleModules.setVisible(GlobalModule, BeginLoc); + /*OuterVisibleModules=*/{}}); + VisibleModules.setVisible(GlobalModuleFragment, BeginLoc); - return GlobalModule; + return GlobalModuleFragment; } void Sema::PopGlobalModuleFragment() { |