erichkeane marked an inline comment as done.
erichkeane 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(D))
+handleFunctionDecl(D);
smeenai w
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(D))
+handleFunctionDecl(D);
I'm late to the party here (and I haven't read the entire
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc08ea0771682: Add to the Coding Standard our that
single-line bodies omit braces (authored by erichkeane).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D8094
hubert.reinterpretcast accepted this revision.
hubert.reinterpretcast added a comment.
This revision is now accepted and ready to land.
This LGTM. I believe we have not heard back from @arsenm on the response to
some of their comments though.
Comment at: llvm/docs/CodingStanda
erichkeane updated this revision to Diff 268433.
erichkeane marked an inline comment as done.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80947/new/
https://reviews.llvm.org/D80947
Files:
llvm/docs/CodingStandards.rst
Index: llvm/docs/CodingStandards.rst
hubert.reinterpretcast added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1576
+
+When writing the body of an `if`, `else`, or loop statement, omit the braces
to avoid
+unnecessary and otherwise meaningless code. However, braces should be used
Ther
erichkeane updated this revision to Diff 268175.
erichkeane added a comment.
Apply @hubert.reinterpretcast s spelling.
I'd also like to re-enforce, the purpose of this patch is simply to write down
the rule that we've been enforcing for years, I don't think we should get novel
with the rules/ch
erichkeane marked 5 inline comments as done.
erichkeane added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1573
+Don't Use Braces on Simple Single-Statement Bodies of if/else/loop Statements
+
arsenm added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1573
+Don't Use Braces on Simple Single-Statement Bodies of if/else/loop Statements
+^
I would rather just ban si
hubert.reinterpretcast added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1578
+unnecessary and otherwise meaningless code. Braces should be used however
+in cases where it significantly improves readability, such as when the single
+statement is accompanied by a co
erichkeane marked 6 inline comments as done.
erichkeane added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1578
+unnecessary and otherwise meaningless code. Braces should be used however
+in cases where it significantly improves readability, such as when the single
erichkeane updated this revision to Diff 267856.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80947/new/
https://reviews.llvm.org/D80947
Files:
llvm/docs/CodingStandards.rst
Index: llvm/docs/CodingStandards.rst
===
--- l
hubert.reinterpretcast added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1582
+clear that it is a single line. Note that comments should only be hoisted for
loops and
+'if', and not in 'else if' or 'else', where it would be unclear whether the
comment
+belonged t
erichkeane updated this revision to Diff 267714.
erichkeane added a comment.
Attempt improvements based on feedback.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80947/new/
https://reviews.llvm.org/D80947
Files:
llvm/docs/CodingStandards.rst
Index: llvm/docs/CodingStandards.rst
===
erichkeane marked 4 inline comments as done.
erichkeane added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1573
+Don't Use Braces on Simple Single-Statement Bodies of if/else/loop Statements
+
jdoerfert added a comment.
Thanks for finally writing this down :) Two minor comments.
Comment at: llvm/docs/CodingStandards.rst:1580
+statement is accompanied by a comment that loses its meaning if hoisted above
the if
+or loop statement, or where the single statement is comp
hubert.reinterpretcast added inline comments.
Comment at: llvm/docs/CodingStandards.rst:1580
+statement is accompanied by a comment that loses its meaning if hoisted above
the if
+or loop statement, or where the single statement is complex enough that it
stops being
+clear that
jroelofs accepted this revision.
jroelofs added a comment.
This revision is now accepted and ready to land.
LGTM
Comment at: llvm/docs/CodingStandards.rst:1582
+clear that it is a single line. Note that comments should only be hoisted for
loops and
+'if', and not in 'else if'
lebedev.ri added a comment.
SGTM
Comment at: llvm/docs/CodingStandards.rst:1573
+Don't Use Braces on Simple Single-Statement Bodies of if/else/loop Statements
+^
`case` too
Reposito
erichkeane created this revision.
erichkeane added reviewers: aaron.ballman, jdoerfert, jroelofs.
Herald added a project: LLVM.
This is a rule that seems to have been enforced for the better part of
the decade, so we should document it for new contributors.
Repository:
rG LLVM Github Monorepo
20 matches
Mail list logo