Skip to content

Commit bd99a10

Browse files
authored
Merge pull request swiftlang#33768 from rintaro/serialization-modulecore-interfacepath
[Serialization] Local allocate ModuleFileSharedCore.ModuleInterfacePath
2 parents bfc9b54 + aa48494 commit bd99a10

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/Serialization/ModuleFileSharedCore.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,11 @@ class ModuleFileSharedCore {
461461
auto *core = new ModuleFileSharedCore(
462462
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
463463
std::move(moduleSourceInfoInputBuffer), isFramework, info, extInfo);
464-
if (!moduleInterfacePath.empty())
465-
core->ModuleInterfacePath = moduleInterfacePath;
464+
if (!moduleInterfacePath.empty()) {
465+
ArrayRef<char> path;
466+
core->allocateBuffer(path, moduleInterfacePath);
467+
core->ModuleInterfacePath = StringRef(path.data(), path.size());
468+
}
466469
theModule.reset(core);
467470
return info;
468471
}

lib/Serialization/SerializedModuleLoader.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -990,10 +990,8 @@ SerializedModuleLoaderBase::loadModule(SourceLoc importLoc,
990990
Ctx.addLoadedModule(M);
991991
SWIFT_DEFER { M->setHasResolvedImports(); };
992992

993-
StringRef moduleInterfacePathStr =
994-
Ctx.AllocateCopy(moduleInterfacePath.str());
995993
auto *file =
996-
loadAST(*M, moduleID.Loc, moduleInterfacePathStr,
994+
loadAST(*M, moduleID.Loc, moduleInterfacePath,
997995
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
998996
std::move(moduleSourceInfoInputBuffer), isFramework);
999997
if (file) {

0 commit comments

Comments
 (0)