Debian Codegraph @

clang/test/CodeGenCXX/sizeof-unwind-exception.cpp

raw
1 // 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 // RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -fcxx-exceptions -fexceptions -exception-model=seh %s -O2 -o - | FileCheck %s --check-prefix=MINGW-X86-64
7 // RUN: %clang_cc1 -triple thumbv7-windows-gnu -emit-llvm -fcxx-exceptions -fexceptions -exception-model=seh %s -O2 -o - | FileCheck %s --check-prefix=MINGW-ARMV7
8
9 void foo();
10 void test() {
11 try {
12 foo();
13 } catch (int *&i) {
14 *i = 5;
15 }
16 }
17
18 // PR10789: different platforms have different sizes for struct UnwindException.
19
20 // X86-64: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
21 // X86-64-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i64 32
22 // X86-32: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
23 // X86-32-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i64 32
24 // ARM-DARWIN: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
25 // ARM-DARWIN-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i64 32
26 // ARM-EABI: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
27 // ARM-EABI-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i32 88
28 // MIPS: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
29 // MIPS-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i32 24
30 // MINGW-X86-64: [[T0:%.*]] = tail call ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
31 // MINGW-X86-64-NEXT:[[T1:%.*]] = getelementptr i8, ptr [[EXN]], i64 64
32 // MINGW-ARMV7: [[T0:%.*]] = tail call arm_aapcs_vfpcc ptr @__cxa_begin_catch(ptr [[EXN:%.*]]) [[NUW:#[0-9]+]]
33 // MINGW-ARMV7-NEXT: [[T1:%.*]] = getelementptr i8, ptr [[EXN]], i32 48
34
35 // X86-64: attributes [[NUW]] = { nounwind }
36 // X86-32: attributes [[NUW]] = { nounwind }
37 // ARM-DARWIN: attributes [[NUW]] = { nounwind }
38 // ARM-EABI: attributes [[NUW]] = { nounwind }
39 // MIPS: attributes [[NUW]] = { nounwind }
40 // MINGW-X86-64: attributes [[NUW]] = { nounwind }
41 // MINGW-ARMV7: attributes [[NUW]] = { nounwind }