Clang Project

clang_source_code/test/CodeGenCXX/mingw-w64-seh-exceptions.cpp
1// RUN: %clang_cc1 %s -fexceptions -fseh-exceptions -emit-llvm -triple x86_64-w64-windows-gnu -o - | FileCheck %s --check-prefix=X64
2// RUN: %clang_cc1 %s -fexceptions -fdwarf-exceptions -emit-llvm -triple i686-w64-windows-gnu -o - | FileCheck %s --check-prefix=X86
3// RUN: %clang_cc1 %s -fexceptions -emit-llvm -triple i686-w64-windows-gnu -o - | FileCheck %s --check-prefix=X86
4
5extern "C" void foo();
6extern "C" void bar();
7
8struct Cleanup {
9  ~Cleanup() {
10    bar();
11  }
12};
13
14extern "C" void test() {
15  Cleanup x;
16  foo();
17}
18
19// X64: define dso_local void @test()
20// X64-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_seh0 to i8*)
21// X64: invoke void @foo()
22// X64: landingpad { i8*, i32 }
23
24// X86: define dso_local void @test()
25// X86-SAME: personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
26// X86: invoke void @foo()
27// X86: landingpad { i8*, i32 }
28