xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/rewrite-modern-catch.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"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambucvoid foo(id arg);
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@interface NSException
7*f4a2713aSLionel Sambuc@end
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc@interface Foo
10*f4a2713aSLionel Sambuc@end
11*f4a2713aSLionel Sambuc
12*f4a2713aSLionel Sambuc@implementation Foo
13*f4a2713aSLionel Sambuc- (void)bar {
14*f4a2713aSLionel Sambuc    @try {
15*f4a2713aSLionel Sambuc    } @catch (NSException *e) {
16*f4a2713aSLionel Sambuc	foo(e);
17*f4a2713aSLionel Sambuc    }
18*f4a2713aSLionel Sambuc    @catch (Foo *f) {
19*f4a2713aSLionel Sambuc    }
20*f4a2713aSLionel Sambuc    @catch (...) {
21*f4a2713aSLionel Sambuc      @try {
22*f4a2713aSLionel Sambuc      }
23*f4a2713aSLionel Sambuc      @catch (Foo *f1) {
24*f4a2713aSLionel Sambuc	foo(f1);
25*f4a2713aSLionel Sambuc      }
26*f4a2713aSLionel Sambuc      @catch (id pid) {
27*f4a2713aSLionel Sambuc	foo(pid);
28*f4a2713aSLionel Sambuc      }
29*f4a2713aSLionel Sambuc    }
30*f4a2713aSLionel Sambuc}
31*f4a2713aSLionel Sambuc@end
32