diff options
author | Chris Lattner <sabre@nondot.org> | 2007-07-16 06:55:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-07-16 06:55:01 +0000 |
commit | bb1b44f0047e1ed3b85e52361c8bf29dcd404706 (patch) | |
tree | 53e73e9081ed643172c58ba118f87f160cd09e76 /clang/test/Lexer/constants.c | |
parent | 8a7003cd9f8f72720c2a9050a899d541fac03c1a (diff) | |
download | bcm5719-llvm-bb1b44f0047e1ed3b85e52361c8bf29dcd404706.tar.gz bcm5719-llvm-bb1b44f0047e1ed3b85e52361c8bf29dcd404706.zip |
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
Diffstat (limited to 'clang/test/Lexer/constants.c')
-rw-r--r-- | clang/test/Lexer/constants.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Lexer/constants.c b/clang/test/Lexer/constants.c new file mode 100644 index 00000000000..f7e4cd02fbb --- /dev/null +++ b/clang/test/Lexer/constants.c @@ -0,0 +1,8 @@ +/* RUN: clang -parse-ast-check %s + */ + +int x = 000000080; /* expected-error {{invalid digit}} */ + +int y = 0000\ +00080; /* expected-error {{invalid digit}} */ + |