[llvm-bugs] [Bug 42722] New: [Formatter/C++] Incorrect indentation in bodies of multiple chained lambdas

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 23 07:19:29 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: modocache at gmail.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190723/a6a29b69/attachment.html>


More information about the llvm-bugs mailing list