llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Clangd format bug

Open kwsp opened this issue 1 year ago • 0 comments

OS: macOS Sonoma Version 14.5, M1 Buggy Clangd: Apple clangd version 15.0.0 (clang-1500.3.9.4)

With this .clang-format

---
BasedOnStyle: LLVM
---

I have this MRE code snippet:

auto func() {
  {
    {
      auto k = [] { return 1; }();
    }
    { auto x = 1; }
  }
  {}
}

Apple clang formats it to

auto func() {
  {{auto k = [] { return 1; }();
}
{ auto x = 1; }
}
{}
}

Homebrew clang-format (Homebrew clang-format version 18.1.7) formats it to this, which seems correct.

auto func() {
  {
    {
      auto k = [] { return 1; }();
    }
    { auto x = 1; }
  }
  {}
}

kwsp avatar Jul 11 '24 07:07 kwsp