llvm-project/clang/Lex
Chris Lattner bb1b44f004 Make octal constant lexing use AdvanceToTokenCharacter to give more
accurate diagnostics.  For test/Lexer/comments.c we now emit:

int x = 000000080;  /* expected-error {{invalid digit}} */
               ^
constants.c:7:4: error: invalid digit '8' in octal constant
00080;             /* expected-error {{invalid digit}} */
   ^


The last line is due to an escaped newline.  The full line looks like:

int y = 0000\
00080;             /* expected-error {{invalid digit}} */


Previously, we emitted:
constants.c:4:9: error: invalid digit '8' in octal constant
int x = 000000080;  /* expected-error {{invalid digit}} */
        ^
constants.c:6:9: error: invalid digit '8' in octal constant
int y = 0000\
        ^

which isn't too bad, but the new way is better for the user,
regardless of whether there is an escaped newline or not.

All the other lexer-related diagnostics should switch over 
to using AdvanceToTokenCharacter where appropriate.  Help
wanted :).

This implements test/Lexer/constants.c.

llvm-svn: 39906
2007-07-16 06:55:01 +00:00
..
HeaderSearch.cpp Finally bite the bullet and make the major change: split the clang namespace 2007-06-15 23:05:46 +00:00
IdentifierTable.cpp Add support for C++'0x keywords, patch by Doug Gregor 2007-07-16 04:18:29 +00:00
Lexer.cpp Finally bite the bullet and make the major change: split the clang namespace 2007-06-15 23:05:46 +00:00
LiteralSupport.cpp Make octal constant lexing use AdvanceToTokenCharacter to give more 2007-07-16 06:55:01 +00:00
MacroExpander.cpp remove obsolete comment. 2007-07-15 06:46:25 +00:00
MacroInfo.cpp switch function-like macros from using a vector for their arguments to an 2007-07-14 22:46:43 +00:00
Makefile Add altivec version of block comment skipping code. 2006-10-30 20:01:22 +00:00
PPExpressions.cpp Finally bite the bullet and make the major change: split the clang namespace 2007-06-15 23:05:46 +00:00
Pragma.cpp Finally bite the bullet and make the major change: split the clang namespace 2007-06-15 23:05:46 +00:00
Preprocessor.cpp Add a new Preprocessor::AdvanceToTokenCharacter method which, given a sloc 2007-07-16 06:48:38 +00:00
ScratchBuffer.cpp Finally bite the bullet and make the major change: split the clang namespace 2007-06-15 23:05:46 +00:00