<div dir="ltr">In fact none of this is in the style guide itself, it's just lore and the usual argument for consistency with surrounding code.<br><br>There are many examples of most points on this spectrum - the generally agreed upon bit is "single line blocks (without connected/related blocks - like else, etc) shouldn't have braces". Whether you brace multiline, single statement blocks, or brace all related blocks if one of them is braced, is much more variable and I generally leave up  to the author unless there's some really clear consistency argument to be made.<br><br><div class="gmail_quote"><div dir="ltr">On Thu, Mar 1, 2018 at 6:58 AM Alexey Bataev via Phabricator via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">ABataev added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D43627#1022846" rel="noreferrer" target="_blank">https://reviews.llvm.org/D43627#1022846</a>, @JDevlieghere wrote:<br>
<br>
> I really hate to go on about this, but the truth is that I've been told this so many times that it instantly caught my eye. 😀<br>
<br>
<br>
<br>
<br>
1. Several years ago I got a lot of reviews where reviewers insisted(!!!) to enclose multiline (not multistatement!!!) single-statement substatements into braces. I did for the last 6 years and had no problems with it. This is the first time I see this. Di I miss something, the rules changed already?<br>
2. There is a patch <a href="https://reviews.llvm.org/D26943" rel="noreferrer" target="_blank">https://reviews.llvm.org/D26943</a>, that was accepted but not committed to enclosing multiline (not multistatement) substatements in `if` and `for` statements. It is clear that multistatement substatements must be enclosed and this kind of rule is not required at all.<br>
<br>
I'm not against this kind of change but seems to me this is not strictly standardized.<br>
<br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D43627" rel="noreferrer" target="_blank">https://reviews.llvm.org/D43627</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>