r209859 - Permit the "if" literal suffix with Microsoft extensions enabled.
Peter Collingbourne
peter at pcc.me.uk
Thu May 29 16:10:15 PDT 2014
Author: pcc
Date: Thu May 29 18:10:15 2014
New Revision: 209859
URL: http://llvm.org/viewvc/llvm-project?rev=209859&view=rev
Log:
Permit the "if" literal suffix with Microsoft extensions enabled.
Differential Revision: http://reviews.llvm.org/D3963
Modified:
cfe/trunk/lib/Lex/LiteralSupport.cpp
cfe/trunk/test/Lexer/ms-extensions.c
Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=209859&r1=209858&r2=209859&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Thu May 29 18:10:15 2014
@@ -606,16 +606,18 @@ NumericLiteralParser::NumericLiteralPars
case 'i':
case 'I':
if (PP.getLangOpts().MicrosoftExt) {
- if (isFPConstant || isLong || isLongLong) break;
+ if (isLong || isLongLong) break;
// Allow i8, i16, i32, i64, and i128.
if (s + 1 != ThisTokEnd) {
switch (s[1]) {
case '8':
+ if (isFPConstant) break;
s += 2; // i8 suffix
isMicrosoftInteger = true;
break;
case '1':
+ if (isFPConstant) break;
if (s + 2 == ThisTokEnd) break;
if (s[2] == '6') {
s += 3; // i16 suffix
@@ -630,6 +632,7 @@ NumericLiteralParser::NumericLiteralPars
}
break;
case '3':
+ if (isFPConstant) break;
if (s + 2 == ThisTokEnd) break;
if (s[2] == '2') {
s += 3; // i32 suffix
@@ -638,6 +641,7 @@ NumericLiteralParser::NumericLiteralPars
}
break;
case '6':
+ if (isFPConstant) break;
if (s + 2 == ThisTokEnd) break;
if (s[2] == '4') {
s += 3; // i64 suffix
@@ -648,7 +652,8 @@ NumericLiteralParser::NumericLiteralPars
default:
break;
}
- break;
+ if (isMicrosoftInteger)
+ break;
}
}
// "i", "if", and "il" are user-defined suffixes in C++1y.
Modified: cfe/trunk/test/Lexer/ms-extensions.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/ms-extensions.c?rev=209859&r1=209858&r2=209859&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/ms-extensions.c (original)
+++ cfe/trunk/test/Lexer/ms-extensions.c Thu May 29 18:10:15 2014
@@ -13,6 +13,10 @@ __int64 w = 0x43ui64;
__int64 z = 9Li64; // expected-error {{invalid suffix}}
__int64 q = 10lli64; // expected-error {{invalid suffix}}
+__complex double c1 = 1i;
+__complex double c2 = 1.0i;
+__complex float c3 = 1.0if;
+
// radar 7562363
#define ULLONG_MAX 0xffffffffffffffffui64
#define UINT 0xffffffffui32
More information about the cfe-commits
mailing list