diff options
Diffstat (limited to 'test/Parser')
-rw-r--r-- | test/Parser/MicrosoftExtensions.c | 2 | ||||
-rw-r--r-- | test/Parser/parenthesis-balance.cpp | 15 | ||||
-rw-r--r-- | test/Parser/recovery.c | 14 | ||||
-rw-r--r-- | test/Parser/switch-recovery.cpp | 14 |
4 files changed, 44 insertions, 1 deletions
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c index 2f5da52..2b8451b 100644 --- a/test/Parser/MicrosoftExtensions.c +++ b/test/Parser/MicrosoftExtensions.c @@ -60,5 +60,5 @@ void ms_intrinsics(int a) { __noop(); __assume(a); - + __debugbreak(); } diff --git a/test/Parser/parenthesis-balance.cpp b/test/Parser/parenthesis-balance.cpp new file mode 100644 index 0000000..5bfa639 --- /dev/null +++ b/test/Parser/parenthesis-balance.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +int f(int x) { + if (int foo = f(bar)) {} // expected-error{{use of undeclared identifier 'bar'}} + while (int foo = f(bar)) {} // expected-error{{use of undeclared identifier 'bar'}} + for (int foo = f(bar);;) {} // expected-error{{use of undeclared identifier 'bar'}} + + int bar; + if (int foo = f(bar)) {} + while (int foo = f(bar)) {} + for (int foo = f(bar);;) {} + + return 0; +} + diff --git a/test/Parser/recovery.c b/test/Parser/recovery.c index 1b33f02..0747aec 100644 --- a/test/Parser/recovery.c +++ b/test/Parser/recovery.c @@ -74,6 +74,11 @@ void foo() { X = 4 // expected-error{{expected ';' after expression}} } +// rdar://9045701 +void test9045701(int x) { +#define VALUE 0 + x = VALUE // expected-error{{expected ';' after expression}} +} // rdar://7980651 typedef int intptr_t; // expected-note {{'intptr_t' declared here}} @@ -84,3 +89,12 @@ void test1(void) { int y = x; int z = y; } + +void test2(int x) { +#define VALUE2 VALUE+VALUE +#define VALUE3 VALUE+0 +#define VALUE4(x) x+0 + x = VALUE2 // expected-error{{expected ';' after expression}} + x = VALUE3 // expected-error{{expected ';' after expression}} + x = VALUE4(0) // expected-error{{expected ';' after expression}} +} diff --git a/test/Parser/switch-recovery.cpp b/test/Parser/switch-recovery.cpp index 0e4dcfa..a1df4261 100644 --- a/test/Parser/switch-recovery.cpp +++ b/test/Parser/switch-recovery.cpp @@ -156,3 +156,17 @@ void test12(int x) { } } } + +void missing_statement_case(int x) { + switch (x) { + case 1: + case 0: // expected-error {{label at end of compound statement: expected statement}} + } +} + +void missing_statement_default(int x) { + switch (x) { + case 0: + default: // expected-error {{label at end of compound statement: expected statement}} + } +} |