diff options
-rw-r--r-- | lib/MC/MCParser/AsmLexer.cpp | 15 | ||||
-rw-r--r-- | test/MC/AsmParser/directive_values.s | 6 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/MC/MCParser/AsmLexer.cpp b/lib/MC/MCParser/AsmLexer.cpp index 86a9674f2f..c1c594a746 100644 --- a/lib/MC/MCParser/AsmLexer.cpp +++ b/lib/MC/MCParser/AsmLexer.cpp @@ -156,10 +156,13 @@ AsmToken AsmLexer::LexLineComment() { } static void SkipIgnoredIntegerSuffix(const char *&CurPtr) { - if (CurPtr[0] == 'L' && CurPtr[1] == 'L') - CurPtr += 2; - if (CurPtr[0] == 'U' && CurPtr[1] == 'L' && CurPtr[2] == 'L') - CurPtr += 3; + // Skip ULL, UL, U, L and LL suffices. + if (CurPtr[0] == 'U') + ++CurPtr; + if (CurPtr[0] == 'L') + ++CurPtr; + if (CurPtr[0] == 'L') + ++CurPtr; } // Look ahead to search for first non-hex digit, if it's [hH], then we treat the @@ -220,8 +223,8 @@ AsmToken AsmLexer::LexDigit() { if (Radix == 2 || Radix == 16) ++CurPtr; - // The darwin/x86 (and x86-64) assembler accepts and ignores ULL and LL - // suffixes on integer literals. + // The darwin/x86 (and x86-64) assembler accepts and ignores type + // suffices on integer literals. SkipIgnoredIntegerSuffix(CurPtr); return AsmToken(AsmToken::Integer, Result, Value); diff --git a/test/MC/AsmParser/directive_values.s b/test/MC/AsmParser/directive_values.s index 6c79c38bf5..ed932b2974 100644 --- a/test/MC/AsmParser/directive_values.s +++ b/test/MC/AsmParser/directive_values.s @@ -63,3 +63,9 @@ TEST7: # CHECK-NEXT: .byte 2 # CHECK-NEXT: .byte 3 # CHECK-NEXT: .byte 4 + +TEST8: + .long 0x200000UL+1 + .long 0x200000L+1 +# CHECK: .long 2097153 +# CHECK: .long 2097153 |