@@ -491,28 +491,35 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
491
491
const FrontendOptions &FrontendOpts) {
492
492
using namespace options ;
493
493
494
- auto setUnsignedIntegerArgument = [&Args, &Diags](options::ID optionID,
495
- unsigned radix,
496
- unsigned &valueToSet) {
497
- if (const Arg *A = Args.getLastArg (optionID)) {
498
- unsigned attempt;
499
- if (StringRef (A->getValue ()).getAsInteger (radix, attempt)) {
500
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
501
- A->getAsString (Args), A->getValue ());
502
- } else {
503
- valueToSet = attempt;
504
- }
505
- }
506
- };
507
-
508
- setUnsignedIntegerArgument (OPT_warn_long_function_bodies, 10 ,
494
+ bool HadError = false ;
495
+ auto setUnsignedIntegerArgument =
496
+ [&Args, &Diags, &HadError](options::ID optionID, unsigned &valueToSet) {
497
+ if (const Arg *A = Args.getLastArg (optionID)) {
498
+ unsigned attempt;
499
+ if (StringRef (A->getValue ()).getAsInteger (/* radix*/ 10 , attempt)) {
500
+ Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
501
+ A->getAsString (Args), A->getValue ());
502
+ HadError = true ;
503
+ } else {
504
+ valueToSet = attempt;
505
+ }
506
+ }
507
+ };
508
+
509
+ setUnsignedIntegerArgument (OPT_warn_long_function_bodies,
509
510
Opts.WarnLongFunctionBodies );
510
- setUnsignedIntegerArgument (OPT_warn_long_expression_type_checking, 10 ,
511
+ setUnsignedIntegerArgument (OPT_warn_long_expression_type_checking,
511
512
Opts.WarnLongExpressionTypeChecking );
512
- setUnsignedIntegerArgument (OPT_solver_expression_time_threshold_EQ, 10 ,
513
+ setUnsignedIntegerArgument (OPT_solver_expression_time_threshold_EQ,
513
514
Opts.ExpressionTimeoutThreshold );
514
- setUnsignedIntegerArgument (OPT_switch_checking_invocation_threshold_EQ, 10 ,
515
+ setUnsignedIntegerArgument (OPT_switch_checking_invocation_threshold_EQ,
515
516
Opts.SwitchCheckingInvocationThreshold );
517
+ setUnsignedIntegerArgument (OPT_debug_constraints_attempt,
518
+ Opts.DebugConstraintSolverAttempt );
519
+ setUnsignedIntegerArgument (OPT_solver_memory_threshold,
520
+ Opts.SolverMemoryThreshold );
521
+ setUnsignedIntegerArgument (OPT_solver_shrink_unsolved_threshold,
522
+ Opts.SolverShrinkUnsolvedThreshold );
516
523
517
524
Opts.DebugTimeFunctionBodies |= Args.hasArg (OPT_debug_time_function_bodies);
518
525
Opts.DebugTimeExpressions |=
@@ -539,21 +546,9 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
539
546
Opts.DebugConstraintSolver |= Args.hasArg (OPT_debug_constraints);
540
547
Opts.DebugGenericSignatures |= Args.hasArg (OPT_debug_generic_signatures);
541
548
542
- bool HadError = false ;
543
- if (const Arg *A = Args.getLastArg (OPT_debug_constraints_attempt)) {
544
- unsigned attempt;
545
- if (StringRef (A->getValue ()).getAsInteger (10 , attempt)) {
546
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
547
- A->getAsString (Args), A->getValue ());
548
- HadError = true ;
549
- } else {
550
- Opts.DebugConstraintSolverAttempt = attempt;
551
- }
552
- }
553
-
554
549
for (const Arg *A : Args.filtered (OPT_debug_constraints_on_line)) {
555
550
unsigned line;
556
- if (StringRef (A->getValue ()).getAsInteger (10 , line)) {
551
+ if (StringRef (A->getValue ()).getAsInteger (/* radix */ 10 , line)) {
557
552
Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
558
553
A->getAsString (Args), A->getValue ());
559
554
HadError = true ;
@@ -567,28 +562,6 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
567
562
Opts.DebugForbidTypecheckPrefix = A->getValue ();
568
563
}
569
564
570
- if (const Arg *A = Args.getLastArg (OPT_solver_memory_threshold)) {
571
- unsigned threshold;
572
- if (StringRef (A->getValue ()).getAsInteger (10 , threshold)) {
573
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
574
- A->getAsString (Args), A->getValue ());
575
- HadError = true ;
576
- } else {
577
- Opts.SolverMemoryThreshold = threshold;
578
- }
579
- }
580
-
581
- if (const Arg *A = Args.getLastArg (OPT_solver_shrink_unsolved_threshold)) {
582
- unsigned threshold;
583
- if (StringRef (A->getValue ()).getAsInteger (10 , threshold)) {
584
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
585
- A->getAsString (Args), A->getValue ());
586
- HadError = true ;
587
- } else {
588
- Opts.SolverShrinkUnsolvedThreshold = threshold;
589
- }
590
- }
591
-
592
565
if (Args.getLastArg (OPT_solver_disable_shrink))
593
566
Opts.SolverDisableShrink = true ;
594
567
0 commit comments