aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/ModuleMap.cpp
diff options
context:
space:
mode:
authorMitch Phillips <31459023+hctim@users.noreply.github.com>2023-03-27 04:33:53 -0700
committerMitch Phillips <31459023+hctim@users.noreply.github.com>2023-03-27 05:01:53 -0700
commit074f6fd61d382ff6bf108472ea701d214b02f64b (patch)
treedb2237cc4871c1634b3cf910f25751da51a06a06 /clang/lib/Lex/ModuleMap.cpp
parent5ca710ab148b0815c2b7b03fe2af643e637bbc7d (diff)
downloadllvm-074f6fd61d382ff6bf108472ea701d214b02f64b.zip
llvm-074f6fd61d382ff6bf108472ea701d214b02f64b.tar.gz
llvm-074f6fd61d382ff6bf108472ea701d214b02f64b.tar.bz2
Revert "[C++20][Modules] Introduce an implementation module."
This reverts commit c6e9823724ef6bdfee262289ee34d162db436af0. Reason: Broke the ASan buildbots, see https://reviews.llvm.org/D126959 (the original phabricator review) for more info.
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r--clang/lib/Lex/ModuleMap.cpp42
1 files changed, 8 insertions, 34 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp
index f2b2d0b..8dead93 100644
--- a/clang/lib/Lex/ModuleMap.cpp
+++ b/clang/lib/Lex/ModuleMap.cpp
@@ -888,30 +888,23 @@ ModuleMap::createPrivateModuleFragmentForInterfaceUnit(Module *Parent,
return Result;
}
-Module *ModuleMap::createModuleUnitWithKind(SourceLocation Loc, StringRef Name,
- Module::ModuleKind Kind) {
+Module *ModuleMap::createModuleForInterfaceUnit(SourceLocation Loc,
+ StringRef Name) {
+ assert(LangOpts.CurrentModule == Name && "module name mismatch");
+ assert(!Modules[Name] && "redefining existing module");
+
auto *Result =
new Module(Name, Loc, nullptr, /*IsFramework*/ false,
/*IsExplicit*/ false, NumCreatedModules++);
- Result->Kind = Kind;
+ Result->Kind = Module::ModuleInterfaceUnit;
+ Modules[Name] = SourceModule = Result;
- // Reparent any current global module fragment as a submodule of this module.
+ // Reparent the current global module fragment as a submodule of this module.
for (auto &Submodule : PendingSubmodules) {
Submodule->setParent(Result);
Submodule.release(); // now owned by parent
}
PendingSubmodules.clear();
- return Result;
-}
-
-Module *ModuleMap::createModuleForInterfaceUnit(SourceLocation Loc,
- StringRef Name) {
- assert(LangOpts.CurrentModule == Name && "module name mismatch");
- assert(!Modules[Name] && "redefining existing module");
-
- auto *Result =
- createModuleUnitWithKind(Loc, Name, Module::ModuleInterfaceUnit);
- Modules[Name] = SourceModule = Result;
// Mark the main source file as being within the newly-created module so that
// declarations and macros are properly visibility-restricted to it.
@@ -922,25 +915,6 @@ Module *ModuleMap::createModuleForInterfaceUnit(SourceLocation Loc,
return Result;
}
-Module *ModuleMap::createModuleForImplementationUnit(SourceLocation Loc,
- StringRef Name) {
- assert(LangOpts.CurrentModule == Name && "module name mismatch");
- // The interface for this implementation must exist and be loaded.
- assert(Modules[Name] && Modules[Name]->Kind == Module::ModuleInterfaceUnit &&
- "creating implementation module without an interface");
-
- auto *Result =
- createModuleUnitWithKind(Loc, Name, Module::ModuleImplementationUnit);
- SourceModule = Result;
-
- // Mark the main source file as being within the newly-created module so that
- // declarations and macros are properly visibility-restricted to it.
- auto *MainFile = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID());
- assert(MainFile && "no input file for module implementation");
-
- return Result;
-}
-
Module *ModuleMap::createHeaderUnit(SourceLocation Loc, StringRef Name,
Module::Header H) {
assert(LangOpts.CurrentModule == Name && "module name mismatch");