[PATCH] D23265: [clang-tidy] enhance readability-else-after-return
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 10 05:23:50 PDT 2016
alexfh added inline comments.
================
Comment at: clang-tidy/readability/ElseAfterReturnCheck.cpp:40
@@ +39,3 @@
+ for (const auto *BindingName : {"return", "continue", "break", "throw"}) {
+ if (Result.Nodes.getNodeAs<Stmt>(BindingName)) {
+ ControlFlowInterruptor = BindingName;
----------------
No braces around single-line `if` bodies, please. Clang-tidy code is mostly consistent wrt this.
================
Comment at: docs/clang-tidy/checks/readability-else-after-return.rst:14
@@ -8,2 +13,3 @@
-http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
+``` c++
+void foo(int Value) {
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > Since we're talking about LLVM coding conventions, can you format this like LLVM code (elide braces, etc)?
> This is not the proper way to introduce a code block. Should use `.. code-block:: c++` and then indent the code blocks.
I think, the braces are fine, since the example needs to demonstrate that the check is able to remove them.
https://reviews.llvm.org/D23265
More information about the cfe-commits
mailing list