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

    <tr>
        <th>Summary</th>
        <td>
            Unexpected indentation when using X macros in an enum
        </td>
    </tr>

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

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

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

<pre>
    clang-format incorrectly adds unnecessary indentation when using X macros in an enum.
Given code:
```cpp
#define Macro X(A)

enum Kind {
#define X(name) K_##name,
  Macro
#undef X
  K_B,
  K_C,
};                                                                                                                                                                                                       
```
clang-format version (build from source, latest trunk)
```
❯ ~/dev/llvm-project/build/Debug/bin/clang-format --version
clang-format version 17.0.0
```
clang-format configuration:
```
❯ cat .clang-format
BasedOnStyle: LLVM
```
Formatted as:
```cpp
❯ ~/dev/llvm-project/build/Debug/bin/clang-format demo.cc
#define Macro X(A)

enum Kind {
#define X(name) K_##name,
  Macro
#undef X
      K_B,
  K_C,
};
```

Noticed there's an unexpected indentation before `K_B`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVD1v2zAQ_TXUcrBAU1_WoMGOqw5O2qFokS2gyJPMVCINfrj10t9eSHKTOAmSpUNRQiBwJO_p8e7xcedUpxErkm1Ito148Htjq_ugubIYNUaeKtFz3S1aYwfuQWlhrEXh-xNwKR0ErVGgc9yeQGmJ2nOvjIYfe9QQnNId3MLAhTUOlAauAXUYYkK3hK4_qiNqEEYiSdbzEsnp_InD4bzCEomt0gg3IwzcErZaE1aed6d5xISd0hJIsXmeNiZoPiBhJezuCEsIS-b4aj4KM_JDXtASW7j9s7m72zw5uru7eohIsSXJBv6P8az-c3jR_CNaN_aWsFUTVC-htWYAZ4IVYzGh5x6dB2-D_v7YoEtA8oGRckvWNfwirJZ4JKzu--OwOFhzj8ITVk_YhNVbbEI3xkoTVl8wWSzOXN5guSxiGtP3byWMblUX7KTblzp8TltwD_FTgPnAhjuUn_UXf-pHMcP19bebV5HqKcmjBO7eUv1fqZPEwcRC_CMPaRzvPabXqz_Nn4xXAiX4PVokrHCjmwSNPw8oxno-tZ8GW2MRSE7HH-Y0jmSVyDIpeYTVMi-yLC_zNIn2FeVIRZklBctTumwbuWJlyySiECzBUkSqYpQllNGMppSmSSyKvEC-pDQV5apJM5JSHLjq47E_sbFdpJwLWOU0S7Ko5w32bjJYxi50w9houbaa2tqEzpGU9sp59wjkle-x-vr6Hd-22CjYvtp7f5hUxmrC6k75fWhiYYazmF5qamLuCKsn8r8DAAD__42FtrA">