Skip to content

[clang-format] AlignAfterOpenBracket: BlockIndent not applied to control structures #79176

@flyx

Description

@flyx

The documentation says that AlignAfterOpenBracket

only applies to braced initializer lists (when Cpp11BracedListStyle is true) and parentheses.

However, when I set it to BlockIndent, it doesn't apply to control structures in C++ even though they use parentheses. Instead of the current result of clang-format:

for (int someIterationValueWithLongName = 1;
     someIterationValueWithLongName < 10;
     someIterationValueWithLongName++) {
    // ...
}

based on the documentation, I expected to get this:

for (
    int someIterationValueWithLongName = 1;
    someIterationValueWithLongName < 10;
    someIterationValueWithLongName++
) {
    // ...
}

Same goes for if and while.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions