[PATCH] D26943: [CodingStandards] Add style guide rule about "if" statements and loops.

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 16:01:38 PST 2016


arsenm added a comment.

In https://reviews.llvm.org/D26943#601970, @MatzeB wrote:

> In https://reviews.llvm.org/D26943#601961, @compnerd wrote:
>
> > Personally, I think I would prefer that we add braces only if one of the bodies of the code path requires it:
>
>
> Just for the sake of discussion (I personally would prefer braces). This would result in this in the extreme case:
>
>   if (foo)
>     for (Baz b : bazes)
>       if (b)
>         ++BCount;
>       else
>         ++NotBCount;
>   else
>     foobar();
>   


+1 for braces


https://reviews.llvm.org/D26943





More information about the llvm-commits mailing list