[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:
Connor Wakamo
2013-12-13 23:56:31 +00:00
parent 8aa7eaa150
commit 605589922a

View File

@@ -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)) {