summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2013-12-10 21:29:48 +0000
committerJustin Bogner <mail@justinbogner.com>2013-12-10 21:29:48 +0000
commitab403f463a350e4bebe9b7f8f25a198746c89f54 (patch)
tree7800a6cae14e3f23a2ca80bb8c6a6fd7ca8d02b3 /clang/test
parent29da7178c87d6606e40021562cec776239144ecf (diff)
downloadbcm5719-llvm-ab403f463a350e4bebe9b7f8f25a198746c89f54.tar.gz
bcm5719-llvm-ab403f463a350e4bebe9b7f8f25a198746c89f54.zip
Parse: Avoid crashing on unterminated top-level asm strings
When parsing invalid top-level asm statements, we were ignoring the return code of the SkipUntil we used for recovery. This led to crashes when we hit the end of file and tried to continue parsing anyway. This fixes the crash and adds a couple of tests for parsing related problems. llvm-svn: 196961
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Parser/asm.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/test/Parser/asm.c b/clang/test/Parser/asm.c
index b95e08bcca1..dabb010529a 100644
--- a/clang/test/Parser/asm.c
+++ b/clang/test/Parser/asm.c
@@ -23,3 +23,16 @@ __asm ; // expected-error {{expected '(' after 'asm'}}
// <rdar://problem/10465079> - Don't crash on wide string literals in 'asm'.
int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}}
+asm() // expected-error {{expected string literal in 'asm'}}
+// expected-error@-1 {{expected ';' after top-level asm block}}
+
+asm(; // expected-error {{expected string literal in 'asm'}}
+
+asm("") // expected-error {{expected ';' after top-level asm block}}
+
+// Unterminated asm strings at the end of the file were causing us to crash, so
+// this needs to be last. rdar://15624081
+// expected-warning@+3 {{missing terminating '"' character}}
+// expected-error@+2 {{expected string literal in 'asm'}}
+// expected-error@+1 {{expected ';' after top-level asm block}}
+asm("
OpenPOWER on IntegriCloud