[clang] [clang-tools-extra] [clang-tidy] Avoid matching nodes in system headers (PR #151035)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 3 12:06:29 PDT 2025


carlosgalvezp wrote:

> In one of the files we check. Would we still get warnings for UserCode?

Yes, we would. For example, a simple:

```
int x = 0;
assert(reinterpret_cast<int*>(x) == nullptr);
```

Triggers `cppcoreguidelines-pro-type-reinterpret-cast` for the use of `reinterpret_cast`, even if it's called inside a macro.

It's also my understanding that clang-tidy already filters out all system header diagnostics, _before_ doing macro expansion:

https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp#L569




https://github.com/llvm/llvm-project/pull/151035


More information about the cfe-commits mailing list