| 1 |
// RUN: %clang_cc1 -triple x86_64-windows -fms-extensions -Wno-implicit-function-declaration -emit-llvm %s -o - | FileCheck %s |
| 2 |
|
| 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]]) |
| 8 |
|
| 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 |
| 20 |
} |
| 21 |
__finally { |
| 22 |
if (AbnormalTermination()) { |
| 23 |
*Counter += 1; |
| 24 |
} |
| 25 |
} |
| 26 |
t10:; |
| 27 |
} |
| 28 |
return; // *Counter == 3 |
| 29 |
} |
| 30 |
|