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

            Bug ID: 42722
           Summary: [Formatter/C++] Incorrect indentation in bodies of
                    multiple chained lambdas
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

clang-format, using LLVM Style, suggests no changes to the following code:

```
test() {
  int c = 19;
  int d = 32;
  Executor ex;
  ex.addFuture([]() {
      throw std::runtime_error(\"oops\");
    }).then([](Result &&result) {
    c++;
    d++
  });
}
```

I would argue the indentation on the last few lines -- `c++`, `d++`, and `});`
-- is not ideal. I think the following formatting should be applied:

```
test() {
  int c = 19;
  int d = 32;
  Executor ex;
  ex.addFuture([]() {
      throw std::runtime_error(\"oops\");
    }).then([](Result &&result) {
      c++;
      d++
    });
}
```

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to