[llvm-bugs] [Bug 50930] New: clang-format: Inconsistent single-line lambda formatting

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 29 06:04:04 PDT 2021


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

            Bug ID: 50930
           Summary: clang-format: Inconsistent single-line lambda
                    formatting
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: kalinnikov at seaproject.ru
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

Adding an empty line inside a lambda body changes the output of clang-format.

Feeding the output of clang-format into clang-format again produces a different
result.

---
.clang-format:
BreakBeforeBraces: Custom
BraceWrapping:
  BeforeLambdaBody: true

---
test.cpp:
int main() {
  std::vector<int> v;
  std::find_if(v.begin(), v.end(),
               []
               {
                 return 1;

               });
}

---
clang-format test.cpp:
int main() {
  std::vector<int> v;
  std::find_if(v.begin(), v.end(),
               []
               {
                 return 1;
               });
}

---
clang-format test.cpp | clang-format:
int main() {
  std::vector<int> v;
  std::find_if(v.begin(), v.end(), [] { return 1; });
}

-- 
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/20210629/d3b0f7b2/attachment.html>


More information about the llvm-bugs mailing list