[PATCH] D82594: Clarify a bit the guideline on omitting braces, including more examples (NFC)

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 15:18:14 PDT 2020


mehdi_amini added inline comments.


================
Comment at: llvm/docs/CodingStandards.rst:1623
+  // Use braces for the `if` block to keep it uniform with the else block.
+  if (isa<FunctionDecl>(D)) {
+    handleFunctionDecl(D);
----------------
erichkeane wrote:
> I'll note that this example has been VERY inconsistently enforced.  Typically I've seen the rule in if/else chains be; "Once you START using braces, use them for the rest".
I don't mind much either way on this, I'm trying to make it simpler here. Also there is rarely vertical noise going from:

```
if (...)
  ...
else {
  ...
}
```

to 

```
if (...) {
  ...
} else {
  ...
}
```

(only when adding the ` {` after the `if` goes over 80 chars (same for `} ` in case of `else if`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82594





More information about the llvm-commits mailing list