[cfe-commits] r55622 - in /cfe/trunk: lib/Lex/LiteralSupport.cpp test/Lexer/numeric-literal-trash.c

Eli Friedman eli.friedman at gmail.com
Mon Sep 1 22:29:22 PDT 2008


Author: efriedma
Date: Tue Sep  2 00:29:22 2008
New Revision: 55622

URL: http://llvm.org/viewvc/llvm-project?rev=55622&view=rev
Log:
Fix for PR2750; don't check for an 'e' in the trash after the token.

Note that this isn't really a complete fix; I think there are other 
potential overrun situations.  I don't really know what the best 
systematic fix is, though.


Added:
    cfe/trunk/test/Lexer/numeric-literal-trash.c
Modified:
    cfe/trunk/lib/Lex/LiteralSupport.cpp

Modified: cfe/trunk/lib/Lex/LiteralSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/LiteralSupport.cpp?rev=55622&r1=55621&r2=55622&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/LiteralSupport.cpp (original)
+++ cfe/trunk/lib/Lex/LiteralSupport.cpp Tue Sep  2 00:29:22 2008
@@ -224,7 +224,7 @@
       saw_period = true;
       s = SkipDigits(s);
     } 
-    if (*s == 'e' || *s == 'E') { // exponent
+    if (s != ThisTokEnd && (*s == 'e' || *s == 'E')) { // exponent
       const char *Exponent = s;
       s++;
       saw_exponent = true;

Added: cfe/trunk/test/Lexer/numeric-literal-trash.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/numeric-literal-trash.c?rev=55622&view=auto

==============================================================================
--- cfe/trunk/test/Lexer/numeric-literal-trash.c (added)
+++ cfe/trunk/test/Lexer/numeric-literal-trash.c Tue Sep  2 00:29:22 2008
@@ -0,0 +1,13 @@
+/* RUN: clang -fsyntax-only -verify %s
+ */
+# define XRECORD(x, c_name) e##c (x, __LINE__)
+
+
+
+
+
+
+ void x() {
+
+XRECORD (XRECORD (1, 1), 1);
+    }





More information about the cfe-commits mailing list