<div dir="ltr">How is raising a 0xdeadd0d0 exception code better than an access violation? The only way I think we could functionally improve over the access violation is to have something that's known noreturn (like __builtin_trap) and encodes smaller, like ud2a.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 9, 2015 at 9:02 AM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The implementation for LLVM_BUILTIN_TRAP on Windows leaves quite a bit<br>
to be desired. Instead of relying on writing to an invalid volatile<br>
pointer, which is hoped to result in raising an exception we can catch<br>
with the vectored exception handler, simply raise an exception<br>
manually.<br>
<br>
To prevent having to #include a Win32 header from Compiler.h, this<br>
patch forward declares the RaiseException call.<br>
<br>
The only functional difference between the current implementation and<br>
the new one is that RaiseException will appear on the stack traces now<br>
when invoking this macro. Eg)<br>
<br>
e:\llvm\2013>clang -fsyntax-only "E:\Aaron Ballman\Desktop\test.cpp"<br>
0x755EC42D (0xDEADD0D0 0x00000001 0x00000000 0x00000000), RaiseException() + 0x5<br>
8 bytes(s)<br>
0x03D9F222 (0x00692018 0x00000000 0x0685E3C4 0x0685E3A0), `anonymous namespace':<br>
:PragmaDebugHandler::HandlePragma() + 0xC2 bytes(s), e:\llvm\llvm\tools\clang\li<br>
b\lex\pragma.cpp, line 870 + 0x13 byte(s)<br>
0x03D997DC (0x00692018 0x00000000 0x0685E3C4 0x0685E494), clang::PragmaNamespace<br>
::HandlePragma() + 0xBC bytes(s), e:\llvm\llvm\tools\clang\lib\lex\pragma.cpp, l<br>
ine 95 + 0x1B byte(s)<br>
...<br>
<br>
instead of:<br>
<br>
e:\llvm\2013>clang -fsyntax-only "E:\Aaron Ballman\Desktop\test.cpp"<br>
0x03CDF1CF (0x00302018 0x00000000 0x0679E5F8 0x0679E5D4), `anonymous namespace':<br>
:PragmaDebugHandler::HandlePragma() + 0xAF bytes(s), e:\llvm\llvm\tools\clang\li<br>
b\lex\pragma.cpp, line 870<br>
0x03CD979C (0x00302018 0x00000000 0x0679E5F8 0x0679E6C8), clang::PragmaNamespace<br>
::HandlePragma() + 0xBC bytes(s), e:\llvm\llvm\tools\clang\lib\lex\pragma.cpp, l<br>
ine 95 + 0x1B byte(s)<br>
...<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span></blockquote></div><br></div>