[PATCH] D41456: [clang-tidy] readability-else-after-return: also diagnose noreturn function calls.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 20 12:00:36 PST 2017
aaron.ballman added inline comments.
================
Comment at: clang-tidy/readability/ElseAfterReturnCheck.cpp:43
+ for (const auto *BindingName :
+ {"return", "continue", "break", "throw", "noreturn call"})
if (Result.Nodes.getNodeAs<Stmt>(BindingName))
----------------
You've spotted the downside to this clever construct -- it is hard to make the wording not terrible here. :-)
I think the diagnostic should read `do no use 'else' after a call to a function that does not return`. This is trickier because the current `%0` is always quoted.
================
Comment at: docs/ReleaseNotes.rst:189
+- The 'readability-else-after-return' check was adjusted to handle throw expressions that require cleanups, calls to functions marked with noreturn attribute.
+
----------------
This seems to be > 80 cols, so please reformat. Also, it should be "that require cleanups and calls to functions marked with the noreturn attribute" (fixes a few grammatical issues at once).
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D41456
More information about the cfe-commits
mailing list