[clang-format] New line after multi-line if statements

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[clang-format] New line after multi-line if statements

Tom Stellard via cfe-dev

I have set up clang-format using "BreakBeforeBraces: Stroustrup", this formats if
statements as follows:

if (str == "some string") {
    str = "update str";

This is great, it's the coding convention we use in our C++ code base. However in
our code base we allow the opening brace to be on a new line for multi-line if
statements because this improves the code readability:

if (str1 == "some string" ||
    str2 == "some string" ||
    str3 == "some string")
    str = "update str";

Is there a way to configure clang-format so that it accepts the "new line before
opening brace" for multi-line if statements (while still using "no new line before
opening brace" by default)?

cfe-dev mailing list
[hidden email]