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

    <tr>
        <th>Summary</th>
        <td>
            [clang-format] wrong formatting when C++ keywords are used as variable name in C
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    For example:
```c
void test() {
  int *p;
  
  int and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor,
      xor_eq = 1;

  p = &and;
  p = &and_eq;
  p = &bitand;
  p = &bitor;
  p = &compl;
  p = &not;
  p = &not_eq;
  p = &or;
  p = &or_eq;
  p = &xor;
  p = &xor_eq;
}

int main() {
  int *and, *and_eq, *bitand, *bitor, *compl, *not, *not_eq, *or, *or_eq,
      *xor, *xor_eq = 0;
}
```

Is incorrectly formatted as:
```c
void test() {
  int *p;

  int and, and_eq, bitand, bitor, compl, not, not_eq, or, or_eq, xor,
      xor_eq = 1;

  p = &and;
  p = & and_eq ;
  p = &bitand;
  p = & bitor ;
  p = &compl ;
  p = &not ;
  p = & not_eq ;
  p = & or ;
  p = & or_eq ;
  p = &xor;
  p = & xor_eq ;
}

int main() {
  int *and, * and_eq, *bitand, * bitor, *compl, *not, * not_eq, * or, * or_eq,
      *xor, * xor_eq = 0;
}
```
(note that `and`, `bitand`, `compl`, `not` and `xor` is somehow unaffected)

Tested with the latest revision (commit 409f0dc4a420db1c6b259d5ae965a070c169d930 at the time of writing):
```
$ clang-format --version
clang-format version 16.0.0 (https://github.com/llvm/llvm-project.git 409f0dc4a420db1c6b259d5ae965a070c169d930)
$ clang-format -style=llvm test.c
```

(For the same reason, the [`lldb/test/API/lang/c/cpp_keyword_identifiers/main.c`](https://github.com/llvm/llvm-project/blob/409f0dc4a420db1c6b259d5ae965a070c169d930/lldb/test/API/lang/c/cpp_keyword_identifiers/main.c) file is probably excluded for clang-format)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzVVU2TmzAM_TVw0WzGEELCgcNuM5nprYfedwyIxF0Hp7ZJsv--Eh_5mLJtM-2lO95g-Qnr6Uk2hane842xgGe5P2gM5s-BWAfiOUhFP8rePhpVgUfng3gVxBkEy5ceAFCNhyB-PgTzy9ItJJsqiD_x4xW_86xQflijmbE8KQ0F50lj_PAYnHvc2ME8d_a4Pf-dOwyC-RqiC4PR4dCtB3HKAa_0bpd54wlkIDmNEIkJoE9iAuCkppc_CD69fy_CBHCe9j_fvxAs17ficGn2UjUf1nOoUT8b5CfjWr3e6AtE80sNaT6UsZ9d3734jvW8LSQtny8ON1UVExmMzXmb0GdHzEtjLZZev0Nt7F56jxVI90-6-n_p6YEVPNbVPe_Jl7pEJhFKaXJ9yHUa-yAKjDn_cX9fZfrrDoePWxx-3-Nw1-Rw8Ybftjk81ufxiiIh-J0k_qlgkoTxVqkYSF_snurFZLap4DzZYgZkKQfO7HFnTtA2sq7p5CDlnd2q-JVOBx2ik_I7CoygJZ8XsHhUTpmGslhRqL3ykIisFlWZyCQWVRGVaREvsmohMUsXUixFGaVZlc2JhO928mqPYGo4WeVVs-W4P53TMfEESi2b7VN_quHp6YiWw_f4HTYgEKUzMRPMb-f9obsD4g2NLWXSFjMiTYbWx_HxdLDmGykw2z6Qy1Wsnyg6_87f0zXv3d0xs_IXtxfR5M8w6-Ik6WJROkqPisdLweKF_LWuCiLb31eb5y-fmblk5TYl_x8Or2_4fjK2elUVNl7VirQghE8BRaeIi_XDepBZaMOB_1yUzd9SpfNaK43coUSjkAXd6HgudVtRL5LCd1qTd4h5lKZZnCViGYVVPicemQy98hpzUu_OfbGmnjPNdvxGUPPBaYcNfAriFxowUHMgLULrum8IHKVVxAOh4foo8g5bq_OHxVTOtcipLrJotQp3eVKvVlEq51WyLBPEJK3niYgEZlGdyGJZh1oWqB2nQdRDlccijqMoTmgsk3iWyqosF_SDdZbGVRQkAklGPePAM2O3oc07DkW7dQRq5by7gtI5tW0Qx_1l63fG5m8alZPtG4Yd4bxj-wPobNws">