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