[cfe-dev] clang-format chromium ternary operator

Thiago Farina tfransosi at gmail.com
Sat Aug 10 12:06:30 PDT 2013


Hi,

Looks like clang-format for Chromium style is incorrectly formatting
ternary operators (?:)

By Google C++ Style guide, which Chromium code follows:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml?showone=Boolean_Expressions#Boolean_Expressions

The operators should be in the end of the expressions.

But clang-format did this:
https://codereview.chromium.org/21696003/diff/35001/chrome/browser/ui/views/location_bar/location_bar_view.cc#newcode1107

According to the style guide and Peter it should have been formatted like this:

return (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) ?
    GetItemPadding() / 2 : 0;

--
Thiago



More information about the cfe-dev mailing list