[Frontend] Lock the swiftmodule when rebuilding from the swiftinterface

When rebuilding a module interface from the textual interface, lock the
destination path of the created swiftmodule instead of the source
swiftinterface. The swiftinterface files are likely to be in the SDK and
may be on a read-only filesystem.

rdar://60247977
This commit is contained in:
Alexis Laferrière
2021-02-25 17:35:20 -08:00
parent 86dadacac1
commit 2a1e5ed08f
2 changed files with 12 additions and 6 deletions

View File

@@ -290,7 +290,7 @@ bool ModuleInterfaceBuilder::buildSwiftModule(StringRef OutPath,
// processes are doing the same.
// FIXME: We should surface the module building step to the build system so
// we don't need to synchronize here.
llvm::LockFileManager Locked(interfacePath);
llvm::LockFileManager Locked(OutPath);
switch (Locked) {
case llvm::LockFileManager::LFS_Error:{
// ModuleInterfaceBuilder takes care of correctness and locks are only