[PATCH] D51812: Simplify CheckFallThroughForBody

Geoffrey Romer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 21 11:31:43 PDT 2018


gromer added inline comments.


================
Comment at: b/llvm/tools/clang/lib/Sema/AnalysisBasedWarnings.cpp:601
+    case MaybeFallThrough:
+      if (ReturnsValue)
+        S.Diag(RBrace, diag::warn_maybe_falloff_nonvoid_coroutine)
----------------
rsmith wrote:
> This `if` and the one below are redundant now.
Leaving aside the mismatch between the locations passed to `isIgnored` and `Diag`, I believe this `if` still has an observable effect (namely suppressing the diagnostic) in the case where `ReturnsValue` is false, `HasNoReturnAttr` is true, and neither diagnostic is ignored.

Even if I'm wrong about that, it's not clear to me whether the error is here or in the early return condition (as noted in the FIXME above, the two do not appear to match up).


https://reviews.llvm.org/D51812





More information about the cfe-commits mailing list