<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55055>55055</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Enhance modernize-macro-to-enum to recognize constant literal expressions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
LegalizeAdulthood
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
LegalizeAdulthood
</td>
</tr>
</table>
<pre>
Consider the [following code](https://github.com/InsightSoftwareConsortium/ITK/blob/ac684294e4c4d8387273d56ad97cdb5d98b270ee/Modules/IO/LSM/src/itkLSMImageIO.cxx#L34):
```
#define TIF_CZ_LSMINFO 34412 /* 0x866c, Type: TIF_BYTE, Length: 512 */
#define TIF_CZ_LSMINFO_SIZE_RESERVED 90 + 6
#define TIF_CZ_LSMINFO_SIZE 512
```
The first and third of these macros will be converted to enums, but the second macro will be left in place because it uses a constant integral expression as the value of the macro instead of a simple integral literal.
Enhance modernize-macro-to-enum to recognize macro expansions that are valid initializing expressions for enums. For this issue, only consider macro expansions that are expressions involving integral literals only.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVVN9v2jAQ_mvCiwUKTgzkIQ-0gIRGV6mgSesLcuJL8GZsZDsU-tfvbFiL9qPapOgu9vm--z5fLpUR5_LeaCcFWOJ3QBJ21xilzIvULamNgITNEjrZeX9wSTZN6AKfVvpdVw1qs8fFErPbnV-bxr9wCwHNWC-7GNt8QlspU6Hj9WiS0yKHvM7FJJuM6TgTbMRFMa5FxUQxqeg4BcCjD0Z0ClxAeESzWj-gdbZGK_13XC73vIXl46A-nRKarbI8oUWgl86SdJqM0utzWdJMQCM1kM1ysb1_3ob8z4tHkuX5kJIoaUrS02Q0wgL3ZHM-AGLF03dfN_OwtwLd-l3YZTElXsSH6Nv18nm-fZqv509f5jNSpJh1R0b_kBRK_FlItBvsUiOt84RrgT2TVhDThOY5IHteW-PIi1SKVIAN1EewHvCcIaC7vQtiqs7HXjvAuLjkvKUoaDyRmhwUrwE3at4hrvQEnSM8QDrPdTjjobVcETgdLDgnjSbcReAjVx1cSV3hJWYBj0w5cXJ_UPCOoKQH9INbmXO94xoZ7PEbtFq-Qj8C9b3pByFBkEX-bQhdayARrgOPwILj_dhIRQqsJL3Et9fwVb_zdaQx9nIvA0IWJoyAdEQ610G4KKPVOQqO4_H3IreIUh-NOoY6v8pzEW_QE2UmiqzgPS-9ghInrlZct30vxRmnjfyX8rd2XIvccul1VpUfTK5Sx5-uf7DmG9Q-DFhQH0aPsZSx3q5s0rwSPBXAqtGIsoYOmyEXw1SwYSMAaE_xCpQLQhJK4cJ-DxrBaLhFdDcCcY_NerKkKaVpTjM6ZJQNB2LCcpYWeVWMG0Fpk-Qp7LlUg8BuYGzbs2UkWnWtw6CSzrv3IEfFrQa4klhBG7oNU_yN-J0x4lqWd7iy5W_hXhRdRsU_AAQBq4E">