<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63379>63379</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Ignores "clang-format off" for preprocessor directives in main branch (llvm 17)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Sedeniono
</td>
</tr>
</table>
<pre>
Consider
```C++
// clang-format off
#if 0
#if SHOULD_STAY_INDENTED
#endif
#endif
// clang-format on
```
The `.clang-format` file contains a single line:
```
BasedOnStyle: LLVM
```
Formatting the whole file with clang 16, the formatting of the preprocessor directives is not changed. However, using the current main branch (llvm 17; specifically b7287a82d33b6cd1760ac7e399ba92ae52057b5d), clang-format does format the `#if SHOULD_STAY_INDENTED` and the `#endif` (the indent gets removed).
This happens even with the bugfix from #62892.
I could bisect it to a4c87f8ccaccc76fd7d1c6c2e639ca84b9ec7794 (#61498). Differential revision: https://reviews.llvm.org/D150057
Maybe @owenca?
I noticed the above regression while looking at the example from https://github.com/llvm/llvm-project/issues/57117, and managed to reduce it to the above.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVEFvpDgT_TXmUpqWMWDDgUOSntZEyswcku-T9jQydgHeddst23RP_v3K0JlMdpPLtlAjVxX1Hu8VJWM0k0PsSXNLmn0hlzT70D-iRme888Xg9XN_5100GgOhe0JvCKfbdUfYbb62KDsQdgBlpZs-jT4cZQI_ji_JyoxAtwNcf1vw8cv3_z3sfzw-3fzx4_7b_vO3p8_7ax1hFTptXnu8Ob0D5_5BcDs-zQiE093vtYRTGI1FUN4laVwECdG4ySJY45BUN--2upUR9Xf3mJ5troGHh_9_fbfwsKIk4yZIM8Jl9hY3wItJ80YbSk7Y3ZofX8v9uEZOAU_BK4zRB9AmoErmjBFMBOcTqFm6CfUOvvgLnjHkRkt8gVNLCOgSHKVxMATp1AyEtdaej1AKUt1CPKEyo1HS2mcYBGuFbJmuqoErXQpOpRJYdd0gOyaxYbQRQ6MJ6zLOG821x3ilv0JnBT72lVOQTv9WuDnKaaaXo8bpTHzCFCHg0Z8xo-5ejDQRZnk6oYuAZ3SbmPm5YZlG8xPG4I95bDhrO3Z9avu_B-UXq2EwEVUCkyB5kLVqxdgqJZVSgo9a6FJxxZBXnZJtPXSohOjqzC53LeuuzXRgb8YRs8RGWgh4NtF4lwdiTukU8_Ss45kzeIm7LPzOh4mww75sKG3ERuqrfB4QSE39BZ2SpDq8pex8Mgo3veTgzwgBp4Axo8FlzuNkvf8r236VH3_K4ymPWhbiLZnJpHkZdsofCTtkRtfbp1Pwf6JKhB1MjAtGwg6NKEuRvc5uHaWTU2bhIaBeFF7V-8VqV-i-0l3VyQL7kreipC3veDH3dSkUp1qqVrZcjnU96hEFR9kOvGEjL0zPKKsoL9tSlG3Jd63GqsO2qjQdGtQtqSkepbG_NCxWkj2vKtEVVg5o47q8GHN4gTVJGMu7LPTr6w3LFElNrYnp1YkimWTXrfdmKzR7uJ-cDxiBMPavXcZYHvWPv0330RfHumIJtv_vhqyv-3cAAAD__x0xxdU">