forked from OSchip/llvm-project
[MC] Skip lower-case integer suffixes
`mov x0, 1024u` is permitted in binutils but rejected by the integrated assembler. Support the case. This is especially important when using the C pre-processor with the assembler: some shared code between C and assembler may use lower-cased suffices. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D128871
This commit is contained in:
parent
7a567c60f2
commit
fd6b9074ca
|
@ -251,12 +251,12 @@ AsmToken AsmLexer::LexLineComment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SkipIgnoredIntegerSuffix(const char *&CurPtr) {
|
static void SkipIgnoredIntegerSuffix(const char *&CurPtr) {
|
||||||
// Skip ULL, UL, U, L and LL suffices.
|
// Skip case-insensitive ULL, UL, U, L and LL suffixes.
|
||||||
if (CurPtr[0] == 'U')
|
if (CurPtr[0] == 'U' || CurPtr[0] == 'u')
|
||||||
++CurPtr;
|
++CurPtr;
|
||||||
if (CurPtr[0] == 'L')
|
if (CurPtr[0] == 'L' || CurPtr[0] == 'l')
|
||||||
++CurPtr;
|
++CurPtr;
|
||||||
if (CurPtr[0] == 'L')
|
if (CurPtr[0] == 'L' || CurPtr[0] == 'l')
|
||||||
++CurPtr;
|
++CurPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,16 @@ k:
|
||||||
check_expr -1, ~0
|
check_expr -1, ~0
|
||||||
check_expr +1, 1
|
check_expr +1, 1
|
||||||
check_expr 1 + 2, 3
|
check_expr 1 + 2, 3
|
||||||
|
check_expr 1U + 2U, 3U
|
||||||
|
check_expr 1L + 2L, 3L
|
||||||
|
check_expr 1UL + 2UL, 3UL
|
||||||
|
check_expr 1LL + 2L, 3LL
|
||||||
|
check_expr 1ULL + 2ULL, 3ULL
|
||||||
|
check_expr 1u + 2u, 3u
|
||||||
|
check_expr 1l + 2l, 3l
|
||||||
|
check_expr 1ul + 2ul, 3ul
|
||||||
|
check_expr 1ll + 2L, 3ll
|
||||||
|
check_expr 1ull + 2ull, 3ull
|
||||||
check_expr 1 & 3, 1
|
check_expr 1 & 3, 1
|
||||||
check_expr 4 / 2, 2
|
check_expr 4 / 2, 2
|
||||||
check_expr 4 / -2, -2
|
check_expr 4 / -2, -2
|
||||||
|
|
Loading…
Reference in New Issue