diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2015-02-09 23:11:39 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2015-02-09 23:11:39 +0000 |
commit | d3023547157783f6370cb9c8b39f0232ff1a4ced (patch) | |
tree | b605bf27869ff35e3b6cc7e1dcddb464c76d80b0 | |
parent | 4282e7cffd6e4a6730e837aba0ef430aba3cf247 (diff) | |
download | bcm5719-llvm-d3023547157783f6370cb9c8b39f0232ff1a4ced.tar.gz bcm5719-llvm-d3023547157783f6370cb9c8b39f0232ff1a4ced.zip |
On Windows, we now use RaiseException to generate the kind of trap we require (one which calls our vectored exception handler), and fall back to using a volatile write to simulate a trap elsewhere.
llvm-svn: 228628
-rw-r--r-- | llvm/include/llvm/Support/Compiler.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h index 77e442b581d..69c74462cc4 100644 --- a/llvm/include/llvm/Support/Compiler.h +++ b/llvm/include/llvm/Support/Compiler.h @@ -287,6 +287,14 @@ /// 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 |