[clang] [clang-format] Disable short blocks if brace is on the new line (PR #196021)

Rudolf Lovrenčić via cfe-commits cfe-commits at lists.llvm.org
Tue May 19 03:24:20 PDT 2026


rudolflovrencic wrote:

> 
> > Fixes #183705 and #187993
> 
> Were those regressions?

We are no longer able to achieve this style in clang-format `v22`: 

```cpp
void f()
{
    return;
}

void g(int val)
{
    if (val > 42) { throw 42; }
    return;
}
```

In other words, from `v22` onwards, we cannot have:
- function definitions with a single statement **NOT** be formatted as a single line, **AND**
- braced `if` statements with a single statement be on a single line.

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


More information about the cfe-commits mailing list