Debian Codegraph @

clang/test/Rewriter/finally.m

raw
1 // RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -fobjc-exceptions -verify %s -o -
2
3 extern int printf(const char *, ...);
4
5 int main(void) {
6 @try {
7 printf("executing try");
8 return(0); // expected-warning{{rewriter doesn't support user-specified control flow semantics for @try/@finally (code may not execute properly)}}
9 } @finally {
10 printf("executing finally");
11 }
12 while (1) {
13 @try {
14 printf("executing try");
15 break;
16 } @finally {
17 printf("executing finally");
18 }
19 printf("executing after finally block");
20 }
21 @try {
22 printf("executing try");
23 } @finally {
24 printf("executing finally");
25 }
26 return 0;
27 }
28
29 void test_sync_with_implicit_finally(void) {
30 id foo;
31 @synchronized (foo) {
32 return; // The rewriter knows how to generate code for implicit finally
33 }
34 }
35
36 void test2_try_with_implicit_finally(void) {
37 @try {
38 return; // The rewriter knows how to generate code for implicit finally
39 } @catch (id e) {
40
41 }
42 }
43