mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Front-end: add an option to not lock interface file when building module
This could help fix a flaky test. Related to: rdar://58578342
This commit is contained in:
@@ -390,7 +390,15 @@ bool ModuleInterfaceBuilder::buildSwiftModule(StringRef OutPath,
|
||||
bool ShouldSerializeDeps,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
llvm::function_ref<void()> RemarkRebuild) {
|
||||
|
||||
auto build = [&]() {
|
||||
if (RemarkRebuild) {
|
||||
RemarkRebuild();
|
||||
}
|
||||
return buildSwiftModuleInternal(OutPath, ShouldSerializeDeps, ModuleBuffer);
|
||||
};
|
||||
if (disableInterfaceFileLock) {
|
||||
return build();
|
||||
}
|
||||
while (1) {
|
||||
// Attempt to lock the interface file. Only one process is allowed to build
|
||||
// module from the interface so we don't consume too much memory when multiple
|
||||
@@ -412,10 +420,7 @@ bool ModuleInterfaceBuilder::buildSwiftModule(StringRef OutPath,
|
||||
LLVM_FALLTHROUGH;
|
||||
}
|
||||
case llvm::LockFileManager::LFS_Owned: {
|
||||
if (RemarkRebuild) {
|
||||
RemarkRebuild();
|
||||
}
|
||||
return buildSwiftModuleInternal(OutPath, ShouldSerializeDeps, ModuleBuffer);
|
||||
return build();
|
||||
}
|
||||
case llvm::LockFileManager::LFS_Shared: {
|
||||
// Someone else is responsible for building the module. Wait for them to
|
||||
|
||||
Reference in New Issue
Block a user