<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54260>54260</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format: `// clang-format off` comment before an indented `#ifdef` jumps back and forth on each format
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MatejKafka
</td>
</tr>
</table>
<pre>
```c
int main() {
// clang-format off
#ifdef TEST
return 0;
#else
return 1;
#endif
// clang-format on
}
```
When `clang-format` is ran on this C snippet, the indentation before the `// clang-format off` comment on line 2 is removed. When `clang-format` is ran a second time on the already formatted file, the indent is added again. Tested with clang v12 and v13.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNU01vnDAQ_TXmMgoCG3bDgUOSbS5VT12p5wGPwRtjVthslH_fAXaVpFU_JATjmTfvvbFNM-q3Wuyy7WlFdhDZg_URBrReyHshKxD7xy0PIOQzP9A69N2dGacBI4zGvJeVNZoMHL98P96SABPFefKQCfWBSJEL9Bsm_wXjtTV_FfdbVewP1-A2y3W5vn_05GGZ70MrL8EGmNAzCcSe4ycI3p7PFIV84gyB9Zp8xGgZ0RD30Zpe2P-wEUzajsPAXQurs55ArjI0jBfSKfzDCkKgdvQaoh1oM0aAbiLUb7ChI2kw1tFnkwsBas017PjoUjhSWJCvNvabTbjkEpCpL7lKE10rXakKk2ijo_qTHfXwnyNe94R9byZYb23cbsGCPM3DOUCD7csqzXC2w2MRtv11nmSeXN3HeA4svIl2bHpuUpbhhXOX2-fuPI0navl8nm0IMwUOykLusqSvs8K0udk1hOpeksnzsiSdtW2xKxulkBKHDV-5WpSPQkpPr7BScCzKQ2JrmUmZqWwvVVFJme4LVBmZsqp0XlV7KYqM-J9w6eIjHacumerVUjN3gYvOhhjeixiC7TzRKsf8OMd-nOpvGOn0Fc0LJqt6vbr_Ca3HF5w">