[llvm] r228745 - Now use the __debugbreak intrinsic instead of calling RaiseException; it requires no forward declares and still calls VEH.
Aaron Ballman
aaron at aaronballman.com
Tue Feb 10 13:13:05 PST 2015
Author: aaronballman
Date: Tue Feb 10 15:13:04 2015
New Revision: 228745
URL: http://llvm.org/viewvc/llvm-project?rev=228745&view=rev
Log:
Now use the __debugbreak intrinsic instead of calling RaiseException; it requires no forward declares and still calls VEH.
Modified:
llvm/trunk/include/llvm/Support/Compiler.h
Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=228745&r1=228744&r2=228745&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Tue Feb 10 15:13:04 2015
@@ -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
More information about the llvm-commits
mailing list