blob: 031c22204d8b1482b0431aa0b0a49a0255fe1068 [file] [log] [blame]
Fariborz Jahanian6a3c70e2013-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 McCall5a180392010-07-24 00:37:23 +00002
3@interface OCType @end
4void opaque();
5
6namespace test0 {
7
8 // CHECK: define void @_ZN5test03fooEv
9 void foo() {
10 try {
11 // CHECK: invoke void @_Z6opaquev
12 opaque();
13 } catch (OCType *T) {
Bill Wendling285cfd82011-09-19 20:31:14 +000014 // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
15 // CHECK-NEXT: catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType"
John McCall5a180392010-07-24 00:37:23 +000016 }
17 }
18}
Fariborz Jahanian6a3c70e2013-01-10 19:02:56 +000019
20// rdar://12605907
21@interface NSException
Fariborz Jahanianb0ed9862013-01-10 22:17:49 +000022 + new;
Fariborz Jahanian6a3c70e2013-01-10 19:02:56 +000023@end
24namespace test1 {
25
26 void bar() {
27 @try {
28 throw [NSException new];
29 } @catch (id i) {
30 }
31 }
Bill Wendling4e1125f2013-02-22 09:10:20 +000032// CHECK: invoke void @objc_exception_throw(i8* [[CALL:%.*]]) [[NR:#[0-9]+]]
Fariborz Jahanian6a3c70e2013-01-10 19:02:56 +000033// CHECK: to label [[INVOKECONT1:%.*]] unwind label [[LPAD:%.*]]
34}
Bill Wendling4e1125f2013-02-22 09:10:20 +000035
36// CHECK: attributes [[NR]] = { noreturn }