[PATCH] D36914: Implement CFG construction for __try / __except / __leave.

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 08:34:29 PDT 2017


On Tue, Aug 22, 2017 at 9:23 PM, Reid Kleckner via Phabricator via
cfe-commits <cfe-commits at lists.llvm.org> wrote:

> rnk accepted this revision.
> rnk added a comment.
> This revision is now accepted and ready to land.
>

311561, thanks!


> Looks good!
>
>
>
> ================
> Comment at: test/Sema/warn-unreachable-ms.c:42
> +  }
> +}
> ----------------
> rnk wrote:
> > Can we add a test to exercise that this builds the right CFG?
> > ```
> > __try {
> >   __try {
> >     f();
> >   } __except(1) {
> >     __leave; // should exit outer try
> >   }
> >   __leave;
> >   f(); // expected-warning{{never be executed}}
> > } __except(1) {
> > }
> > ```
> > Sure. Did you intentionally put two __leaves in there, or do you only
> want the one in the inner __except?
>
> I think both are required to trigger the warning in case f() doesn't
> throw, but I could be wrong.
>

Oh, that way round. But if f() throws and I omit the first __leave, then
the __except() block will just do nothing and fall through to the second
__leave and we'll still get the warning, right?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170823/85be1e1b/attachment.html>


More information about the cfe-commits mailing list