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  void foo() {
10    try {
11      // CHECK: invoke void @_Z6opaquev
12      opaque();
13    } catch (OCType *T) {
14      // CHECK:      landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
15      // CHECK-NEXT:   catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType"
16    }
17  }
18}
19
20// rdar://12605907
21@interface NSException
22  + new;
23@end
24namespace test1 {
25
26  void bar() {
27    @try {
28      throw [NSException new];
29    } @catch (id i) {
30    }
31  }
32// CHECK: invoke void @objc_exception_throw(i8* [[CALL:%.*]]) [[NR:#[0-9]+]]
33// CHECK:          to label [[INVOKECONT1:%.*]] unwind label [[LPAD:%.*]]
34}
35
36// CHECK: attributes [[NR]] = { noreturn }
37