From: NAKAMURA Takumi Date: Fri, 27 Sep 2013 04:42:28 +0000 (+0000) Subject: NumericLiteralParser::ParseNumberStartingWithZero(): Try to appease MSC16's miscompil... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2add97e841ad5abe49821df430300686fa610173;p=clang NumericLiteralParser::ParseNumberStartingWithZero(): Try to appease MSC16's miscompilation. Investigating yet. It seems msc16 miscompiles s[1] to be folded. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191485 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index 61f1d55a0e..17c6bb3049 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -706,8 +706,11 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { assert(s[0] == '0' && "Invalid method call"); s++; + int c1 = s[0]; + int c2 = s[1]; + // Handle a hex number like 0x1234. - if ((*s == 'x' || *s == 'X') && (isHexDigit(s[1]) || s[1] == '.')) { + if ((c1 == 'x' || c1 == 'X') && (isHexDigit(c2) || c2 == '.')) { s++; radix = 16; DigitsBegin = s; @@ -757,7 +760,7 @@ void NumericLiteralParser::ParseNumberStartingWithZero(SourceLocation TokLoc) { } // Handle simple binary numbers 0b01010 - if ((*s == 'b' || *s == 'B') && (s[1] == '0' || s[1] == '1')) { + if ((c1 == 'b' || c1 == 'B') && (c2 == '0' || c2 == '1')) { // 0b101010 is a C++1y / GCC extension. PP.Diag(TokLoc, PP.getLangOpts().CPlusPlus1y