Sema: Change -solver-memory-threshold into a frontend flag for consistency with the others

This commit is contained in:
Slava Pestov
2025-06-25 18:26:15 -04:00
parent 0f00c89b31
commit 84d1d115e1
6 changed files with 6 additions and 8 deletions

View File

@@ -847,6 +847,9 @@ def downgrade_typecheck_interface_error : Flag<["-"], "downgrade-typecheck-inter
def enable_volatile_modules : Flag<["-"], "enable-volatile-modules">,
HelpText<"Load Swift modules in memory">;
def solver_memory_threshold_EQ : Joined<["-"], "solver-memory-threshold=">,
HelpText<"Set the upper bound for memory consumption, in bytes, by the constraint solver">;
def solver_expression_time_threshold_EQ : Joined<["-"], "solver-expression-time-threshold=">,
HelpText<"Expression type checking timeout, in seconds">;

View File

@@ -799,10 +799,6 @@ def import_cf_types : Flag<["-"], "import-cf-types">,
Flags<[FrontendOption, HelpHidden]>,
HelpText<"Recognize and import CF types as class types">;
def solver_memory_threshold : Separate<["-"], "solver-memory-threshold">,
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
HelpText<"Set the upper bound for memory consumption, in bytes, by the constraint solver">;
def solver_shrink_unsolved_threshold : Separate<["-"], "solver-shrink-unsolved-threshold">,
Flags<[FrontendOption, HelpHidden, DoesNotAffectIncrementalBuild]>,
HelpText<"Set The upper bound to number of sub-expressions unsolved before termination of the shrink phrase">;

View File

@@ -312,7 +312,6 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
inputArgs.AddLastArg(arguments, options::OPT_nostdlibimport);
inputArgs.AddLastArg(arguments, options::OPT_parse_stdlib);
inputArgs.AddLastArg(arguments, options::OPT_resource_dir);
inputArgs.AddLastArg(arguments, options::OPT_solver_memory_threshold);
inputArgs.AddLastArg(arguments, options::OPT_value_recursion_threshold);
inputArgs.AddLastArg(arguments, options::OPT_warn_swift3_objc_inference);
inputArgs.AddLastArg(arguments, options::OPT_Rpass_EQ);

View File

@@ -1944,7 +1944,7 @@ static bool ParseTypeCheckerArgs(TypeCheckerOptions &Opts, ArgList &Args,
Opts.SwitchCheckingInvocationThreshold);
setUnsignedIntegerArgument(OPT_debug_constraints_attempt,
Opts.DebugConstraintSolverAttempt);
setUnsignedIntegerArgument(OPT_solver_memory_threshold,
setUnsignedIntegerArgument(OPT_solver_memory_threshold_EQ,
Opts.SolverMemoryThreshold);
setUnsignedIntegerArgument(OPT_solver_scope_threshold_EQ,
Opts.SolverScopeThreshold);

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -solver-memory-threshold 32000
// RUN: %target-typecheck-verify-swift -solver-memory-threshold=32000
// REQUIRES: OS=ios
import UIKit
class MyViewCell: UITableViewCell {

View File

@@ -1,3 +1,3 @@
// RUN: %target-typecheck-verify-swift -solver-memory-threshold 1
// RUN: %target-typecheck-verify-swift -solver-memory-threshold=1
func foo() { _ = 1 } // expected-error {{the compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions}}