llvm / llvm/llvm-project

[clang-format] AllowShortFunctionsOnASingleLine not respected

Open
#187,993 2 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

I have recently updated clang-format to 22.1.1. I have since experienced unexpected changes in formatting despite maintaining unchanged `.clang-format`. Prior to the update my code (C++) looked as follows:
```cpp
static f64 _determinant2x2(f64 m00, f64 m01, f64 m10, f64 m11)
{
return m00 * m11 - m01 * m10;
}
```
After the update clang-format has been consistently insisting on formatting it as such
```cpp
static f64 _determinant2x2(f64 m00, f64 m01, f64 m10, f64 m11)
{ return m00 * m11 - m01 * m10; }
```
I believe the culprit here is `AllowShortFunctionsOnASingleLine: Empty` which has stopped working.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.