35 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-unknown-linux -emit-llvm -DUNWIND -fcxx-exceptions -fexceptions -o - %s | FileCheck -check-prefixes CHECK,CHECK-UNWIND %s2// RUN: %clang_cc1 -triple x86_64-unknown-linux -emit-llvm -fcxx-exceptions -fexceptions -o - %s | FileCheck -check-prefixes CHECK,CHECK-NO-UNWIND %s3 4extern "C" void printf(const char *fmt, ...);5 6struct DropBomb {7 bool defused = false;8 9 ~DropBomb() {10 if (defused) {11 return;12 }13 printf("Boom!\n");14 }15};16 17extern "C" void trap() {18 throw "Trap";19}20 21// CHECK: define dso_local void @test()22extern "C" void test() {23 DropBomb bomb;24// CHECK-UNWIND: invoke void asm sideeffect unwind "call trap"25// CHECK-NO-UNWIND: call void asm sideeffect "call trap"26#ifdef UNWIND27 asm volatile("call trap" ::28 : "unwind");29#else30 asm volatile("call trap" ::31 :);32#endif33 bomb.defused = true;34}35