Page MenuHomePhabricator

[clang-format] [PR41407] Constructor initializer list indented incorrectly
AbandonedPublic

Authored by MyDeveloperDay on Apr 6 2019, 4:41 AM.

Details

Summary

When using ConstructorInitializerIndentWidth with a value of 0, after the first initializer the members would be incorrectly indented

C++ code to be formatted:
Foo::Foo() :
foo(0),
bar(1) {
}

Incorrectly formatted to:
Foo::Foo() :
foo(0),

bar(1) {

}

This fix addresses this.

I also introduce the VERIFYFORMAT() macro into the tests to allow for the line number of the failure to be printed when the tests fail, when developing tests for this, I found it hard to locate the exact line each time, passing LINE down via the VERIFYFORMAT() macro means you get a clear indication of where its breaking (if someone know a non macro trick for doing this I'd be happy to know it)

Moving forward I'd like to use this in new tests

Diff Detail