[PATCH] D23265: [clang-tidy] enhance readability-else-after-return

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 05:11:35 PDT 2016


aaron.ballman added inline comments.

================
Comment at: docs/clang-tidy/checks/readability-else-after-return.rst:8
@@ +7,3 @@
+reduce indentation where possible and where it makes understanding code easier.
+Early exit is one of the suggested enforcement of that. Please do not use `else`
+or `else if` after something that interrupts control flow - like `return`,
----------------
enforcements (plural)

================
Comment at: docs/clang-tidy/checks/readability-else-after-return.rst:10
@@ -6,1 +9,3 @@
+or `else if` after something that interrupts control flow - like `return`,
+`break`, `continue`, `throw`, etc.
 
----------------
I would remove the "etc", since this check does not handle such cases.

================
Comment at: docs/clang-tidy/checks/readability-else-after-return.rst:12
@@ -6,3 +11,3 @@
 
-Flags the usages of ``else`` after ``return``.
+Following piece of code illustrates how check would work. This piece of code:
 
----------------
Following -> The following
check would work -> the check works

================
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) {
----------------
Since we're talking about LLVM coding conventions, can you format this like LLVM code (elide braces, etc)?

================
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:
> 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.


https://reviews.llvm.org/D23265





More information about the cfe-commits mailing list