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: unassignedclangb...@nondot.org
          Reporter: jonas.vauthe...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to