[PATCH] D16259: Add clang-tidy readability-redundant-return check
Richard via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 19 09:05:54 PST 2016
LegalizeAdulthood added inline comments.
================
Comment at: clang-tidy/readability/RedundantReturnCheck.cpp:24
@@ +23,3 @@
+ functionDecl(isDefinition(), returns(asString("void")),
+ has(compoundStmt(hasAnySubstatement(returnStmt()))))
+ .bind("fn"),
----------------
aaron.ballman wrote:
> Would be best to restrict this to a return statement that has no expression if we don't want to diagnose this:
> ```
> void g();
>
> void f() {
> return g();
> }
> ```
> Either way, it would be good to have a test that ensures this isn't mangled.
How about transforming this odd looking duck into
```
void g();
void f() {
g();
}
```
?
http://reviews.llvm.org/D16259
More information about the cfe-commits
mailing list