[PATCH] PR19958 wrong code at -O1 and above on x86_64-linux-gnu (InstCombine)
Duncan P. N. Exon Smith
dexonsmith at apple.com
Thu Jul 17 09:47:09 PDT 2014
> On 2014-Jul-14, at 02:13, Nick Lewycky <nicholas at mxc.ca> wrote:
>
> There isn't any guidance on this in the coding standards, but I think it's good form to have braces in
>
> if (expr) {
> // comment
> statement;
> }
>
> even if you insist on removing them in
>
> if (expr) {
> statement;
> }
>
> . The idea is that the comment could be mistaken for the one statement consumed by the if.
>
> I also like to avoid braces around single statement blocks, but I still put them in when the statement itself is more than one line due to 80-col wrapping. This is harder to justify than the comment case, it just looks better.
>
> Nick
I disagree about which one looks better (and about how clear it is), but
you're right that there isn't guidance in the coding standards.
Suyog, feel free to re-add the braces if you agree with Nick. I should
get a chance to look at your most recent patch later this week.
More information about the llvm-commits
mailing list