aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCParser/AsmLexer.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2013-02-26 20:17:10 +0000
committerJim Grosbach <grosbach@apple.com>2013-02-26 20:17:10 +0000
commit94a2260a7f4eb20921a7b372ef2d286dd8d7d925 (patch)
treedc113097dc55f90bf8afb9277f484ea64704fad3 /llvm/lib/MC/MCParser/AsmLexer.cpp
parent2d17bbee489a1d23b52bbbcabe4d7895b61f0fb8 (diff)
downloadllvm-94a2260a7f4eb20921a7b372ef2d286dd8d7d925.zip
llvm-94a2260a7f4eb20921a7b372ef2d286dd8d7d925.tar.gz
llvm-94a2260a7f4eb20921a7b372ef2d286dd8d7d925.tar.bz2
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 llvm-svn: 176118
Diffstat (limited to 'llvm/lib/MC/MCParser/AsmLexer.cpp')
-rw-r--r--llvm/lib/MC/MCParser/AsmLexer.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp
index 86a9674..c1c594a 100644
--- a/llvm/lib/MC/MCParser/AsmLexer.cpp
+++ b/llvm/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);