xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/rewrite-modern-try-finally.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fcxx-exceptions -fexceptions  -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambuctypedef struct objc_class *Class;
5*f4a2713aSLionel Sambuctypedef struct objc_object {
6*f4a2713aSLionel Sambuc    Class isa;
7*f4a2713aSLionel Sambuc} *id;
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambucvoid FINALLY();
10*f4a2713aSLionel Sambucvoid TRY();
11*f4a2713aSLionel Sambucvoid INNER_FINALLY();
12*f4a2713aSLionel Sambucvoid INNER_TRY();
13*f4a2713aSLionel Sambucvoid CHECK();
14*f4a2713aSLionel Sambuc
15*f4a2713aSLionel Sambuc@interface Foo
16*f4a2713aSLionel Sambuc@end
17*f4a2713aSLionel Sambuc
18*f4a2713aSLionel Sambuc@implementation Foo
19*f4a2713aSLionel Sambuc- (void)bar {
20*f4a2713aSLionel Sambuc    @try {
21*f4a2713aSLionel Sambuc	TRY();
22*f4a2713aSLionel Sambuc    }
23*f4a2713aSLionel Sambuc    @finally {
24*f4a2713aSLionel Sambuc	FINALLY();
25*f4a2713aSLionel Sambuc    }
26*f4a2713aSLionel Sambuc    CHECK();
27*f4a2713aSLionel Sambuc    @try {
28*f4a2713aSLionel Sambuc	TRY();
29*f4a2713aSLionel Sambuc    }
30*f4a2713aSLionel Sambuc    @finally {
31*f4a2713aSLionel Sambuc      @try {
32*f4a2713aSLionel Sambuc        INNER_TRY();
33*f4a2713aSLionel Sambuc      }
34*f4a2713aSLionel Sambuc      @finally {
35*f4a2713aSLionel Sambuc        INNER_FINALLY();
36*f4a2713aSLionel Sambuc      }
37*f4a2713aSLionel Sambuc      FINALLY();
38*f4a2713aSLionel Sambuc    }
39*f4a2713aSLionel Sambuc}
40*f4a2713aSLionel Sambuc@end
41