xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjCXX/exceptions.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -fobjc-exceptions -o - %s | FileCheck %s
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc@interface OCType @end
4*f4a2713aSLionel Sambucvoid opaque();
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambucnamespace test0 {
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc  // CHECK-LABEL: define void @_ZN5test03fooEv
9*f4a2713aSLionel Sambuc  void foo() {
10*f4a2713aSLionel Sambuc    try {
11*f4a2713aSLionel Sambuc      // CHECK: invoke void @_Z6opaquev
12*f4a2713aSLionel Sambuc      opaque();
13*f4a2713aSLionel Sambuc    } catch (OCType *T) {
14*f4a2713aSLionel Sambuc      // CHECK:      landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
15*f4a2713aSLionel Sambuc      // CHECK-NEXT:   catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType"
16*f4a2713aSLionel Sambuc    }
17*f4a2713aSLionel Sambuc  }
18*f4a2713aSLionel Sambuc}
19*f4a2713aSLionel Sambuc
20*f4a2713aSLionel Sambuc// rdar://12605907
21*f4a2713aSLionel Sambuc@interface NSException
22*f4a2713aSLionel Sambuc  + new;
23*f4a2713aSLionel Sambuc@end
24*f4a2713aSLionel Sambucnamespace test1 {
25*f4a2713aSLionel Sambuc
26*f4a2713aSLionel Sambuc  void bar() {
27*f4a2713aSLionel Sambuc    @try {
28*f4a2713aSLionel Sambuc      throw [NSException new];
29*f4a2713aSLionel Sambuc    } @catch (id i) {
30*f4a2713aSLionel Sambuc    }
31*f4a2713aSLionel Sambuc  }
32*f4a2713aSLionel Sambuc// CHECK: invoke void @objc_exception_throw(i8* [[CALL:%.*]]) [[NR:#[0-9]+]]
33*f4a2713aSLionel Sambuc// CHECK:          to label [[INVOKECONT1:%.*]] unwind label [[LPAD:%.*]]
34*f4a2713aSLionel Sambuc}
35*f4a2713aSLionel Sambuc
36*f4a2713aSLionel Sambuc// CHECK: attributes [[NR]] = { noreturn }
37