llvm-project
llvm-project copied to clipboard
Continuation indent width clang-format 14 regression
Given test.cpp:
void foo() {
std::ostringstream outStream;
json outJSON = {
{ "type", "asdf"},
{ "name", "asdfasdfasdfsadfasdfasdf"},
{"callback", "asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsadfasdf"},
{ "items", foobar}
};
}
and _clang-format
---
BasedOnStyle: Google
IndentWidth: 4
AlignArrayOfStructures: Right
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: Consecutive
...
With clang-format 13, we get:
void foo() {
std::ostringstream outStream;
json outJSON = {
{ "type", "asdf"},
{ "name", "asdfasdfasdfsadfasdfasdf"},
{"callback", "asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsadfasdf"},
{ "items", foobar}
};
}
With clang-format 14, we get:
void foo() {
std::ostringstream outStream;
json outJSON = {
{ "type", "asdf"},
{ "name", "asdfasdfasdfsadfasdfasdf"},
{"callback", "asdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsadfasdf"},
{ "items", foobar}
};
}
Notice the continuation indent is wrong. Note, if you remove the AlignConsecutiveDeclarations: Consecutive specification, then
clang-format 14 matches clang-format 13, which may be a clue as to the source of the regression.
@llvm/issue-subscribers-clang-format