From: Aaron Ballman Date: Tue, 10 Feb 2015 14:28:11 +0000 (+0000) Subject: Re-committing r228628 with a fix for 64-bit builds. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8be10589466719705338a32d1d46ef4c24a6c92f;p=oota-llvm.git Re-committing r228628 with a fix for 64-bit builds. 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228691 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index 77e442b581d..536f02ff5b8 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -287,6 +287,19 @@ /// 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(0xDEADD0D0, 0x1 /*EXCEPTION_NONCONTINUABLE*/, 0, nullptr);\ + __assume(false); \ + } while (0) #else # define LLVM_BUILTIN_TRAP *(volatile int*)0x11 = 0 #endif