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 void *sel_registerName(const char *); 10 11 id SYNCH_EXPR(); 12 void SYNCH_BODY(); 13 void SYNCH_BEFORE(); 14 void SYNC_AFTER(); 15 16 void foo(id sem) 17 { 18 SYNCH_BEFORE(); 19 @synchronized (SYNCH_EXPR()) { 20 SYNCH_BODY(); 21 return; 22 } 23 SYNC_AFTER(); 24 @synchronized ([sem self]) { 25 SYNCH_BODY(); 26 return; 27 } 28 } 29 30 void test_sync_with_implicit_finally() { 31 id foo; 32 @synchronized (foo) { 33 return; // The rewriter knows how to generate code for implicit finally 34 } 35 } 36