[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CodeGen / windows-seh-abnormal-exits.c
blob1f1f29f676791ceda4b84a1f589f9f7c4ebf9b67
1 // RUN: %clang_cc1 -triple x86_64-windows -fms-extensions -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck %s
3 // CHECK: %[[src:[0-9-]+]] = call ptr @llvm.localaddress()
4 // CHECK-NEXT: %cleanup.dest = load i32, ptr %cleanup.dest.slot, align 4
5 // CHECK-NEXT: %[[src2:[0-9-]+]] = icmp ne i32 %cleanup.dest, 0
6 // CHECK-NEXT: %[[src3:[0-9-]+]] = zext i1 %[[src2]] to i8
7 // CHECK-NEXT: call void @"?fin$0@0@seh_abnormal_exits@@"(i8 noundef %[[src3]], ptr noundef %[[src]])
9 void seh_abnormal_exits(int *Counter) {
10 for (int i = 0; i < 5; i++) {
11 __try {
12 if (i == 0)
13 continue; // abnormal termination
14 else if (i == 1)
15 goto t10; // abnormal termination
16 else if (i == 2)
17 __leave; // normal execution
18 else if (i == 4)
19 return; // abnormal termination
21 __finally {
22 if (AbnormalTermination()) {
23 *Counter += 1;
26 t10:;
28 return; // *Counter == 3