From: Aaron Ballman Date: Tue, 10 Feb 2015 21:13:04 +0000 (+0000) Subject: Now use the __debugbreak intrinsic instead of calling RaiseException; it requires... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a4109ad7b9cf86d38c3130127e3dd6f8cd00b40f;p=oota-llvm.git Now use the __debugbreak intrinsic instead of calling RaiseException; it requires no forward declares and still calls VEH. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228745 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index e0a4e1fc18e..50e74318c02 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -287,19 +287,12 @@ /// which causes the program to exit abnormally. #if __has_builtin(__builtin_trap) || LLVM_GNUC_PREREQ(4, 3, 0) # define LLVM_BUILTIN_TRAP __builtin_trap() -#elif defined(LLVM_ON_WIN32) -#if defined(_WIN64) -extern "C" __declspec(dllimport) void __stdcall RaiseException( - unsigned long, unsigned long, unsigned long, const unsigned long long *); -#else -extern "C" __declspec(dllimport) void __stdcall RaiseException( - unsigned long, unsigned long, unsigned long, const unsigned long *); -#endif -# define LLVM_BUILTIN_TRAP \ - do { \ - ::RaiseException(0x8000DEAD, 0x1 /*EXCEPTION_NONCONTINUABLE*/, 0, nullptr);\ - __assume(false); \ - } while (0) +#elif defined(_MSC_VER) +// The __debugbreak intrinsic is supported by MSVC, does not require forward +// declarations involving platform-specific typedefs (unlike RaiseException), +// results in a call to vectored exception handlers, and encodes to a short +// instruction that still causes the trapping behavior we want. +# define LLVM_BUILTIN_TRAP __debugbreak() #else # define LLVM_BUILTIN_TRAP *(volatile int*)0x11 = 0 #endif