1 // RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp 2 // RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -fexceptions -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp 3 4 typedef struct objc_class *Class; 5 typedef struct objc_object { 6 Class isa; 7 } *id; 8 9 extern int printf(const char *, ...); 10 11 int main() { 12 @try { 13 } 14 @finally { 15 } 16 while (1) { 17 @try { 18 printf("executing try"); 19 break; 20 } @finally { 21 printf("executing finally"); 22 } 23 printf("executing after finally block"); 24 } 25 @try { 26 printf("executing try"); 27 } @finally { 28 printf("executing finally"); 29 } 30 return 0; 31 } 32 33 void test2_try_with_implicit_finally() { 34 @try { 35 return; 36 } @catch (id e) { 37 38 } 39 } 40 41 void FINALLY(); 42 void TRY(); 43 void CATCH(); 44 45 @interface NSException 46 @end 47 48 @interface Foo 49 @end 50 51 @implementation Foo 52 - (void)bar { 53 @try { 54 TRY(); 55 } 56 @catch (NSException *e) { 57 CATCH(); 58 } 59 @finally { 60 FINALLY(); 61 } 62 } 63 @end 64