Skip to content

[clang-format] Support generators in C++ #38257

Closed
@def-

Description

@def-
Bugzilla Link 38909
Version 7.0
OS Linux
CC @dwblaikie

Extended Description

We use lambdas to write code like:

int main()
{
    int newValue;
    If(match, [&]() {
        newValue = false;
    }).ElseIf(match2, [&]() {
        newValue = true;
    }).Else([&]() {
        newValue = false;
    });
}

Unfortunately clang-format since version 5 started indenting the ElseIf:

$ clang-format -style webkit x.cpp

int main()
{
    int newValue;
    If(match, [&]() {
        newValue = false;
    })
        .ElseIf(match2, [&]() {
            newValue = true;
        })
        .Else([&]() {
            newValue = false;
        });
}

I couldn't find an option to turn this behaviour off.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang-formatquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions