[PATCH] D126512: [Docs] Clarify the guideline on omitting braces

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 23:52:09 PDT 2022


mehdi_amini added a comment.

In D126512#3541698 <https://reviews.llvm.org/D126512#3541698>, @lattner wrote:

> This makes sense to me.  do/while loops are rare, and because the condition comes after the body, they are structurally different than the other loops and conditionals.

Did you notice the other change in the revision?



================
Comment at: llvm/docs/CodingStandards.rst:1596-1597
 
-This list is not exhaustive, for example, readability is also harmed if an
+Similarly, braces should be used when a single-statement body can't fit on a
+single line; otherwise, it would be difficult to see where the block containing
+the following statement began. An ``if``/``else`` chain or a loop is considered
----------------
This is new and seems overly restrictive to me, why this new change?


================
Comment at: llvm/docs/CodingStandards.rst:1633
-      if (shouldProcessAttr(A))
-        handleAttr(A);
   }
----------------
This example shows how this revision goes beyond do/while.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126512/new/

https://reviews.llvm.org/D126512



More information about the llvm-commits mailing list