Skip to content

[clang-format] Possible regression in clang-format-22? #157654

@prj-

Description

@prj-

I'm not sure which version is right, and which version is wrong. What do you think?

$ cat foo.c
static int foo(bool bar)
{
  return bar ? 0 : 1;
}
$ clang-format --style=file:clang-format.txt foo.c
static int foo(bool bar)
{
  return bar ? 0 : 1;
}
$ clang-format --version
clang-format version 21.1.0
$ clang-format-22 --style=file:clang-format.txt foo.c
static int foo(bool bar)
{ return bar ? 0 : 1; }
$ clang-format-22 --version
Debian clang-format version 22.0.0 (++20250908112350+a80c393a9c49-1~exp1~20250908112511.1692)

The faulty line is the first one from clang-format.txt, if it's commented out, then clang-format-22 formats the same as clang-format-21.

clang-format.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang-formatquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions