<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58549>58549</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format: incorrect detection of the lexer hack in macros
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kspalaiologos
</td>
</tr>
</table>
<pre>
With the default `.clang-format` contents, I try to format the following piece of code:
```c
#define fn(x) ((x) * 1024 * 1024)
```
The output I get:
```c
#define fn(x) ((x)*1024 * 1024)
```
A few more test cases that might be helpful in nailing down the issue:
`#define fn(x) ((x) * 1024 * 1024 * 1024)` => `#define fn(x) ((x)*1024 * 1024 * 1024)`
`#define fn(x) ((x) * 1024)` => `#define fn(x) ((x)*1024)`
Interestingly, removing the parens fixes the issue (lexer hack?):
`#define fn(x) (x * 1024)` => `#define fn(x) (x * 1024)`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylU02P2yAU_DX4gjZywB_JwYe0aaS9V-oZw8Omi8ECvEn-fZ-d3WaTVlqllSwwRm_ezHhe69W5-WFST1MPVIEWk02UVPlKWuG6J-3DIBKeqfQugUuRsK_0maZwpsnTy_VSq721_mhcR0cDEqjXWKKA8B3J9yR_X6v88si3M-PY1Disd4RtToRtKe7X1x1d56z4_YIf74A-on9HHn5K45SQYgfpv5pjywda76iGIx18AJogJipFhIjGoDuD6fpEW6A92FFPlhpHnTB29kr5o1vsMzFOH8xC8AedueGJ_4vwPeHf6KdI9zLvcB7l82_db3ot6zOmLaCRaJI9z5kLMPjX2bLZrVEEcJFqc1pMfrNvxrVwgkB7IV8IP8ywf0bg74ROD0u4r8igWVdVVdRFVbFMNVxt-VZkySQLzc048R1mQPoQQCYcuoSb8W4emVnLVcKclEHI4GM2Bdv0KY1xFsRQ2aHDqZ3alfQDHqx9fd-exuB_IiIeF1dwYg_lpiy2Wd9UuqpV26q1VHrDed2qWuS1roRWHGRbZla0YGNDyi-EMYeJvuSSMVLuM9OwnDEUjAuvC7aqN_U6X-dlUdViuyk0KXIYMNmrmcfKhy4LzUKpnbqIl9bEFK-XIkbTOYClHeKLKfU-NC9xFFYYb32HwhcCzSLgF4vgT38">