aboutsummaryrefslogtreecommitdiff
path: root/test/Lexer/eof-char.c
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2012-11-17 20:25:54 +0000
committerNico Weber <nicolasweber@gmx.de>2012-11-17 20:25:54 +0000
commit6d926ae667cca926e77ddce1734514911706ed0a (patch)
tree2a5f1f325132192956b3b09a30aa32005bcf5dc9 /test/Lexer/eof-char.c
parent3f03b586351779be6947466f530f22c491b1b70f (diff)
Fix crash on end-of-file after \ in a char literal, fixes PR14369.
This makes LexCharConstant() look more like LexStringLiteral(), which doesn't have this bug. Add tests for eof after \ for several other cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168269 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Lexer/eof-char.c')
-rw-r--r--test/Lexer/eof-char.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Lexer/eof-char.c b/test/Lexer/eof-char.c
new file mode 100644
index 0000000000..42ee6ea6ed
--- /dev/null
+++ b/test/Lexer/eof-char.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only
+// vim: set binary noeol:
+
+// This file intentionally ends without a \n on the last line. Make sure your
+// editor doesn't add one.
+
+// expected-warning@+1{{missing terminating ' character}} expected-error@+1{{expected expression}} expected-error@+1{{expected ';'}}
+char c = '\ \ No newline at end of file