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

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 09:11:47 PDT 2017


rnk added inline comments.


================
Comment at: test/Sema/warn-unreachable-ms.c:42
+  }
+}
----------------
rnk wrote:
> 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.
I woke up this morning and realized what you meant. Is there another way we can check that __leave in __except exits the outer __try?


https://reviews.llvm.org/D36914





More information about the cfe-commits mailing list