diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-29 15:33:29 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-03-29 15:33:29 +0000 |
commit | 18ff02dd5139d153b027564a5e43c554b08dcc39 (patch) | |
tree | b25f057b6bba2291288bc21ef8f71b054286db33 /clang/test/Preprocessor/has_include.c | |
parent | 3012e59bc7a7224f59a8356feed54ac57b0bedb4 (diff) | |
download | bcm5719-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.c | 12 |
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 |