xref: /llvm-project/clang/test/CodeGenObjCXX/catch-id-type.mm (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1// RUN: %clang_cc1 -triple i386-apple-macosx10.6.6 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -fobjc-exceptions -fcxx-exceptions -fexceptions -o - %s | FileCheck %s
2
3@interface ns_array
4+ (id) array;
5@end
6
7@implementation ns_array
8+ (id) array { return 0; }
9@end
10
11id Groups();
12
13@protocol P @end;
14
15@interface INTF<P> {
16    double dd;
17}
18@end
19
20id FUNC() {
21    id groups;
22    try
23    {
24      groups = Groups();  // throws on errors.
25    }
26    catch( INTF<P>* error )
27    {
28      Groups();
29    }
30    catch( id error )
31    {
32      // CHECK:      landingpad { ptr, i32 }
33      // CHECK-NEXT:   catch ptr @_ZTIPU11objcproto1P4INTF
34      // CHECK-NEXT:   catch ptr @_ZTIP11objc_object
35      // CHECK-NEXT:   catch ptr @_ZTIP10objc_class
36      error = error;
37      groups = [ns_array array];
38    }
39    catch (Class cl) {
40      cl = cl;
41      groups = [ns_array array];
42    }
43    return groups;
44
45}
46
47int main() {
48  FUNC();
49  return 0;
50}
51