llvm / llvm/llvm-project

[clang-format] AllowShortBlocksOnASingleLine=Always overrides brace wrapping for functions

Open
#183,705 4 comments 3 reactions 0 assignees View on GitHub
clang-format
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

In version 22 `AllowShortBlocksOnASingleLine=Always` overrides
```yaml
BraceWrapping:
AfterFunction: true
```

and results in function bodies being compactified:
```c++
void f()
{return ;}
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported C++ formatting with AllowShortBlocksOnASingleLine=Always and BraceWrapping.AfterFunction=true, then trace the clang-format handling for these two options. Done means the configuration no longer compactifies the function body and preserves the requested brace wrapping.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.