[PATCH] tsan: support C++ exceptions

Reid Kleckner rnk at google.com
Mon Jun 29 09:59:18 PDT 2015


On Mon, Jun 29, 2015 at 9:50 AM, Dmitry Vyukov <dvyukov at google.com> wrote:

> > You could also insert your code before every 'resume' if you want to
> avoid dealing branches, phis, etc.
>
>
> I don't think it's that simple. A function may not have any landing pads
> yet (no dtors/catches).


Right, you can simplify things by promoting calls to
invoke+landingpad+resume first.


> > First, find all call insts that might throw. If there are any, create a
> new landingpad for them.
>
>
> What if the code is:
>
> void foo() {
>
>   try {
>     bar();
>   } catch (...) {
>     ...
>   }
>
> }
>
> 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.
> Is it correct?


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150629/9bdfc815/attachment.html>


More information about the llvm-commits mailing list