[llvm-bugs] [Bug 41676] New: AlignAfterOpenBracket not working when parameters after lambda expression.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 30 13:25:39 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41676

            Bug ID: 41676
           Summary: AlignAfterOpenBracket not working when parameters
                    after lambda expression.
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Tooling
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonas.vautherin at gmail.com
                CC: llvm-bugs at lists.llvm.org

Using this sample code:

```c++
void gets_changed()
{
    sssssssssset_param_async(blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1,
                             [one, two](Argument argggggggggggggg) {
                                something(arg);
                                foo();
                             },
                             bla3);
}

void unchanged()
{
    sssssssssset_param_async(blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1,
                             [one, two](Argument argggggggggggggg) {
                                something(arg);
                                foo();
                             });
}
```

And the following `.clang-format`:

```
Language: Cpp
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
IndentWidth: 4
AlignAfterOpenBracket: Align
ColumnLimit: 80
```

The output of clang-format is:

```
void gets_changed() {
    sssssssssset_param_async(
        blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1,
        [one, two](Argument argggggggggggggg) {
            something(arg);
            foo();
        },
        bla3);
}

void unchanged() {
    sssssssssset_param_async(blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1,
                             [one, two](Argument argggggggggggggg) {
                                 something(arg);
                                 foo();
                             });
}
```

As you can see, `unchanged` is not modified, but `gets_changed` gets corrected
by clang-format. However, because of `AlignAfterOpenBracket: Align` in the
config file, it should always behave like `unchanged()`.

It seems like this started happening with clang-format 8+, for functions that
take a parameter (here `bla3`) after a lambda expression.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190430/5d4e664b/attachment.html>


More information about the llvm-bugs mailing list