<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/87814>87814</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] [BUG] IndentPPDirectives is inconsistent
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Volker-Weissmann
</td>
</tr>
</table>
<pre>
If I format the following code with `clang-format --style='{IndentPPDirectives: AfterHash}' main.c`
```c
int a;
#if FOO
#define BAR
#endif
#ifndef ABC
#define ABC 123
#endif
```
it does not change. If however I add for example `int b;` after `int a;`, it gets formatted like this:
```c
int a;
int b;
#if FOO
# define BAR
#endif
#ifndef ABC
# define ABC 123
#endif
```
This definitely seems like a bug to me, the 2nd snippet is correct and the 1st snippet is wrong.
If you want me to, I can work on a PR that would fix the bug.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk02PozwMxz9NuFhFEEppDxzaqfo8Pc1o9LycAzHgnZBUxAzTb78KdF52Z7XakVBI7Pzt-CdbeU-tRSxFfhD5MVIjd24o_3PmCYfV_0je98raqHL6Wp4bOEPjhl4xcIfQOGPcRLaF2mmEibgDsUlqo2y7ut1brTxfDYrsKGQhisPZarT88HCkAWumZ_Qi28O-YRz-Vr4TRbgHvSIb12KTiOQokn3YzF-9nMkyKJEdbt5llRk1cLq_fztqbMgiHPaPbya0mppPKquxgf3hDn6WBlsqs1_KX590exGDdujBOoa6U7bFGM4NdG7CZxzgDErrgA7wRfUXg4FTqKIKVWwSUAHAq1EtRiHvgBhaZH-jzqjB0BMCdxS4_Qmdtyy_ZQVfhvUuhS_TWtZ_OvKLlhjNFTxi75f6FFRjC-ygx0AhNJu0GrylywUZyEPthtBAoKye3annj-5pcLaNlzznBq5uhElZhh6BXQh5hlpZmNzwBM6CgodH4E4xTG40Ghp6maNWYxtHusz0LtupCMu0SGW2TvM0i7pyk8kk3xbbrG6kxmAsVLFL8qJIskbVRUSlTOQ6WSd5upV5msXFDtNiJ5WuQsA8FesEe0UmNua5j93QRuT9iOW22KbryKgKjZ8nU8qPQyWkDLM6lEG2qsbWi3ViyLN_D8TEZp7qH4T5EUR-OPz7V9h9HsVAjmztrCfPaDkaB1N2zJe52eRJyFNL3I1VXLteyFPIdvutLoP7hjULeZpr8EKe5jK-BwAA__88NU_e">