blob: 95bb9d0dd734ad5479eda7e31c7c60f4e372f047 [file] [log] [blame]
John McCall49e34be2011-08-30 01:42:09 +00001// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=X86-64
2// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=X86-32
3// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=ARM-DARWIN
4// RUN: %clang_cc1 -triple arm-unknown-gnueabi -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=ARM-EABI
5// RUN: %clang_cc1 -triple mipsel-unknown-unknown -emit-llvm -fcxx-exceptions -fexceptions %s -O2 -o - | FileCheck %s --check-prefix=MIPS
6
7void foo();
8void test() {
9 try {
10 foo();
11 } catch (int *&i) {
12 *i = 5;
13 }
14}
15
16// PR10789: different platforms have different sizes for struct UnwindException.
17
Bill Wendling4e1125f2013-02-22 09:10:20 +000018// X86-64: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) [[NUW:#[0-9]+]]
John McCall49e34be2011-08-30 01:42:09 +000019// X86-64-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i64 32
Bill Wendling4e1125f2013-02-22 09:10:20 +000020// X86-32: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) [[NUW:#[0-9]+]]
John McCall49e34be2011-08-30 01:42:09 +000021// X86-32-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i64 32
Bill Wendling4e1125f2013-02-22 09:10:20 +000022// ARM-DARWIN: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) [[NUW:#[0-9]+]]
John McCall49e34be2011-08-30 01:42:09 +000023// ARM-DARWIN-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i64 32
Bill Wendling4e1125f2013-02-22 09:10:20 +000024// ARM-EABI: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) [[NUW:#[0-9]+]]
John McCall49e34be2011-08-30 01:42:09 +000025// ARM-EABI-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i32 88
Bill Wendling4e1125f2013-02-22 09:10:20 +000026// MIPS: [[T0:%.*]] = tail call i8* @__cxa_begin_catch(i8* [[EXN:%.*]]) [[NUW:#[0-9]+]]
John McCall49e34be2011-08-30 01:42:09 +000027// MIPS-NEXT: [[T1:%.*]] = getelementptr i8* [[EXN]], i32 24
28
Bill Wendling4e1125f2013-02-22 09:10:20 +000029// X86-64: attributes [[NUW]] = { nounwind }
30// X86-32: attributes [[NUW]] = { nounwind }
31// ARM-DARWIN: attributes [[NUW]] = { nounwind }
32// ARM-EABI: attributes [[NUW]] = { nounwind }
33// MIPS: attributes [[NUW]] = { nounwind }