mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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:
@@ -461,8 +461,11 @@ public:
|
||||
auto *core = new ModuleFileSharedCore(
|
||||
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
|
||||
std::move(moduleSourceInfoInputBuffer), isFramework, info, extInfo);
|
||||
if (!moduleInterfacePath.empty())
|
||||
core->ModuleInterfacePath = moduleInterfacePath;
|
||||
if (!moduleInterfacePath.empty()) {
|
||||
ArrayRef<char> path;
|
||||
core->allocateBuffer(path, moduleInterfacePath);
|
||||
core->ModuleInterfacePath = StringRef(path.data(), path.size());
|
||||
}
|
||||
theModule.reset(core);
|
||||
return info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user