From 3a151be8d5f85ca12737f5664ef91192014a4f77 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 13 Mar 2010 19:25:13 +0000 Subject: [PATCH] add a hack to allow parsing negative minint. rdar://7751341 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98442 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/MC/MCParser/AsmLexer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp index 482eefd93e0..22c8d762df3 100644 --- a/lib/MC/MCParser/AsmLexer.cpp +++ b/lib/MC/MCParser/AsmLexer.cpp @@ -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); }