<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/145189>145189</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] IntegerLiteralSeparator breaks preprocessing conditionals with digit separators
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-format
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          MorganCaron
      </td>
    </tr>
</table>

<pre>
    I'm using clang-format with the following ``IntegerLiteralSeparator`` settings:

```yaml
IntegerLiteralSeparator:
  Binary: 4
  Decimal: 3
  Hex: 2
```

When formatting code like this:
```cpp
#if __cpp_lib_smart_ptr_owner_equality >= 202306L
```
clang-format transforms it into:
```cpp
#if __cpp_lib_smart_ptr_owner_equality >= 202'306L
```
which causes a compilation error because the preprocessor does not accept digit separators ``'`` in numeric literals inside directives.

I’m aware that since C++20, there is an alternative to test feature macros using:
```cpp
#if __has_cpp_attribute(__cpp_lib_smart_ptr_owner_equality)
```
However, it would still be useful to have either:
- an option to disable ``IntegerLiteralSeparator`` only inside preprocessor directives, or
- for the behavior to be changed so that ``IntegerLiteralSeparator`` is not applied at all to preprocessor lines or specific preprocessor instructions such as ``#if``

This suggestion is intended to make formatting smoother and avoid breaking code when numeric literals appear in preprocessor conditionals
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVE9v48YP_TTjC5FAHtmyfdBhs9lgA-zv9CvQo0GNaInNaEYdUnbz7YuRkk2cdts9FDBgzR_Oe3yPJIpwF4hqs70z2_sVTtrHVP8vpg7DZ0wxrJrYPtePxu4GmIRDB85j6G5OMQ2ocGHtQXuCU_Q-XvK5qQpTFY9BqaP0jZUS-v_TiAk1puUQhFQ5dGLKT6aYf_O-qYpnHLwpPv0ofL4PcMcB07MpP8FmXt-T4wF93ijnja_0R17Y908vSL_2FGBhr3M6sSXw_ESgPb8Seg1x45iX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