r202533 - Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number contains "'e+", the pp-number ends between the 'e' and the '+'.

Richard Smith richard-llvm at metafoo.co.uk
Fri Feb 28 12:06:02 PST 2014


Author: rsmith
Date: Fri Feb 28 14:06:02 2014
New Revision: 202533

URL: http://llvm.org/viewvc/llvm-project?rev=202533&view=rev
Log:
Fix a minor bug in lexing pp-numbers with digit separators: if a pp-number contains "'e+", the pp-number ends between the 'e' and the '+'.

Modified:
    cfe/trunk/lib/Lex/Lexer.cpp
    cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp

Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=202533&r1=202532&r2=202533&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Fri Feb 28 14:06:02 2014
@@ -1620,6 +1620,7 @@ bool Lexer::LexNumericConstant(Token &Re
       if (!isLexingRawMode())
         Diag(CurPtr, diag::warn_cxx11_compat_digit_separator);
       CurPtr = ConsumeChar(CurPtr, Size, Result);
+      CurPtr = ConsumeChar(CurPtr, NextSize, Result);
       return LexNumericConstant(Result, CurPtr);
     }
   }

Modified: cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp?rev=202533&r1=202532&r2=202533&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp (original)
+++ cfe/trunk/test/Lexer/cxx1y_digit_separators.cpp Fri Feb 28 14:06:02 2014
@@ -18,6 +18,8 @@ namespace integral {
   int e = 0'b1010; // expected-error {{digit 'b' in octal constant}}
   int f = 0b'1010; // expected-error {{invalid digit 'b' in octal}}
   int g = 123'ms; // expected-error {{digit separator cannot appear at end of digit sequence}}
+  int h = 0x1e+1; // expected-error {{invalid suffix '+1' on integer constant}}
+  int i = 0x1'e+1; // ok, 'e+' is not recognized after a digit separator
 
   int z = 0'123'_foo; //'; // expected-error {{cannot appear at end of digit seq}}
 }





More information about the cfe-commits mailing list