summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/has_include.c
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-03-29 15:33:29 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-03-29 15:33:29 +0000
commit18ff02dd5139d153b027564a5e43c554b08dcc39 (patch)
treeb25f057b6bba2291288bc21ef8f71b054286db33 /clang/test/Preprocessor/has_include.c
parent3012e59bc7a7224f59a8356feed54ac57b0bedb4 (diff)
downloadbcm5719-llvm-18ff02dd5139d153b027564a5e43c554b08dcc39.tar.gz
bcm5719-llvm-18ff02dd5139d153b027564a5e43c554b08dcc39.zip
[lex] Don't create a garbage token if parsing of __has_include fails.
It will crash downstream somewhere. Found by afl-fuzz. llvm-svn: 233493
Diffstat (limited to 'clang/test/Preprocessor/has_include.c')
-rw-r--r--clang/test/Preprocessor/has_include.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/has_include.c b/clang/test/Preprocessor/has_include.c
index 131e51919f7..ad7329390ef 100644
--- a/clang/test/Preprocessor/has_include.c
+++ b/clang/test/Preprocessor/has_include.c
@@ -163,6 +163,18 @@ __has_include
#if __has_include
#endif
+// expected-error@+1 {{missing '(' after '__has_include'}}
+#if __has_include'x'
+#endif
+
+// expected-error@+1 {{expected "FILENAME" or <FILENAME>}}
+#if __has_include('x'
+#endif
+
+// expected-error@+1 {{expected "FILENAME" or <FILENAME}} expected-error@+1 {{expected end of line in preprocessor expression}}
+#if __has_include('x')
+#endif
+
// expected-error@+1 {{missing ')' after '__has_include'}} // expected-error@+1 {{expected value in expression}} // expected-note@+1 {{to match this '('}}
#if __has_include(<stdint.h>
#endif
OpenPOWER on IntegriCloud