Hi!
Over at cxx@ we've discussed adding
{}s unconditionally to if statements, one of the arguments being that {}s can be inserted by
git cl format.
Historically the Google style guide has preferred braceless ifs, but have now transitioned over to preferring braces even to short if statements, with historical exceptions for braceless ifs that may be decided on a per-project basis. We've decided to not make use of that historical exception as clang-format as a tool can help us be consistent and spend less time considering these in code review.
The first land attempt as
crrev.com/c/4048911 got reverted as
crrev.com/c/4076867 two hours later, because a bug in upstream clang-format when formatting partial files. We believe this has been resolved upstream, since October, as
https://github.com/llvm/llvm-project/issues/58161 which has been rolled into Chromium. I've tried to break control flow by modifying parts of braceless if-else statements that are already checked into chromium, and have been unable to do so. I will now attempt a reland as
crrev.com/c/4097043, but if you see git cl format break control flow, please revert this reland immediately and file another
crbug.com.
Thanks folks,
Peter