[PATCH] D51812: Simplify CheckFallThroughForBody

Geoffrey Romer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 7 13:50:30 PDT 2018


gromer created this revision.
gromer added a reviewer: rsmith.
Herald added subscribers: cfe-commits, modocache.

Split CheckFallThroughForBody into separate implementations for blocks, lambdas, coroutines, and all other functions. This simplifies the code because  virtually every part of it varies depending on what kind of function is being processed; it's both clearer and safer to branch once at the beginning, rather than branch repeatedly (sometimes on subtly different conditions) and/or rely on layers of indirection. Notice, for example, how this refactoring surfaces the inconsistency between the fast and slow paths for coroutines, and enables the fast-path condition for functions to take advantage of more information about what kinds of diagnostics the slow path can produce (see specifically how SuggestNoReturn now feeds into the early-return condition).


Repository:
  rC Clang

https://reviews.llvm.org/D51812

Files:
  b/llvm/tools/clang/lib/Sema/AnalysisBasedWarnings.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51812.164502.patch
Type: text/x-patch
Size: 15934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180907/2189b3e1/attachment-0001.bin>


More information about the cfe-commits mailing list