add a hack to allow parsing negative minint. rdar://7751341

llvm-svn: 98442
This commit is contained in:
Chris Lattner 2010-03-13 19:25:13 +00:00
parent b14d123774
commit 341b1d25f1
1 changed files with 8 additions and 2 deletions

View File

@ -140,8 +140,14 @@ AsmToken AsmLexer::LexDigit() {
StringRef Result(TokStart, CurPtr - TokStart);
long long Value;
if (Result.getAsInteger(10, Value))
return ReturnError(TokStart, "Invalid decimal number");
if (Result.getAsInteger(10, Value)) {
// We have to handle minint_as_a_positive_value specially, because
// - minint_as_a_positive_value = minint and it is valid.
if (Result == "9223372036854775808")
Value = -9223372036854775808ULL;
else
return ReturnError(TokStart, "Invalid decimal number");
}
return AsmToken(AsmToken::Integer, Result, Value);
}