[all-commits] [llvm/llvm-project] 3d5613: [Docs] Clarify the guideline on omitting braces

Owen via All-commits all-commits at lists.llvm.org
Tue May 31 23:35:56 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d56131bf6dd41449390ab551337540bbbe04402
      https://github.com/llvm/llvm-project/commit/3d56131bf6dd41449390ab551337540bbbe04402
  Author: owenca <owenpiano at gmail.com>
  Date:   2022-05-31 (Tue, 31 May 2022)

  Changed paths:
    M llvm/docs/CodingStandards.rst

  Log Message:
  -----------
  [Docs] Clarify the guideline on omitting braces

While working on a clang-format option RemoveBracesLLVM that removes
braces following the guideline, we were unsure about what to do with
the braces of do-while loops. The ratio of using to omitting the
braces is about 4:1 in the llvm-project source, so it will help to
add an example to the guideline.

Also cleans up the original examples including making the nested if
example more targeted on avoiding potential dangling else situations.

Differential Revision: https://reviews.llvm.org/D126512




More information about the All-commits mailing list