<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jun 29, 2015 at 9:50 AM, Dmitry Vyukov <span dir="ltr"><<a href="mailto:dvyukov@google.com" target="_blank">dvyukov@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> You could also insert your code before every 'resume' if you want to avoid dealing branches, phis, etc.<br>
<br>
<br>
</span>I don't think it's that simple. A function may not have any landing pads yet (no dtors/catches).</blockquote><div><br></div><div>Right, you can simplify things by promoting calls to invoke+landingpad+resume first.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> First, find all call insts that might throw. If there are any, create a new landingpad for them.<br>
<br>
<br>
</span>What if the code is:<br>
<br>
void foo() {<br>
<br>
  try {<br>
    bar();<br>
  } catch (...) {<br>
    ...<br>
  }<br>
<br>
}<br>
<br>
I think it will be wrong to add a __tsan_func_exit cleanup to bar (or extend the existing catch landing pad), because control does not leave the function.<br>
Is it correct?</blockquote><div><br></div><div>In this example, there will be no 'resume' instruction, so there will be no place to insert the code. You can avoid marking catch-all lpads as having cleanups, but it won't matter much either way.</div></div></div></div>