Issue 113927
Summary clang-tidy: misc-include-cleaner: Unused includes not removed from .h file
Labels
Assignees
Reporter JanMatCodasip
    In the attached example, unused includes `#include <stdio.h>` and `#include <inttypes.h>` are not removed from `number_generator.h`.

These are the 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 .
[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 number_generator.h still contains `#include <stdio.h>` and `#include <inttypes.h>`, despite being unused.
```

(Note that the attached example as well as the steps to reproduce are identical to issue https://github.com/llvm/llvm-project/issues/113926.)

Thank you.

[test-includes.tar.gz](https://github.com/user-attachments/files/17544830/test-includes.tar.gz)

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to