[Serialization] Local allocate ModuleFileSharedCore.ModuleInterfacePath

'ModuleInterfacePath' is passed as 'StringRef' that memory used to
reside in ASTContext. But 'ModuleFileSharedCore' should be 'ASTContext'
independent. So copy it using its own allocator.
This commit is contained in:
Rintaro Ishizaki
2020-09-02 12:47:37 -07:00
parent 50ea66d1d9
commit aa48494c74
2 changed files with 6 additions and 5 deletions

View File

@@ -990,10 +990,8 @@ SerializedModuleLoaderBase::loadModule(SourceLoc importLoc,
Ctx.addLoadedModule(M);
SWIFT_DEFER { M->setHasResolvedImports(); };
StringRef moduleInterfacePathStr =
Ctx.AllocateCopy(moduleInterfacePath.str());
auto *file =
loadAST(*M, moduleID.Loc, moduleInterfacePathStr,
loadAST(*M, moduleID.Loc, moduleInterfacePath,
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
std::move(moduleSourceInfoInputBuffer), isFramework);
if (file) {