diff options
author | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2022-11-15 11:50:51 +0800 |
---|---|---|
committer | Chuanqi Xu <yedeng.yd@linux.alibaba.com> | 2022-11-15 11:51:13 +0800 |
commit | 9044226ba2dab1c8c4e7fb352c4c5b4d399052b4 (patch) | |
tree | 99658a889604cd26c8a680d01726d4c69150d1b9 /clang/lib/Sema/SemaModule.cpp | |
parent | dde8423f21fb09c77b83d1ec50d5fff6bb940586 (diff) | |
download | llvm-9044226ba2dab1c8c4e7fb352c4c5b4d399052b4.zip llvm-9044226ba2dab1c8c4e7fb352c4c5b4d399052b4.tar.gz llvm-9044226ba2dab1c8c4e7fb352c4c5b4d399052b4.tar.bz2 |
[NFC] [C++20] [Modules] Remove unused Global Module Fragment variables/arguments
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r-- | clang/lib/Sema/SemaModule.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 1db716e..3d4fef1 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -244,14 +244,8 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, return nullptr; } - // Find the global module fragment we're adopting into this module, if any. - Module *GlobalModuleFragment = nullptr; - if (!ModuleScopes.empty() && - ModuleScopes.back().Module->Kind == Module::GlobalModuleFragment) - GlobalModuleFragment = ModuleScopes.back().Module; - assert((!getLangOpts().CPlusPlusModules || getLangOpts().ModulesTS || - SeenGMF == (bool)GlobalModuleFragment) && + SeenGMF == (bool)this->GlobalModuleFragment) && "mismatched global module state"); // In C++20, the module-declaration must be the first declaration if there @@ -335,8 +329,7 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, } // Create a Module for the module that we're defining. - Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName, - GlobalModuleFragment); + Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName); if (MDK == ModuleDeclKind::PartitionInterface) Mod->Kind = Module::ModulePartitionInterface; assert(Mod && "module creation should not fail"); @@ -356,21 +349,19 @@ Sema::ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, if (!Mod) { Diag(ModuleLoc, diag::err_module_not_defined) << ModuleName; // Create an empty module interface unit for error recovery. - Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName, - GlobalModuleFragment); + Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName); } } break; case ModuleDeclKind::PartitionImplementation: // Create an interface, but note that it is an implementation // unit. - Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName, - GlobalModuleFragment); + Mod = Map.createModuleForInterfaceUnit(ModuleLoc, ModuleName); Mod->Kind = Module::ModulePartitionImplementation; break; } - if (!GlobalModuleFragment) { + if (!this->GlobalModuleFragment) { ModuleScopes.push_back({}); if (getLangOpts().ModulesLocalVisibility) ModuleScopes.back().OuterVisibleModules = std::move(VisibleModules); |