[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / statements.c
blob2566da83d7c53a8a049c756649897de9a013ce94
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unreachable-code
3 void test1(void) {
4 { ; { ;;}} ;;
7 void test2(void) {
8 if (0) { if (1) {} } else { }
10 do { } while (0);
12 while (0) while(0) do ; while(0);
14 for ((void)0;0;(void)0)
15 for (;;)
16 for ((void)9;0;(void)2)
18 for (int X = 0; 0; (void)0);
21 void test3(void) {
22 switch (0) {
24 case 4:
25 if (0) {
26 case 6: ;
28 default:
33 void test4(void) {
34 if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
36 int X; // declaration in a block.
38 foo: if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
41 typedef int t;
42 void test5(void) {
43 if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
45 t x = 0;
47 if (0); // expected-warning {{if statement has empty body}} expected-note {{put the semicolon on a separate line to silence this warning}}
51 void test6(void) {
52 do
53 . // expected-error {{expected expression}}
54 while (0);
57 int test7(void) {
58 return 4 // expected-error {{expected ';' after return statement}}
61 void test8(void) {
62 // Should not skip '}' and produce a "expected '}'" error.
63 undecl // expected-error {{use of undeclared identifier 'undecl'}}
66 int test9(void) {
67 int T[] = {1, 2, };
69 int X;
70 X = 0, // expected-error {{expected ';' after expression}}
74 X = 0, // expected-error {{expected ';' after expression}}
75 if (0)
78 return 4, // expected-error {{expected ';' after return statement}}