<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 24, 2017 at 1:04 PM, Reid Kleckner via Phabricator via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">rnk added a comment.<br>
<br>
Re: jumps out of __try, I wonder if you can tie __finally into whatever the CFG does for C++ destructors.<br></blockquote><div><br></div><div>Given</div><div>$ cat test.cc</div><div>struct C {</div><div>  C();</div><div>  ~C();</div><div>};</div><div><br></div><div>bool g();</div><div>void h();</div><div><br></div><div>void f() {</div><div>  C c;</div><div>  if (g())</div><div>    return;</div><div><br></div><div>  h();</div><div>} </div><div><br></div><div>Then `bin/clang-cl /c test.cc -Xclang -analyze -Xclang -analyzer-checker=debug.ViewCFG` produces this CFG: <a href="http://imgur.com/SoGSFNY">http://imgur.com/SoGSFNY</a></div><div><br></div><div>So it looks like dtor calls just get duplicated into every branch end at the moment, instead of producing proper cleanup blocks like codegen does :-/ Since the __finally body isn't callable, this won't work. I think I'll try to implement something like codegen's cleanup stuff (EmitBranchThroughCleanup etc) and use that for __finally, and maybe we can then use that for dtors some time later too. And maybe we can even use the CFG for codegen one day.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
<br>
================<br>
Comment at: test/Sema/warn-unreachable-ms.<wbr>c:49<br>
     __try {<br>
-      f();<br>
+      throw 1;<br>
     } __except (1) {<br>
----------------<br>
Nice. Would any noreteurn call work here to eliminate the re-run and ifdef?<br></blockquote><div><br></div><div>Nice, that works. Just `f(); return;` instead of `throw 1;` does the trick. (Call to f() isn't really needed but without it the test case is confusing to humans – how could the __except possibly be entered?)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
<a href="https://reviews.llvm.org/D37090" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D37090</a><br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>