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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] Regressions with clang-format version 18?
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          prj-
      </td>
    </tr>
</table>

<pre>
    ```
$ cat src.cxx
namespace sycl
{

// internal "impls" class for SyclDevice. Each instance represents a single sycl device
class PETSC_NODISCARD Device::DeviceInternal {
  const int            id_; // -1 for the host device; 0 and up for gpu devices
  bool devInitialized_;
  const ::sycl::device syclDevice_;

public:
 // default constructor
  DeviceInternal(int id) noexcept : id_(id), devInitialized_(false), syclDevice_(chooseSYCLDevice_(id)) { }
  int  id() const { return id_; }
  bool initialized() const { return devInitialized_; }
}
}

struct MatProductData_SeqAIJKokkos {
  KernelHandle kh;
  PetscBool    reusesym;
  MatProductData_SeqAIJKokkos() : reusesym(PETSC_FALSE) { }
};

class PetscMatrixSampler : public HMatrixSampler {
public:
  PetscMatrixSampler();
 PetscMatrixSampler(Mat);
  ~PetscMatrixSampler();
  void SetSamplingMat(Mat);
  void         SetIndexMap(int, int *);
  void SetGPUSampling(bool);
  void SetStream(h2opusComputeStream_t);
  virtual void sample(H2Opus_Real *, H2Opus_Real *, int);
  Mat          GetSamplingMat() { return A; }
};

struct Shift {
  int _shift;

  Shift(int shift) : _shift(shift) { }
  __host__ __device__ inline int operator()(const int &c) { return c + _shift; }
};
$ clang-format -version
clang-format version 17.0.1
$ clang-format --style=file:clang-format.txt src.cxx > 17.cxx 
$ clang-format-18 -version
Debian clang-format version 18.0.0 (++20230927111316+98e016d99732-1~exp1~20230927111428.1598)
$ clang-format-18 --style=file:clang-format.txt src.cxx > 18.cxx 
```
```diff
$ diff -pauN 17.cxx 18.cxx
--- 17.cxx      2023-09-28 19:09:20
+++ 18.cxx      2023-09-28 19:09:08
@@ -9,7 +9,7 @@ class PETSC_NODISCARD Device::DeviceInternal { (public
 
 public:
   // default constructor
-  DeviceInternal(int id) noexcept : id_(id), devInitialized_(false), syclDevice_(chooseSYCLDevice_(id)) { }
+ DeviceInternal(int id) noexcept : id_(id), devInitialized_(false), syclDevice_(chooseSYCLDevice_(id)) { }
   int  id() const { return id_; }
   bool initialized() const { return devInitialized_; }
 }
@@ -18,14 +18,14 @@ struct MatProductData_SeqAIJKokkos {
 struct MatProductData_SeqAIJKokkos {
   KernelHandle kh;
   PetscBool reusesym;
-  MatProductData_SeqAIJKokkos() : reusesym(PETSC_FALSE) { }
+               MatProductData_SeqAIJKokkos() : reusesym(PETSC_FALSE) { }
 };
 
 class PetscMatrixSampler : public HMatrixSampler {
 public:
-  PetscMatrixSampler();
-  PetscMatrixSampler(Mat);
- ~PetscMatrixSampler();
+               PetscMatrixSampler();
+ PetscMatrixSampler(Mat);
+  ~            PetscMatrixSampler();
 void         SetSamplingMat(Mat);
   void         SetIndexMap(int, int *);
   void         SetGPUSampling(bool);
@@ -37,6 +37,6 @@ struct Shift {
 struct Shift {
   int _shift;
 
-  Shift(int shift) : _shift(shift) { }
+                                 Shift(int shift) : _shift(shift) { }
   __host__ __device__ inline int operator()(const int &c) { return c + _shift; }
 };
```
I'm not sure if those are regressions, or just funny-looking (but correct). One way to revert to the previous formatting is to add extra line breaks, but I'm not sure whether that is intended or not. [clang-format.txt](https://github.com/llvm/llvm-project/files/12753413/clang-format.txt)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMWN9z2roS_mvEy44ZWwZsP_AAIbS5bdpMuffhPjHCXkCNkXwlOSX3IX_7GUk2v2mTnM6ZejKgSLufvl2tpM8wrflKIA5Jf0z6kw6rzVqqYaW-B52FLJ6HZBA2f-GEhCNCe5AzA1rl3Xy79Z2CbVBXLEfQz3nZGCbjptH4TQmdAhcGlWAlEEr5pio1oRTykmkN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