xref: /aosp_15_r20/external/clang/test/Rewriter/rewrite-modern-catch.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -x objective-c -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
2*67e74705SXin Li// 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*67e74705SXin Li
4*67e74705SXin Livoid foo(id arg);
5*67e74705SXin Li
6*67e74705SXin Li@interface NSException
7*67e74705SXin Li@end
8*67e74705SXin Li
9*67e74705SXin Li@interface Foo
10*67e74705SXin Li@end
11*67e74705SXin Li
12*67e74705SXin Li@implementation Foo
13*67e74705SXin Li- (void)bar {
14*67e74705SXin Li    @try {
15*67e74705SXin Li    } @catch (NSException *e) {
16*67e74705SXin Li	foo(e);
17*67e74705SXin Li    }
18*67e74705SXin Li    @catch (Foo *f) {
19*67e74705SXin Li    }
20*67e74705SXin Li    @catch (...) {
21*67e74705SXin Li      @try {
22*67e74705SXin Li      }
23*67e74705SXin Li      @catch (Foo *f1) {
24*67e74705SXin Li	foo(f1);
25*67e74705SXin Li      }
26*67e74705SXin Li      @catch (id pid) {
27*67e74705SXin Li	foo(pid);
28*67e74705SXin Li      }
29*67e74705SXin Li    }
30*67e74705SXin Li}
31*67e74705SXin Li@end
32