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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy: misc-include-cleaner: C++ headers are included into C code
        </td>
    </tr>

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

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

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

<pre>
    Clang-tidy (check `misc-include-cleaner`) includes C++ headers into plain C code. For example `#include <cinttypes>` instead of the expected `#include <inttypes.h>`.

Steps to reproduce:

```bash
# Extract the attached archive
tar xvf test-includes.tar.gz
cd test-includes

# Build the example program (compilation database is also created in the process)
mkdir build && cd build
cmake ..
cmake --build .
[test-includes.tar.gz](https://github.com/user-attachments/files/17544736/test-includes.tar.gz)

run-clang-tidy-18.py -header-filter='-*' -checks='-*,misc-include-cleaner' -fix

# Observe that main.c now contains "#include <cinttypes>" as opposed to "#include <inttypes.h>".
```

Thank you.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VM2uqzYQfhqzGYFgHEhYsMjPzaJS1UX7AoM9Ce4BG9kmTfr0FZD05t5zdCVky8N88_PNp6EQzNUyN6I8iPKU0BQ755vfyP5O8eg0BTMmrdOP5tiTvabR6AcI3KmO1QeIKh9MUKmxqp80p6pnsuxFlQus4WkNcBR4EHiAjkmzD2BsdDD2ZCwcQTnNGZydB77TMPYMC1w-0SDkURkb42PkIOQ3UeVgbIhMGtwFYsfA95FVZP0Z-MJl3YrMRH4S-X49_4w8BogOPI_e6UmxkPt3hznc8rUUuqcJJXy7R08qLqkpRlIdayCvOnPj1SuSh_vtApFDfHETskg-u_67eij9488f0qKEw2R6_WxuJWX07uppWLh3w2h6isZZ0BSppcBgAlAfHCjPNHNh7AIfvVMcgsB6DT58aOOhXcILrARWoPT6flY20AdDlr2_0nQFvOgrD192Vp4E7roYxzATiWeB56uJ3dRmyg0Cz1Ngn66MDWxjEHi-mJ7nu9iWm81WVgLPX4Z-lb-efrKp-l-OabHLxgekq7rSi-kjeyFPArepwL3ALaSLXMO78filcGffi7n_PI4_2sD-xhA7ijCQsZkC6_4B5WwkYwMIxF9IFhEogBtHF1jPivvk_qNQEbOfFPhe0F8d2Q94uClLdCN1LWtKuCm2Mi-wzmWddE2r6rKocFNuq42qSlm3m53eFljLVm1I5olpMMdNkeOuKFGWu6zeUU3bsqyxbXdquxObnAcyfdb3tyFz_pqYECZuikLWWCU9tdyHZWkgfh_F3Fd5Snwzo9J2ugaxyXsTYvgeJ5rYc_OGkXv4chZy_2lxkOfXVtHrFln3RzL5vvmF8ubkzysdvfubVRR4Xjpa1Lc2dWvwvwAAAP__UMiWFw">