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

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 18 19:03:53 PDT 2017


thakis created this revision.

This makes -Wunreachable-code work for programs containing SEH (except for __finally, which  is still missing for now).

__try is modeled like try (but simpler since it can only have a single __except or __finally), __except is fairly similar to catch (but simpler, since it can't contain declarations). __leave is implemented similarly to break / continue.

Use the existing addTryDispatchBlock infrastructure (which FindUnreachableCode() in ReachableCode.cpp uses via cfg->try_blocks_begin()) to mark things in the __except blocks as reachable.

Don't add any EH edges to the CFG for SEH. In practice, BuildOpts.AddEHEdges is always false in practice from what I can tell, and with SEH every single stmt would have to get an EH edge.


https://reviews.llvm.org/D36914

Files:
  lib/Analysis/CFG.cpp
  test/Sema/warn-unreachable-ms.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36914.111789.patch
Type: text/x-patch
Size: 8629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170819/d31e2f86/attachment.bin>


More information about the cfe-commits mailing list