[PATCH] D16259: Add clang-tidy readability-redundant-return check

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 07:55:21 PST 2016


alexfh added inline comments.

================
Comment at: clang-tidy/readability/RedundantReturnCheck.cpp:36
@@ +35,3 @@
+    checkRedundantReturn(Result, Fn);
+  } else if (const auto *For = Result.Nodes.getNodeAs<ForStmt>("for")) {
+    checkRedundantContinue(Result, dyn_cast<CompoundStmt>(For->getBody()));
----------------
Maybe just bind the compound statement and get rid of these `if`s?

================
Comment at: test/clang-tidy/readability-redundant-return.cpp:1
@@ +1,2 @@
+// RUN: %check_clang_tidy %s readability-redundant-return %t
+
----------------
Please add tests with macros and templates that ensure:
  * no replacements in macro bodies
  * correct replacements in macro arguments (that are not inside another macro's body)
  * replacements in template bodies with multiple instantiations are applied only once (adding `unless(isInTemplateInstantiation())` filter to the matcher is a usual way to handle this).


http://reviews.llvm.org/D16259





More information about the cfe-commits mailing list