summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2009-11-28 13:37:52 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2009-11-28 13:37:52 +0000
commitbaa1bc44af7d162fc1ce62a5f394cb1fac512023 (patch)
tree43e4cbca3f42a33f8171406ce3d45daff50118af /clang/lib/Lex
parent92096cb11ff74db73f532f4a5f983822fe83d63c (diff)
downloadbcm5719-llvm-baa1bc44af7d162fc1ce62a5f394cb1fac512023.tar.gz
bcm5719-llvm-baa1bc44af7d162fc1ce62a5f394cb1fac512023.zip
cleanup parsing of MS integer suffixes a little. this fixes PR5616
btw, I believe that isMicrosoftInteger can go away; it's not read anywhere llvm-svn: 90036
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/LiteralSupport.cpp42
1 files changed, 15 insertions, 27 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 42dd75e59b9..ab669422b27 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -375,46 +375,34 @@ NumericLiteralParser(const char *begin, const char *end,
continue; // Success.
case 'i':
if (PP.getLangOptions().Microsoft) {
+ if (isFPConstant || isUnsigned || isLong || isLongLong) break;
+
// Allow i8, i16, i32, i64, and i128.
if (s + 1 != ThisTokEnd) {
switch (s[1]) {
case '8':
s += 2; // i8 suffix
isMicrosoftInteger = true;
- continue;
+ break;
case '1':
- s += 2;
- if (s == ThisTokEnd) break;
- if (*s == '6') s++; // i16 suffix
- else if (*s == '2') {
- if (++s == ThisTokEnd) break;
- if (*s == '8') s++; // i128 suffix
+ if (s + 2 == ThisTokEnd) break;
+ if (s[2] == '6') s += 3; // i16 suffix
+ else if (s[2] == '2') {
+ if (s + 3 == ThisTokEnd) break;
+ if (s[3] == '8') s += 4; // i128 suffix
}
isMicrosoftInteger = true;
- continue;
+ break;
case '3':
- s += 2;
- if (s == ThisTokEnd) break;
- if (*s == '2') s++; // i32 suffix
+ if (s + 2 == ThisTokEnd) break;
+ if (s[2] == '2') s += 3; // i32 suffix
isMicrosoftInteger = true;
- continue;
+ break;
case '6':
- s += 2;
- if (s == ThisTokEnd) break;
- if (*s == '4') s++; // i64 suffix
+ if (s + 2 == ThisTokEnd) break;
+ if (s[2] == '4') s += 3; // i64 suffix
isMicrosoftInteger = true;
- continue;
- case 'f': // FP Suffix for "float"
- case 'F':
- if (!isFPConstant) break; // Error for integer constant.
- if (isFloat || isLong) break; // FF, LF invalid.
- isFloat = true;
- if (isImaginary) break; // Cannot be repeated.
- PP.Diag(PP.AdvanceToTokenCharacter(TokLoc, s-begin),
- diag::ext_imaginary_constant);
- isImaginary = true;
- s++;
- continue; // Success.
+ break;
default:
break;
}
OpenPOWER on IntegriCloud