[clang] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for local variables to NS and CF types. (PR #127554)
Rashmi Mudduluru via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 22 14:30:46 PST 2025
================
@@ -3668,6 +3668,12 @@ Here are some examples of situations that we warn about as they *might* be poten
RefCountable* uncounted = counted.get(); // warn
}
+alpha.webkit.UnretainedLocalVarsChecker
+"""""""""""""""""""""""""""""""""""""""
+The goal of this rule is to make sure that any NS or CF local variable is backed by a RetainPtr with lifetime that is strictly larger than the scope of the unretained local variable. To be on the safe side we require the scope of an unretained variable to be embedded in the scope of Retainptr object that backs it.
+
+The rules of when to use and not to use RetainPtr are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
+
----------------
t-rasmud wrote:
It would be nice to have a code example here.
https://github.com/llvm/llvm-project/pull/127554
More information about the cfe-commits
mailing list