Issue 76991
Summary [clang-format] Bug when formatting a macro
Labels clang-format
Assignees
Reporter prj-
    ```c++
$ clang-format --version
clang-format version 17.0.6
$ cat simple.cpp
#ifndef PLEXFE_QFUNCTION
  #define PLEXFE_QFUNCTION(fname, f0_name, f1_name) \
    CEED_QFUNCTION(PlexQFunction##fname)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) \
 { \
        const CeedScalar invJ[2][2]    = { \
 {qdata[i+Q*3], qdata[i+Q*5]}, \
          {qdata[i+Q*4], qdata[i+Q*6]} \
        }; \
      return CEED_ERROR_SUCCESS; \
 }
#endif

PLEXFE_QFUNCTION(A, B, C)
$ clang-format --style=file:clang-format.txt simple.cpp 
#ifndef PLEXFE_QFUNCTION
 #define PLEXFE_QFUNCTION(fname, f0_name, f1_name) \
 CEED_QFUNCTION(PlexQFunction##fname)(void *ctx, const CeedInt Q, const CeedScalar *const *in, CeedScalar *const *out) \
    { \
      const CeedScalar invJ[2][2] = { \
        {qdata[i + Q * 3], qdata[i + Q * 5]},
        {qdata[i + Q * 4], qdata[i + Q * 6]}
      }; \
 return CEED_ERROR_SUCCESS; \
    }
#endif

PLEXFE_QFUNCTION(A, B, C)
```
Also triggered by `Debian clang-format version 18.0.0 (++20240102111311+9b7cf5bfb08b-1~exp1~20240102111413.1794)`. 
[clang-format.txt](https://github.com/llvm/llvm-project/files/13834666/clang-format.txt)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to