Skip to content

clang-tidy: misc-include-cleaner: C++ headers are inserted into C code #113926

@JanMatCodasip

Description

@JanMatCodasip

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

Steps to reproduce:

# 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 .

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.

test-includes.tar.gz

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions