llvm / llvm/llvm-project

clang-tidy misc-include-cleaner bug

Open
#172,816 4 comments 0 reactions 1 assignee Claimed by @zeyi2 View on GitHub
clang-include-cleaner false-positive
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Only happens when the macro is named 'I'. If it's renamed to 'H' it's fine.

```sh
$ clang-tidy -checks='-*,misc-include-cleaner' /tmp/prova.c --
1 warning generated.
/tmp/prova.c:3:16: warning: no header providing "I" is directly included [misc-include-cleaner]
1 | #define I 42
2 |
3 | void f(void) { I; }
| ^

$ clang-tidy --version
Debian LLVM version 20.1.8
Optimized build.
```

[prova.c](https://github.com/user-attachments/files/24230466/prova.c)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.