blob: ef25f359e8bd906fad2ea0c27c0f673fa44fd3ce [file] [log] [blame]
Fariborz Jahanian1eab0522013-01-10 19:02:56 +00001// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -fobjc-exceptions -o - %s | FileCheck %s
John McCall2ca705e2010-07-24 00:37:23 +00002
3@interface OCType @end
4void opaque();
5
6namespace test0 {
7
Stephen Lin43622612013-08-15 06:47:53 +00008 // CHECK-LABEL: define void @_ZN5test03fooEv
David Majnemerfcbdb6e2015-06-17 20:53:19 +00009 // CHECK-SAME: personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
John McCall2ca705e2010-07-24 00:37:23 +000010 void foo() {
11 try {
12 // CHECK: invoke void @_Z6opaquev
13 opaque();
14 } catch (OCType *T) {
David Majnemerfcbdb6e2015-06-17 20:53:19 +000015 // CHECK: landingpad { i8*, i32 }
Bill Wendlingf0724e82011-09-19 20:31:14 +000016 // CHECK-NEXT: catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType"
John McCall2ca705e2010-07-24 00:37:23 +000017 }
18 }
19}
Fariborz Jahanian1eab0522013-01-10 19:02:56 +000020
21// rdar://12605907
22@interface NSException
Fariborz Jahanian54c39072013-01-10 22:17:49 +000023 + new;
Fariborz Jahanian1eab0522013-01-10 19:02:56 +000024@end
25namespace test1 {
26
27 void bar() {
28 @try {
29 throw [NSException new];
30 } @catch (id i) {
31 }
32 }
Bill Wendlinge1c4a1b2013-02-22 09:10:20 +000033// CHECK: invoke void @objc_exception_throw(i8* [[CALL:%.*]]) [[NR:#[0-9]+]]
Fariborz Jahanian1eab0522013-01-10 19:02:56 +000034// CHECK: to label [[INVOKECONT1:%.*]] unwind label [[LPAD:%.*]]
35}
Bill Wendlinge1c4a1b2013-02-22 09:10:20 +000036
37// CHECK: attributes [[NR]] = { noreturn }