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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 1 07:32:03 PST 2016


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

With one small nit to the diagnostic wording for consistency, LGTM! I will go ahead and make that change, then commit on your behalf. You may want to talk to Chris Lattner about getting commit privileges, if you'd like them.


================
Comment at: clang-tidy/readability/RedundantControlFlowCheck.cpp:25
@@ +24,3 @@
+    "redundant return statement at the end of function returning void";
+const char *const RedundantContinueDiag =
+    "redundant continue statement at the end of loop statement";
----------------
Our usual diagnostic terminology for this is "void return type" instead of "returning void".

================
Comment at: clang-tidy/readability/RedundantControlFlowCheck.cpp:60
@@ +59,3 @@
+  if (const auto *Return = dyn_cast<ReturnStmt>(*last))
+    issueDiagnostic(Result, Block, Return->getSourceRange(),
+                    RedundantReturnDiag);
----------------
It is the LLVM coding style (though I don't personally care for it), and you are right -- a clang-tidy check in the LLVM module wouldn't be amiss. :-)


http://reviews.llvm.org/D16259





More information about the cfe-commits mailing list