<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="FR-CA" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello everyone,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-CA">I was wondering what is the status regarding exceptions for the windows-msvc target? The corresponding part of the documentation (llvm/decs/ExceptionHandling.rst) hasn’t been updated since 2015, was there any progress
 since?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">This is most likely known, but there’s significant divergence between the behavior of MSVC cl.exe and clang-cl.exe:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Consider:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">void</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#880000">crash</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">() {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">  struct</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">A</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"> {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">    ~</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">A</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">()
 {}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">  } Obj;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">  *(</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">volatile</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"> *)0x11 = 0;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:gray">#ifdef</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#A000A0">SEH</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:gray">  #define</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#A000A0">TRY</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">__try</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:gray">  #define</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#A000A0">CATCH_ALL</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">__except</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"> (1)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:gray">#else</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:gray">  #define</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#A000A0">TRY</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">try</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:gray">  #define</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#A000A0">CATCH_ALL</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">catch</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"> (...)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:gray">#endif</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:blue">int</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">
</span><i><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#880000">main</span></i><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">() {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"> 
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#A000A0">TRY</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"> {
</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:#880000">crash</span><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black">(); }<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span lang="EN-CA" style="font-size:9.5pt;font-family:Consolas;color:black"> 
</span><span style="font-size:9.5pt;font-family:Consolas;color:#A000A0">CATCH_ALL</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> {}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black"> 
</span><span style="font-size:9.5pt;font-family:Consolas;color:blue">return</span><span style="font-size:9.5pt;font-family:Consolas;color:black"> 0;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:9.5pt;font-family:Consolas;color:black">}<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:35.4pt"><span style="font-size:9.5pt;font-family:Consolas;color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">using try/catch (SEH not defined):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">         |               (default)               |          /EHa            |          /EHs            |<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">--------------------------------------------------------------------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">MSVC cl  | warning [1], no unwind, crash catched |    unwind, crash catched |          crash unhandled |<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">clang-cl | compilation error [2]                 |          crash unhandled |          crash unhandled |<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">using __try/__except (SEH defined):<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">         |               (default)               |          /EHa            |           /EHs           |<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">--------------------------------------------------------------------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">MSVC cl  |              no unwind, crash catched |    unwind, crash catched |          crash unhandled |<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">clang-cl |              no unwind, crash catched | no unwind, crash catched | no unwind, crash catched |<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">According to Microsoft’s documentation [3],<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">                (default) means:              async exceptions + C++ exceptions, but no unwinding<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">                /EHa means:                      async exceptions + C++ exceptions, with unwinding in both cases<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">                /EHs means:                      C++ exceptions only, with unwinding<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I’m using MSVC VS2017 15.9.16 and clang-cl from github at HEAD. In both cases I’m targeting x64.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Using _set_se_translator [4] and /EHa does not help with clang-cl.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Are there any plans to improve  the async exceptions unwinding in the short term?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Alex.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:9.0pt;font-family:"Courier New";color:black"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">[1] warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New"">[2] error: cannot use 'try' with exceptions disabled<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA" style="font-size:10.0pt;font-family:"Courier New";color:black">[3]
</span><span style="font-size:10.0pt;font-family:"Courier New""><a href="https://docs.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=vs-2019"><span lang="EN-CA">https://docs.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=vs-2019</span></a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New"">[4]
<a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-se-translator?view=vs-2019">
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/set-se-translator?view=vs-2019</a><span style="color:black"><o:p></o:p></span></span></p>
</div>
</body>
</html>