diff options
author | Jim Grosbach <grosbach@apple.com> | 2013-02-26 20:17:10 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2013-02-26 20:17:10 +0000 |
commit | ac67b50fcfaab20829b4bce32cfdce77507f6c72 (patch) | |
tree | 6ab28f137e524da3143a0cfb03a13dc036d7bba5 /lib/MC | |
parent | d06c9cb9bb0ad682d097f704f8ed97b0fb657670 (diff) |
AsmParser: More generic support for integer type suffices.
For integer constants, allow 'L', 'UL' as well as 'ULL' and 'LL'. This provides
better support for shared headers between .s and .c files that define bunches
of constant values.
rdar://9321056
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC')
-rw-r--r-- | lib/MC/MCParser/AsmLexer.cpp | 15 |
1 files changed, 9 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); |