blob: 7aa9709a8758c49d9afe22d9d3a9e05655d3470b [file] [log] [blame]
David Chisnall11d3f4c2012-07-03 20:49:52 +00001// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gcc -o - %s | FileCheck %s
David Chisnall65bd4ac2013-01-11 15:33:01 +00002// RUN: %clang_cc1 -triple x86_64-unknown-freebsd -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gnustep-1.7 -o - %s | FileCheck -check-prefix=NEW-ABI %s
John McCall8262b6a2010-07-17 00:43:08 +00003
4void opaque(void);
5void log(int i);
6
7@class C;
8
Bill Wendlingbe9e8bf2013-02-28 22:49:57 +00009// CHECK: define void @test0() [[TF:#[0-9]+]] {
John McCall8262b6a2010-07-17 00:43:08 +000010void test0() {
11 @try {
12 // CHECK: invoke void @opaque()
13 opaque();
John McCallff8e1152010-07-23 21:56:41 +000014
15 // CHECK: call void @log(i32 1)
16
John McCall8262b6a2010-07-17 00:43:08 +000017 } @catch (C *c) {
Bill Wendling285cfd82011-09-19 20:31:14 +000018 // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gnu_objc_personality_v0 to i8*)
19 // CHECK-NEXT: catch i8* getelementptr inbounds ([2 x i8]* @0, i64 0, i64 0)
20 // CHECK: br i1
John McCall8262b6a2010-07-17 00:43:08 +000021
22 // CHECK: call void @log(i32 0)
John McCallff8e1152010-07-23 21:56:41 +000023
David Chisnallc6860042012-11-07 16:50:40 +000024 // CHECK: resume
David Chisnall65bd4ac2013-01-11 15:33:01 +000025 // NEW-ABI: objc_begin_catch
26 // NEW-ABI: objc_end_catch
John McCallff8e1152010-07-23 21:56:41 +000027
John McCall8262b6a2010-07-17 00:43:08 +000028 log(0);
29 }
30
John McCall8262b6a2010-07-17 00:43:08 +000031 log(1);
32}
Bill Wendlingbe9e8bf2013-02-28 22:49:57 +000033
34// CHECK: attributes [[TF]] = { "{{.*}} }