[PATCH] D16259: Add clang-tidy readability-redundant-return check
Richard via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 19 11:16:54 PST 2016
LegalizeAdulthood 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) {
----------------
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 :).
http://reviews.llvm.org/D16259
More information about the cfe-commits
mailing list