[PATCH] D16259: Add clang-tidy readability-redundant-return check
Kim Gräsman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 19 11:24:49 PST 2016
kimgr added inline comments.
================
Comment at: test/clang-tidy/readability-redundant-return.cpp:21-24
@@ +20,6 @@
+
+void g(int i) {
+ if (i < 0) {
+ return;
+ }
+ if (i < 10) {
----------------
LegalizeAdulthood wrote:
> kimgr wrote:
> > What happens to guard clauses invoking void functions?
> >
> > void h() {
> > }
> >
> > void g(int i) {
> > if(i < 0) {
> > return h();
> > }
> > }
> >
> Nothing because the last statement of the `compoundStmt` that is the function body is an `if` statement and not a `return` statement.
>
> That is exactly why lines 21-24 are in the test suite :).
Ah, I hadn't understood the mechanics of the check. I read the docs, and now I do! Don't mind me :-)
http://reviews.llvm.org/D16259
More information about the cfe-commits
mailing list