[PATCH] D80947: Add to the Coding Standard our that single-line bodies omit braces

Shoaib Meenai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 12:37:58 PDT 2020


smeenai added inline comments.


================
Comment at: llvm/docs/CodingStandards.rst:1600
+  // Omit the braces, since the body is simple and clearly associated with the if.
+  if (isa<FunctionDecl>(D))
+    handleFunctionDecl(D);
----------------
I'm late to the party here (and I haven't read the entirety of the previous discussion, sorry), but I thought our rule had always been "if one arm of an if/else requires braces, put braces on all of them". In other words, the `if` and `else if` here should have braces, since the `else` does.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80947





More information about the cfe-commits mailing list