Fariborz Jahanian | 6a3c70e | 2013-01-10 19:02:56 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -fobjc-exceptions -o - %s | FileCheck %s |
John McCall | 5a18039 | 2010-07-24 00:37:23 +0000 | [diff] [blame] | 2 | |
| 3 | @interface OCType @end |
| 4 | void opaque(); |
| 5 | |
| 6 | namespace test0 { |
| 7 | |
Stephen Lin | 93ab6bf | 2013-08-15 06:47:53 +0000 | [diff] [blame] | 8 | // CHECK-LABEL: define void @_ZN5test03fooEv |
John McCall | 5a18039 | 2010-07-24 00:37:23 +0000 | [diff] [blame] | 9 | void foo() { |
| 10 | try { |
| 11 | // CHECK: invoke void @_Z6opaquev |
| 12 | opaque(); |
| 13 | } catch (OCType *T) { |
Bill Wendling | 285cfd8 | 2011-09-19 20:31:14 +0000 | [diff] [blame] | 14 | // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) |
| 15 | // CHECK-NEXT: catch %struct._objc_typeinfo* @"OBJC_EHTYPE_$_OCType" |
John McCall | 5a18039 | 2010-07-24 00:37:23 +0000 | [diff] [blame] | 16 | } |
| 17 | } |
| 18 | } |
Fariborz Jahanian | 6a3c70e | 2013-01-10 19:02:56 +0000 | [diff] [blame] | 19 | |
| 20 | // rdar://12605907 |
| 21 | @interface NSException |
Fariborz Jahanian | b0ed986 | 2013-01-10 22:17:49 +0000 | [diff] [blame] | 22 | + new; |
Fariborz Jahanian | 6a3c70e | 2013-01-10 19:02:56 +0000 | [diff] [blame] | 23 | @end |
| 24 | namespace test1 { |
| 25 | |
| 26 | void bar() { |
| 27 | @try { |
| 28 | throw [NSException new]; |
| 29 | } @catch (id i) { |
| 30 | } |
| 31 | } |
Bill Wendling | 4e1125f | 2013-02-22 09:10:20 +0000 | [diff] [blame] | 32 | // CHECK: invoke void @objc_exception_throw(i8* [[CALL:%.*]]) [[NR:#[0-9]+]] |
Fariborz Jahanian | 6a3c70e | 2013-01-10 19:02:56 +0000 | [diff] [blame] | 33 | // CHECK: to label [[INVOKECONT1:%.*]] unwind label [[LPAD:%.*]] |
| 34 | } |
Bill Wendling | 4e1125f | 2013-02-22 09:10:20 +0000 | [diff] [blame] | 35 | |
| 36 | // CHECK: attributes [[NR]] = { noreturn } |