xref: /aosp_15_r20/external/clang/test/CodeGenObjC/nested-rethrow.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -fobjc-exceptions %s -o - | FileCheck %s
2*67e74705SXin Li
3*67e74705SXin Li
4*67e74705SXin Liextern int printf(const char*, ...);
5*67e74705SXin Li
6*67e74705SXin Liint main()
7*67e74705SXin Li{
8*67e74705SXin Li    @try {
9*67e74705SXin Li        @throw @"foo";
10*67e74705SXin Li    } @catch (id e) {
11*67e74705SXin Li        @try {
12*67e74705SXin Li// CHECK: call void @objc_exception_throw
13*67e74705SXin Li           @throw;
14*67e74705SXin Li        } @catch (id e) {
15*67e74705SXin Li            if (e) {
16*67e74705SXin Li                printf("caught \n");
17*67e74705SXin Li            } else {
18*67e74705SXin Li                printf("caught (WRONG)\n");
19*67e74705SXin Li            }
20*67e74705SXin Li        } @catch (...) {
21*67e74705SXin Li            printf("caught nothing (WRONG)\n");
22*67e74705SXin Li        }
23*67e74705SXin Li    }
24*67e74705SXin Li}
25*67e74705SXin Li
26