@@ -782,7 +782,8 @@ static bool ParseCASArgs(CASOptions &Opts, ArgList &Args,
782782 DiagnosticEngine &Diags,
783783 const FrontendOptions &FrontendOpts) {
784784 using namespace options ;
785- Opts.EnableCaching |= Args.hasArg (OPT_cache_compile_job);
785+ Opts.EnableCaching |= Args.hasFlag (
786+ OPT_cache_compile_job, OPT_no_cache_compile_job, /* Default=*/ false );
786787 Opts.EnableCachingRemarks |= Args.hasArg (OPT_cache_remarks);
787788 Opts.CacheSkipReplay |= Args.hasArg (OPT_cache_disable_replay);
788789 if (const Arg *A = Args.getLastArg (OPT_cas_path))
@@ -2637,9 +2638,11 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
26372638 // If no style options are specified, default to Swift style, unless it is
26382639 // under swift caching, which llvm style is preferred because LLVM style
26392640 // replays a lot faster.
2640- Opts.PrintedFormattingStyle = Args.hasArg (OPT_cache_compile_job)
2641- ? DiagnosticOptions::FormattingStyle::LLVM
2642- : DiagnosticOptions::FormattingStyle::Swift;
2641+ Opts.PrintedFormattingStyle =
2642+ Args.hasFlag (OPT_cache_compile_job, OPT_no_cache_compile_job,
2643+ /* Default=*/ false )
2644+ ? DiagnosticOptions::FormattingStyle::LLVM
2645+ : DiagnosticOptions::FormattingStyle::Swift;
26432646 if (const Arg *arg = Args.getLastArg (OPT_diagnostic_style)) {
26442647 StringRef contents = arg->getValue ();
26452648 if (contents == " llvm" ) {
@@ -3389,6 +3392,7 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
33893392 const FrontendOptions &FrontendOpts,
33903393 const SILOptions &SILOpts,
33913394 const LangOptions &LangOpts,
3395+ const CASOptions &CASOpts,
33923396 StringRef SDKPath,
33933397 StringRef ResourceDir,
33943398 const llvm::Triple &Triple) {
@@ -3628,8 +3632,8 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
36283632
36293633 Opts.PrintInlineTree |= Args.hasArg (OPT_print_llvm_inline_tree);
36303634 // Always producing all outputs when caching is enabled.
3631- Opts.AlwaysCompile |= Args. hasArg (OPT_always_compile_output_files) ||
3632- Args.hasArg (OPT_cache_compile_job) ;
3635+ Opts.AlwaysCompile |=
3636+ Args.hasArg (OPT_always_compile_output_files) || CASOpts. EnableCaching ;
36333637
36343638 Opts.EnableDynamicReplacementChaining |=
36353639 Args.hasArg (OPT_enable_dynamic_replacement_chaining);
@@ -4204,8 +4208,8 @@ bool CompilerInvocation::parseArgs(
42044208 }
42054209
42064210 if (ParseIRGenArgs (IRGenOpts, ParsedArgs, Diags, FrontendOpts, SILOpts,
4207- LangOpts, getSDKPath (), SearchPathOpts. RuntimeResourcePath ,
4208- LangOpts.Target )) {
4211+ LangOpts, CASOpts, getSDKPath (),
4212+ SearchPathOpts. RuntimeResourcePath , LangOpts.Target )) {
42094213 return true ;
42104214 }
42114215
0 commit comments