diff --git a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp index c22f154e969e1..812890d7aec58 100644 --- a/lib/Frontend/ArgsToFrontendOptionsConverter.cpp +++ b/lib/Frontend/ArgsToFrontendOptionsConverter.cpp @@ -102,8 +102,6 @@ bool ArgsToFrontendOptionsConverter::convert( Opts.RemarkOnRebuildFromModuleInterface |= Args.hasArg(OPT_Rmodule_interface_rebuild); - Opts.DisableInterfaceFileLock |= Args.hasArg(OPT_disable_interface_lockfile); - computePrintStatsOptions(); computeDebugTimeOptions(); computeTBDOptions(); @@ -149,6 +147,15 @@ bool ArgsToFrontendOptionsConverter::convert( Opts.RequestedAction = determineRequestedAction(Args); } + if (Opts.RequestedAction == FrontendOptions::ActionType::CompileModuleFromInterface) { + // The situations where we use this action, e.g. explicit module building and + // generating prebuilt module cache, don't need synchronization. We should avoid + // using lock files for them. + Opts.DisableInterfaceFileLock = true; + } else { + Opts.DisableInterfaceFileLock |= Args.hasArg(OPT_disable_interface_lockfile); + } + if (Opts.RequestedAction == FrontendOptions::ActionType::Immediate && Opts.InputsAndOutputs.hasPrimaryInputs()) { Diags.diagnose(SourceLoc(), diag::error_immediate_mode_primary_file);