summaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-06-21 18:46:07 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-06-21 18:46:07 +0000
commit52ce795128022a5350050f7b8cd76cf56227c8ca (patch)
tree6b19d7d8cb644dc5c3970281280174aa84dd8fad /lib/Lex
parente26b3797f8baf47892aafd9d06fac8cc6235dafc (diff)
downloadclang-52ce795128022a5350050f7b8cd76cf56227c8ca.tar.gz
clang-52ce795128022a5350050f7b8cd76cf56227c8ca.tar.bz2
clang-52ce795128022a5350050f7b8cd76cf56227c8ca.tar.xz
Lex: Use the correct types for MS integer suffixes
Something went wrong with r211426, it is an older version of this code and should not have been committed. It was reverted with r211434. Original commit message: We didn't properly implement support for the sized integer suffixes. Suffixes like i16 were essentially ignored instead of mapping them to the appropriately sized integer type. This fixes PR20008. Differential Revision: http://reviews.llvm.org/D4132 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211441 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/LiteralSupport.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp
index 0103450cca..c55054be30 100644
--- a/lib/Lex/LiteralSupport.cpp
+++ b/lib/Lex/LiteralSupport.cpp
@@ -522,7 +522,7 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
isLongLong = false;
isFloat = false;
isImaginary = false;
- isMicrosoftInteger = false;
+ MicrosoftInteger = 0;
hadError = false;
if (*s == '0') { // parse radix
@@ -606,7 +606,8 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
case 'i':
case 'I':
if (PP.getLangOpts().MicrosoftExt) {
- if (isLong || isLongLong) break;
+ if (isLong || isLongLong || MicrosoftInteger)
+ break;
// Allow i8, i16, i32, i64, and i128.
if (s + 1 != ThisTokEnd) {
@@ -614,20 +615,20 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
case '8':
if (isFPConstant) break;
s += 2; // i8 suffix
- isMicrosoftInteger = true;
+ MicrosoftInteger = 8;
break;
case '1':
if (isFPConstant) break;
if (s + 2 == ThisTokEnd) break;
if (s[2] == '6') {
s += 3; // i16 suffix
- isMicrosoftInteger = true;
+ MicrosoftInteger = 16;
}
else if (s[2] == '2') {
if (s + 3 == ThisTokEnd) break;
if (s[3] == '8') {
s += 4; // i128 suffix
- isMicrosoftInteger = true;
+ MicrosoftInteger = 128;
}
}
break;
@@ -636,8 +637,7 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
if (s + 2 == ThisTokEnd) break;
if (s[2] == '2') {
s += 3; // i32 suffix
- isLong = true;
- isMicrosoftInteger = true;
+ MicrosoftInteger = 32;
}
break;
case '6':
@@ -645,14 +645,13 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
if (s + 2 == ThisTokEnd) break;
if (s[2] == '4') {
s += 3; // i64 suffix
- isLongLong = true;
- isMicrosoftInteger = true;
+ MicrosoftInteger = 64;
}
break;
default:
break;
}
- if (isMicrosoftInteger)
+ if (MicrosoftInteger)
break;
}
}
@@ -682,7 +681,7 @@ NumericLiteralParser::NumericLiteralParser(StringRef TokSpelling,
isLongLong = false;
isFloat = false;
isImaginary = false;
- isMicrosoftInteger = false;
+ MicrosoftInteger = 0;
saw_ud_suffix = true;
return;