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

    <tr>
        <th>Summary</th>
        <td>
            `clang-format` is not idempotent on certain files
        </td>
    </tr>

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

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

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

<pre>
    Given [this file](https://github.com/greg7mdp/parallel-hashmap/blob/be6a2c79857c9ea76760ca6ce782e1609713428e/parallel_hashmap/phmap.h), running the following commands:

```
clang-format phmap.h > phmap-1.h
clang-format phmap-1.h > phmap-2.h
diff -u phmap-1.h phmap-2.h
```

shows that `clang-format` is not idempotent:

```diff
--- phmap-1.h   2024-09-06 13:18:49.621712646 -0400
+++ phmap-2.h   2024-09-06 13:18:54.169121591 -0400
@@ -2734,7 +2734,7 @@
   parallel_hash_set() noexcept(
 std::is_nothrow_default_constructible<hasher>::value &&
 std::is_nothrow_default_constructible<key_equal>::value &&
- std::is_nothrow_default_constructible<allocator_type>::value) {}
+ std::is_nothrow_default_constructible<allocator_type>::value){}
 
 #if (__cplusplus >= 201703L || _MSVC_LANG >= 201402) && \
     (defined(_MSC_VER) || defined(__clang__) || \
@@ -2745,7 +2745,8 @@
                              const allocator_type &alloc = allocator_type())
       : parallel_hash_set(
 typename Inner::Params{bucket_cnt, hash_param, eq, alloc},
- phmap::make_index_sequence<num_tables>{}) {}
+ phmap::make_index_sequence<num_tables>{}) {
+  }
 
   template <std::size_t... i>
   parallel_hash_set(typename Inner::Params const &p,
```

However, running `clang-format` on `phmap-2.h` does not produce any further changes.

I am able to reproduce this on both macOS and Ubuntu, using clang-format version 18.1.8 (from Nixpkgs and the LLVM APT repo respectively).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVl9znDYQ_zS6lx0YIf4IHu7hfI7TzDhppmn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