Issue 107616
Summary `clang-format` is not idempotent on certain files
Labels clang-format
Assignees
Reporter winterqt
    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).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to