[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 05:49:12 PDT 2025


carlosgalvezp wrote:

> what is the expected behavior for code expanded from macros defined in system header?

As it is right now, we do not perform any expansion of the `SourceLocation` before checking if it is in a system header, so the behavior is that macros coming from system headers won't be analyzed.  The rationale being that a user typically cannot change the contents of a system macro anyway.

If this is deemed too aggressive I can change it to perform the check on the expanded location instead. This would be consistent with the reverted patch as well as some checks that already do `unless(isExpansionInSystemHeader)`.

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


More information about the cfe-commits mailing list