diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-09-02 05:29:22 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-09-02 05:29:22 +0000 |
commit | ee29c9c2fc21dda0016343838e8730f413690a83 (patch) | |
tree | 918d8bd4d0beac140079df5da49ea73bd9dca7b9 | |
parent | 7c9ba6a1e356e29c4adee2c4a0442659ee14692a (diff) | |
download | bcm5719-llvm-ee29c9c2fc21dda0016343838e8730f413690a83.tar.gz bcm5719-llvm-ee29c9c2fc21dda0016343838e8730f413690a83.zip |
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.
llvm-svn: 55622
-rw-r--r-- | clang/lib/Lex/LiteralSupport.cpp | 2 | ||||
-rw-r--r-- | clang/test/Lexer/numeric-literal-trash.c | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index f9fd1aac793..8c2f2aff474 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -224,7 +224,7 @@ NumericLiteralParser(const char *begin, const char *end, 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; diff --git a/clang/test/Lexer/numeric-literal-trash.c b/clang/test/Lexer/numeric-literal-trash.c new file mode 100644 index 00000000000..243825a5363 --- /dev/null +++ b/clang/test/Lexer/numeric-literal-trash.c @@ -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); + } |