Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / windows-seh-EHa-CppDtors01.cpp
blobc12ae65c23614da34cea0d247aeaaca2db1622b1
1 // RUN: %clang_cc1 -triple x86_64-windows -fasync-exceptions -fcxx-exceptions -fexceptions -fms-extensions -x c++ -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck %s
3 // CHECK: invoke void @llvm.seh.scope.begin()
4 // CHECK: invoke void @llvm.seh.scope.begin()
5 // CHECK: invoke void @llvm.seh.scope.begin()
6 // CHECK: invoke void @llvm.seh.scope.end()
7 // CHECK: invoke void @llvm.seh.scope.end()
8 // CHECK: invoke void @llvm.seh.scope.end()
10 // CHECK: invoke void @llvm.seh.try.begin()
11 // CHECK: %[[src:[0-9-]+]] = load volatile i32, ptr %i
12 // CHECK-NEXT: invoke void @"?crash@@YAXH@Z"(i32 noundef %[[src]])
13 // CHECK: invoke void @llvm.seh.try.end()
15 // ****************************************************************************
16 // Abstract: Test CPP unwind Dtoring under SEH -EHa option
18 void printf(...);
19 int volatile *NullPtr = 0;
20 void crash(int i) {
21 struct A {
22 ~A() {
23 printf(" in A dtor \n");
25 } ObjA;
26 if (i == 0)
27 *NullPtr = 0;
29 struct B {
30 ~B() {
31 printf(" in B dtor \n");
33 } ObjB;
34 if (i == 1)
35 *NullPtr = 0;
37 struct C {
38 ~C() {
39 printf(" in C dtor \n");
41 } ObjC;
42 if (i == 2)
43 *NullPtr = 0;
46 #define TRY __try
47 #define CATCH_ALL __except (1)
49 int g;
50 int main() {
51 for (int i = 0; i < 3; i++) {
52 TRY {
53 crash(i);
55 CATCH_ALL {
56 printf(" Test CPP unwind: in catch handler i = %d \n", i);
59 return 0;