On Windows, we now use RaiseException to generate the kind of trap we require (one...
authorAaron Ballman <aaron@aaronballman.com>
Mon, 9 Feb 2015 23:11:39 +0000 (23:11 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Mon, 9 Feb 2015 23:11:39 +0000 (23:11 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228628 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Compiler.h

index 77e442b581da175d8405f55257418a3cd92fb57a..69c74462cc4bb690b77f2d683d7729dddbc2c6b0 100644 (file)
 /// 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)
+extern "C" __declspec(dllimport) void __stdcall RaiseException(
+    unsigned long, unsigned long, unsigned long, const unsigned long *);
+#define LLVM_BUILTIN_TRAP                                                      \
+  do {                                                                         \
+    ::RaiseException(0xDEADD0D0, 0x1 /*EXCEPTION_NONCONTINUABLE*/, 0, nullptr);\
+    __assume(false);                                                           \
+  } while (0)
 #else
 # define LLVM_BUILTIN_TRAP *(volatile int*)0x11 = 0
 #endif