[clang] [alpha.webkit.UncountedLocalVarsChecker] Detect assignments to uncounted local variable and parameters. (PR #92639)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Thu May 23 17:52:23 PDT 2024


================
@@ -135,7 +135,19 @@ class UncountedLocalVarsChecker
       bool shouldVisitImplicitCode() const { return false; }
 
       bool VisitVarDecl(VarDecl *V) {
-        Checker->visitVarDecl(V);
+        auto *Init = V->getInit();
+        if (Init && V->isLocalVarDecl())
----------------
rniwa wrote:

Oh, interesting. I *think* we do want to check static local variables as well since there is nothing preventing static local variable to be a raw pointer to a ref counted type, which is also bad.

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


More information about the cfe-commits mailing list