aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC/MCParser/AsmLexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MC/MCParser/AsmLexer.cpp')
-rw-r--r--lib/MC/MCParser/AsmLexer.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp
index 482eefd..1183312 100644
--- a/lib/MC/MCParser/AsmLexer.cpp
+++ b/lib/MC/MCParser/AsmLexer.cpp
@@ -74,6 +74,11 @@ AsmToken AsmLexer::LexIdentifier() {
while (isalnum(*CurPtr) || *CurPtr == '_' || *CurPtr == '$' ||
*CurPtr == '.' || *CurPtr == '@')
++CurPtr;
+
+ // Handle . as a special case.
+ if (CurPtr == TokStart+1 && TokStart[0] == '.')
+ return AsmToken(AsmToken::Dot, StringRef(TokStart, 1));
+
return AsmToken(AsmToken::Identifier, StringRef(TokStart, CurPtr - TokStart));
}
@@ -140,8 +145,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);
}