[clang] [clang-format] Recognize more braced initializers (PR #192299)

via cfe-commits cfe-commits at lists.llvm.org
Sat May 9 19:46:03 PDT 2026


sstwcw wrote:

This patch introduced this problem.

https://github.com/llvm/llvm-project/pull/173152#issuecomment-4403491044

The new behavior seems to be more consistent.  When the declaration is in a function, the closing brace is always lined up with the name, or the stuff inside the braces minus the continuation width.

Should I make the closing brace line up with the start of the line both outside and inside functions?

old

```C++
x //
    x[] = {
        //
        0,
};

void x() {
  x //
      x[] = {
          //
          0,
      };
}
```

new

```C++
x //
    x[] = {
        //
        0,
    };

void x() {
  x //
      x[] = {
          //
          0,
      };
}
```


https://github.com/llvm/llvm-project/pull/192299


More information about the cfe-commits mailing list