[PATCH] D146466: [clang] diagnose function fallthrough

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 16:24:19 PDT 2023


efriedma added a comment.

I'm concerned about the potential for false positives:

- If a user doesn't mark a function noreturn, but it doesn't actually ever return.
- A function is conditionally broken, but the condition is never actually true (for example, jump threading creates a dead codepath).
- A function might actually be unconditionally broken, but it doesn't matter because it never actually gets called.  This can easily happen with C++ templates, or an "outlining" optimization on LLVM IR.

For some of these situations, there are somewhat straightforward workarounds we can suggest for users... but in some cases, there aren't.  I really don't want to to implement warnings where the best suggestion we can make to fix the warning is "Try refactoring your code; it might go away".


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146466/new/

https://reviews.llvm.org/D146466



More information about the cfe-commits mailing list