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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy modernize-macro-to-enum should check if the #define is ever #undefined
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    I tried `modernize-macro-to-enum` on the [vtk](https://gitlab.kitware.com/vtk/vtk) code base.

The resulting auto fixes result in compile errors.

One is this change:

```
// turn off 64-bit ints when templating over all types
#undef VTK_USE_INT64
#define VTK_USE_INT64 0
#undef VTK_USE_UINT64
#define VTK_USE_UINT64 0
```

became:

```
#undef VTK_USE_INT64
enum {
VTK_USE_INT64 = 0
};
#undef VTK_USE_UINT64
enum {
VTK_USE_UINT64 = 0
};
```

Perhaps a check could be added where if something is ever `#undef`ed then it should not be transformed to an enum?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU9uO2jAQ_RrnZQQycbg95GERRVpVaisV-rpynAlxcWxkO1D69Z2Ey5Z22VayxpeZOT6jM1O48pQ_Q_QaS2AT3rgSvdU_cdBI5d0gugHatiEPOAuxRmDjxSHu2HjJ0lkd4z4w8cTSFa2tjkYWw52OR-lxqFxDj13sxc5BEToUMuCQ8SXjT2e7JlSPoTVR2y3INjqo9A8Ml0fQlhKbvTYI6L3z4S77s0XQgaiRUbW0W-wI_RZA3C_rfO25Qmy9BVdVMMkGhe4-iQGONVKR2OyN7Lm4A3qQxkA87TFc80VrS6zg2_rjy-brh5fnT-tJdvORRxOjOyfwB6mbd3M398l_lNHbApVs_lnwY8KdtsCmi_PtnjQTy9vf0yUTi_8o4m28zfuAbxX2BX0t9wEkaYpqRw3QmhIKBFmW1KkklCfZKwiuQZKetCL5sZOrA7pQpCPFxk5UUjjUPYZ1scOJXtpQOd90EQ6khb7PxSopc1HOxVwmkfoZc2WopwZRlyd4MBxX5DNTItWPyU3OG7ELK3ork9ab_K_pqdviMjXGHK7bYO_dd1SRrjqEltowXY2zWZYmdY5zNS9EpSqO6XxSyclYyiwdiykXXBRUAs0jmpDTzLI0tXiEHoLONL-JzlOepjwbcdoJcpgVigshRlJVoxkfK5ZxbKQ2w47H0Plt4vOeUtFuAzmNDjG8OmUIemsR--8Inya5dj4PKG2T9B_nPfFfO9BaQQ">