Skip to content

Commit e8150f2

Browse files
authored
Merge pull request swiftlang#32681 from nkcsgexi/65005528
Front-end: disable interface file locking for the -compile-module-from-interface action
2 parents ed0e628 + 5f219cd commit e8150f2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ bool ArgsToFrontendOptionsConverter::convert(
102102
Opts.RemarkOnRebuildFromModuleInterface |=
103103
Args.hasArg(OPT_Rmodule_interface_rebuild);
104104

105-
Opts.DisableInterfaceFileLock |= Args.hasArg(OPT_disable_interface_lockfile);
106-
107105
computePrintStatsOptions();
108106
computeDebugTimeOptions();
109107
computeTBDOptions();
@@ -149,6 +147,15 @@ bool ArgsToFrontendOptionsConverter::convert(
149147
Opts.RequestedAction = determineRequestedAction(Args);
150148
}
151149

150+
if (Opts.RequestedAction == FrontendOptions::ActionType::CompileModuleFromInterface) {
151+
// The situations where we use this action, e.g. explicit module building and
152+
// generating prebuilt module cache, don't need synchronization. We should avoid
153+
// using lock files for them.
154+
Opts.DisableInterfaceFileLock = true;
155+
} else {
156+
Opts.DisableInterfaceFileLock |= Args.hasArg(OPT_disable_interface_lockfile);
157+
}
158+
152159
if (Opts.RequestedAction == FrontendOptions::ActionType::Immediate &&
153160
Opts.InputsAndOutputs.hasPrimaryInputs()) {
154161
Diags.diagnose(SourceLoc(), diag::error_immediate_mode_primary_file);

0 commit comments

Comments
 (0)