[clang] [clang-format] Handle token-pasted function decl names (PR #142251)

Pierre Jolivet via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 1 21:38:51 PDT 2025


prj- wrote:

@owenca, this introduced multiple regressions (or maybe they are all the same), I do believe.
```diff
diff --git a/include/petsc/private/hashmap.h b/include/petsc/private/hashmap.h
index c48d69d73ce..265a968a95c 100644
--- a/include/petsc/private/hashmap.h
+++ b/include/petsc/private/hashmap.h
@@ -37,3 +37,3 @@ M*/
 #define PETSC_HASH_MAP_DECL(HashT, KeyType, ValType) \
-  typedef kh_##HashT##_t                   *Petsc##HashT; \
+  typedef kh_##HashT##_t *Petsc##           HashT; \
   static inline PETSC_UNUSED PetscErrorCode Petsc##HashT##Create(Petsc##HashT *); \
diff --git a/include/petsc/private/logimpl.h b/include/petsc/private/logimpl.h
index 6645e51af15..59333efff6a 100644
--- a/include/petsc/private/logimpl.h
+++ b/include/petsc/private/logimpl.h
@@ -13,3 +13,3 @@
 #define PETSC_LOG_RESIZABLE_ARRAY(Container, Entry, Key, Constructor, Destructor, Equal) \
-  typedef struct _n_PetscLog##Container    *PetscLog##Container; \
+  typedef struct _n_PetscLog##Container *PetscLog##Container; \
   static inline PETSC_UNUSED PetscErrorCode PetscLog##Container##Create(int, PetscLog##Container *); \
diff --git a/src/dm/impls/plex/plexgmsh.c b/src/dm/impls/plex/plexgmsh.c
index faa5033598d..662c1981f80 100644
--- a/src/dm/impls/plex/plexgmsh.c
+++ b/src/dm/impls/plex/plexgmsh.c
@@ -10,3 +10,3 @@
     static int Gmsh_LexOrder_##T##_##p[GmshNumNodes_##T(p)] = {-1}; \
-    int       *lex                                          = Gmsh_LexOrder_##T##_##p; \
+    int                             *lex                    = Gmsh_LexOrder_##T##_##p; \
     if (lex[0] == -1) (void)GmshLexOrder_##T(p, lex, 0); \
```
A reproducer is attached (`clang-format-21 --style=file:clang-format.txt foo.txt`), let me know if you want me to open an issue. [clang-format.txt](https://github.com/user-attachments/files/20545076/clang-format.txt)  [foo.txt](https://github.com/user-attachments/files/20545081/foo.txt)

https://github.com/llvm/llvm-project/pull/142251


More information about the cfe-commits mailing list