@@ -284,18 +284,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
284
284
Opts.EnableSubstSILFunctionTypesForFunctionValues |=
285
285
Args.hasArg (OPT_enable_subst_sil_function_types_for_function_values);
286
286
287
- Opts.EnableOperatorDesignatedTypes |=
288
- Args.hasArg (OPT_enable_operator_designated_types);
289
-
290
287
Opts.DiagnoseInvalidEphemeralnessAsError |=
291
288
Args.hasArg (OPT_enable_invalid_ephemeralness_as_error);
292
289
293
- // Always enable operator designated types for the standard library.
294
- Opts.EnableOperatorDesignatedTypes |= FrontendOpts.ParseStdlib ;
295
-
296
- Opts.SolverEnableOperatorDesignatedTypes |=
297
- Args.hasArg (OPT_solver_enable_operator_designated_types);
298
-
299
290
if (auto A = Args.getLastArg (OPT_enable_deserialization_recovery,
300
291
OPT_disable_deserialization_recovery)) {
301
292
Opts.EnableDeserializationRecovery
@@ -353,9 +344,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
353
344
Opts.WarnIfASTScopeLookup |= Args.hasArg (OPT_warn_if_astscope_lookup);
354
345
Opts.LazyASTScopes |= Args.hasArg (OPT_lazy_astscopes);
355
346
356
- Opts.DebugConstraintSolver |= Args.hasArg (OPT_debug_constraints);
357
347
Opts.NamedLazyMemberLoading &= !Args.hasArg (OPT_disable_named_lazy_member_loading);
358
- Opts.DebugGenericSignatures |= Args.hasArg (OPT_debug_generic_signatures);
359
348
360
349
if (Args.hasArg (OPT_verify_syntax_tree)) {
361
350
Opts.BuildSyntaxTree = true ;
@@ -390,34 +379,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
390
379
Opts.EnableTestableAttrRequiresTestableModule
391
380
= A->getOption ().matches (OPT_enable_testable_attr_requires_testable_module);
392
381
}
393
-
394
- if (const Arg *A = Args.getLastArg (OPT_debug_constraints_attempt)) {
395
- unsigned attempt;
396
- if (StringRef (A->getValue ()).getAsInteger (10 , attempt)) {
397
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
398
- A->getAsString (Args), A->getValue ());
399
- HadError = true ;
400
- } else {
401
- Opts.DebugConstraintSolverAttempt = attempt;
402
- }
403
- }
404
-
405
- for (const Arg *A : Args.filtered (OPT_debug_constraints_on_line)) {
406
- unsigned line;
407
- if (StringRef (A->getValue ()).getAsInteger (10 , line)) {
408
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
409
- A->getAsString (Args), A->getValue ());
410
- HadError = true ;
411
- } else {
412
- Opts.DebugConstraintSolverOnLines .push_back (line);
413
- }
414
- }
415
- llvm::sort (Opts.DebugConstraintSolverOnLines );
416
382
417
- if (const Arg *A = Args.getLastArg (OPT_debug_forbid_typecheck_prefix)) {
418
- Opts.DebugForbidTypecheckPrefix = A->getValue ();
419
- }
420
-
421
383
if (Args.getLastArg (OPT_debug_cycles))
422
384
Opts.DebugDumpCycles = true ;
423
385
@@ -432,31 +394,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
432
394
}
433
395
}
434
396
435
- if (const Arg *A = Args.getLastArg (OPT_solver_memory_threshold)) {
436
- unsigned threshold;
437
- if (StringRef (A->getValue ()).getAsInteger (10 , threshold)) {
438
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
439
- A->getAsString (Args), A->getValue ());
440
- HadError = true ;
441
- } else {
442
- Opts.SolverMemoryThreshold = threshold;
443
- }
444
- }
445
-
446
- if (const Arg *A = Args.getLastArg (OPT_solver_shrink_unsolved_threshold)) {
447
- unsigned threshold;
448
- if (StringRef (A->getValue ()).getAsInteger (10 , threshold)) {
449
- Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
450
- A->getAsString (Args), A->getValue ());
451
- HadError = true ;
452
- } else {
453
- Opts.SolverShrinkUnsolvedThreshold = threshold;
454
- }
455
- }
456
-
457
- if (Args.getLastArg (OPT_solver_disable_shrink))
458
- Opts.SolverDisableShrink = true ;
459
-
460
397
if (const Arg *A = Args.getLastArg (OPT_value_recursion_threshold)) {
461
398
unsigned threshold;
462
399
if (StringRef (A->getValue ()).getAsInteger (10 , threshold)) {
@@ -528,9 +465,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
528
465
(Target.isTvOS () && Target.isOSVersionLT (12 , 2 )) ||
529
466
(Target.isWatchOS () && Target.isOSVersionLT (5 , 2 ));
530
467
531
- Opts.DisableConstraintSolverPerformanceHacks |=
532
- Args.hasArg (OPT_disable_constraint_solver_performance_hacks);
533
-
534
468
// Must be processed after any other language options that could affect
535
469
// platform conditions.
536
470
bool UnsupportedOS, UnsupportedArch;
@@ -557,8 +491,9 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
557
491
const FrontendOptions &FrontendOpts) {
558
492
using namespace options ;
559
493
560
- auto setUnsignedIntegerArgument = [&Args, &Diags](
561
- options::ID optionID, unsigned radix, unsigned &valueToSet) {
494
+ auto setUnsignedIntegerArgument = [&Args, &Diags](options::ID optionID,
495
+ unsigned radix,
496
+ unsigned &valueToSet) {
562
497
if (const Arg *A = Args.getLastArg (optionID)) {
563
498
unsigned attempt;
564
499
if (StringRef (A->getValue ()).getAsInteger (radix, attempt)) {
@@ -589,7 +524,75 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
589
524
// body skipping.
590
525
Opts.SkipNonInlinableFunctionBodies |= Args.hasArg (OPT_tbd_is_installapi);
591
526
592
- return false ;
527
+ Opts.DisableConstraintSolverPerformanceHacks |=
528
+ Args.hasArg (OPT_disable_constraint_solver_performance_hacks);
529
+
530
+ Opts.EnableOperatorDesignatedTypes |=
531
+ Args.hasArg (OPT_enable_operator_designated_types);
532
+
533
+ // Always enable operator designated types for the standard library.
534
+ Opts.EnableOperatorDesignatedTypes |= FrontendOpts.ParseStdlib ;
535
+
536
+ Opts.SolverEnableOperatorDesignatedTypes |=
537
+ Args.hasArg (OPT_solver_enable_operator_designated_types);
538
+
539
+ Opts.DebugConstraintSolver |= Args.hasArg (OPT_debug_constraints);
540
+ Opts.DebugGenericSignatures |= Args.hasArg (OPT_debug_generic_signatures);
541
+
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
+ for (const Arg *A : Args.filtered (OPT_debug_constraints_on_line)) {
555
+ unsigned line;
556
+ if (StringRef (A->getValue ()).getAsInteger (10 , line)) {
557
+ Diags.diagnose (SourceLoc (), diag::error_invalid_arg_value,
558
+ A->getAsString (Args), A->getValue ());
559
+ HadError = true ;
560
+ } else {
561
+ Opts.DebugConstraintSolverOnLines .push_back (line);
562
+ }
563
+ }
564
+ llvm::sort (Opts.DebugConstraintSolverOnLines );
565
+
566
+ if (const Arg *A = Args.getLastArg (OPT_debug_forbid_typecheck_prefix)) {
567
+ Opts.DebugForbidTypecheckPrefix = A->getValue ();
568
+ }
569
+
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
+ if (Args.getLastArg (OPT_solver_disable_shrink))
593
+ Opts.SolverDisableShrink = true ;
594
+
595
+ return HadError;
593
596
}
594
597
595
598
static bool ParseClangImporterArgs (ClangImporterOptions &Opts,
0 commit comments