[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

Louis Dionne via cfe-dev
Hi,

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

if (str == "some string") {
    process(str);
    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")
{
    process(str);
    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]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev