[clang] [analyzer] Ignore system headers in WebKit checkers. (PR #91103)
Ryosuke Niwa via cfe-commits
cfe-commits at lists.llvm.org
Sat May 4 20:43:10 PDT 2024
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/91103
None
>From e2dbb580ff7fe1f2db1ad7c81902cb8a8b5a58ed Mon Sep 17 00:00:00 2001
From: Ryosuke Niwa <rniwa at webkit.org>
Date: Sat, 4 May 2024 20:41:29 -0700
Subject: [PATCH] [analyzer] Ignore system headers in WebKit checkers.
---
.../Checkers/WebKit/UncountedCallArgsChecker.cpp | 3 +++
.../Checkers/WebKit/UncountedLocalVarsChecker.cpp | 3 +++
2 files changed, 6 insertions(+)
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
index 0f40ecc7ba3000..9a178a690ff24b 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
@@ -150,6 +150,9 @@ class UncountedCallArgsChecker
bool shouldSkipCall(const CallExpr *CE) const {
const auto *Callee = CE->getDirectCallee();
+ if (BR->getSourceManager().isInSystemHeader(CE->getExprLoc()))
+ return true;
+
if (Callee && TFA.isTrivial(Callee))
return true;
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
index 6036ad58cf253c..98a73810b7afca 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
@@ -230,6 +230,9 @@ class UncountedLocalVarsChecker
if (!V->isLocalVarDecl())
return true;
+ if (BR->getSourceManager().isInSystemHeader(V->getLocation()))
+ return true;
+
return false;
}
More information about the cfe-commits
mailing list