Skip to content

style: How to format multi-line if condition with clang-format? #21735

@maflcko

Description

@maflcko

Usually clang-format is overall producing a nice formatting style. However, it doesn't handle multi-line if conditions well.

Currently it will put the condition as well as the true-block on the same indentation. Making them appear to be one block. This isn't nice to the eye and I wouldn't be surprised if it lead to bugs eventually.

Example:

    if (IsThisTrue() ||
        IsThatTrue()) {
        DoThis;
        DoThat;
    }

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