[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:54:03 PDT 2025


================
@@ -1507,11 +1544,17 @@ bool MatchASTVisitor::TraverseStmt(Stmt *StmtNode, DataRecursionQueue *Queue) {
 }
 
 bool MatchASTVisitor::TraverseType(QualType TypeNode) {
+  if (shouldSkipNode(TypeNode))
----------------
carlosgalvezp wrote:

My goal was to establish a somewhat consistent check for all the `Traverse*` functions that could be extended in the future, like I said there's a PR about modules where this could fit well.

But if it's deemed premature generalization/overkill I can a) remove it altogether or b) overload the function for `QualType` and directly return `true`, skipping the logic that ends up checking the default-constructed `SourceLocation` for being in a system header. Let me know! :) 

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


More information about the cfe-commits mailing list