summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorRyosuke Niwa <rniwa@webkit.org>2024-10-31 00:14:24 -0700
committerGitHub <noreply@github.com>2024-10-31 00:14:24 -0700
commit287781c7c9dbd7674cf7cbab8a8fe8a49a4b9317 (patch)
tree208627f94f4dbcff1891b0fd3f5c2b9323155a2c /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
parentfdc78120bde1426b223196bec645b6f27fc60f0e (diff)
[webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (#113845)
This PR makes webkit.UncountedLambdaCapturesChecker ignore trivial functions as well as the one being passed to an argument with [[clang::noescape]] attribute. This dramatically reduces the false positive rate for this checker. To do this, this PR replaces VisitLambdaExpr in favor of checking lambdas via VisitDeclRefExpr and VisitCallExpr. The idea is that if a lambda is defined but never called or stored somewhere, then capturing whatever variable in such a lambda is harmless. VisitCallExpr explicitly looks for direct invocation of lambdas and registers its DeclRefExpr to be ignored in VisitDeclRefExpr. If a lambda is being passed to a function, it checks whether its argument is annotated with [[clang::noescape]]. If it's not annotated such, it checks captures for their safety. Because WTF::switchOn could not be annotated with [[clang::noescape]] as function type parameters are variadic template function so we hard-code this function into the checker. Finally, this PR also converts the accompanying test to use -verify and adds a bunch of tests.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
0 files changed, 0 insertions, 0 deletions