1 // RUN: %clang_cc1 -triple x86_64-unknown-linux -emit-llvm -DUNWIND -fcxx-exceptions -fexceptions -o - %s | FileCheck -check-prefixes CHECK,CHECK-UNWIND %s 2 // RUN: %clang_cc1 -triple x86_64-unknown-linux -emit-llvm -fcxx-exceptions -fexceptions -o - %s | FileCheck -check-prefixes CHECK,CHECK-NO-UNWIND %s 3 4 extern "C" void printf(const char *fmt, ...); 5 6 struct DropBomb { 7 bool defused = false; 8 9 ~DropBomb() { 10 if (defused) { 11 return; 12 } 13 printf("Boom!\n"); 14 } 15 }; 16 17 extern "C" void trap() { 18 throw "Trap"; 19 } 20 21 // CHECK: define dso_local void @test() 22 extern "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 UNWIND 27 asm volatile("call trap" :: 28 : "unwind"); 29 #else 30 asm volatile("call trap" :: 31 :); 32 #endif 33 bomb.defused = true; 34 } 35