mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[frontend] Fix the handling of -debug-constraints-attempt.
StringRef::getAsInteger returns true, not false, when an error occurs. Explicitly set the radix to 10, instead of inferring the radix. For the invalid argument value diagnostic, switch the order of the argument string and the value. Swift SVN r11279
This commit is contained in:
@@ -85,14 +85,13 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_debug_constraints_attempt)) {
|
||||
unsigned attempt;
|
||||
if (StringRef(A->getValue()).getAsInteger(0, attempt)) {
|
||||
Opts.DebugConstraintSolverAttempt = attempt;
|
||||
}
|
||||
else {
|
||||
if (StringRef(A->getValue()).getAsInteger(10, attempt)) {
|
||||
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_value,
|
||||
A->getValue(), A->getAsString(Args));
|
||||
A->getAsString(Args), A->getValue());
|
||||
return true;
|
||||
}
|
||||
|
||||
Opts.DebugConstraintSolverAttempt = attempt;
|
||||
}
|
||||
|
||||
if (Args.hasArg(OPT_emit_sil_protocol_witness_tables)) {
|
||||
|
||||
Reference in New Issue
Block a user