<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/117477>117477</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Linebreaks and indentation change when updating from v18.1.8 -> v19.1.5
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          RainerKuemmerle
      </td>
    </tr>
</table>

<pre>
    I noticed that in my code, clang-format v19.1.3 behaves very different with the same settings.

An excerpt from the formatting changes.

v18.1.8
```cpp
namespace g2o {

class G2O_STUFF_API Sampler {
 public:
  /** seed the random number generator */
  static void seedRand(unsigned int seed) {
 std::srand(seed);
  }
};

}  // namespace g2o
...
```

v19.1.5
```cpp
namespace g2o {

class G2O_STUFF_API
Sampler{public :
            /** seed the random number generator */
            static void seedRand(unsigned int seed){std::srand(seed);
}
}
;

}  // namespace g2o
```

The `.clang-format` file is
```
BasedOnStyle: Google
DerivePointerAlignment: false
```

I noticed that formatting stays kind of as expected if I do not close the class definition by `};` but just `}` which is non working syntax however.

Locally I am using Ubuntu 24.10 with apt.llvm.org as additional package source.
```
$ clang-format --version
Ubuntu clang-format version 19.1.5 (++20241119043710+51dee6b64fda-1~exp1~20241119163724.28)
```

The same effect can however also be seen when using the pre-commit framework (with a slightly older version of clang-format), e.g., as in this PR of my project:
https://github.com/RainerKuemmerle/g2o/pull/837/files

Please let me know if I should provide additional information. Thanks.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslV-P2jgQwD-NeRkRJc4_eOABylGtrlJX3e1z5diTxMWxI9uB5aWf_eQky8Kq16qni4CQ8Uw88xvPDHNONhpxQ_IdyfcLNvjW2M0XJjXavwfsOrQKF5URl80DaOMlRwG-ZR6khu4C3Agk9ANwxXSzrI3tmIdTso6SKIUKW3ZCBye0FxCyrtGi9nCWvgXf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