[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114897)

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 4 18:50:21 PST 2024


================
@@ -45,32 +52,119 @@ class UncountedLambdaCapturesChecker
       bool shouldVisitTemplateInstantiations() const { return true; }
       bool shouldVisitImplicitCode() const { return false; }
 
-      bool VisitLambdaExpr(LambdaExpr *L) {
-        Checker->visitLambdaExpr(L);
+      bool TraverseDecl(Decl *D) {
+        if (auto *CXXMD = dyn_cast<CXXMethodDecl>(D)) {
----------------
haoNoQ wrote:

Just use `TraverseCXXMethodDecl()` instead?

I'm also not sure it actually works. Looks like you're trying to capture the global "this" type to use inside lambdas where `this` has a different meaning. But doesn't this method also act on the lambda's own overloaded `operator()()` (which is also a method) defeating the purpose? Or do we already skip it in a different place?

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


More information about the cfe-commits mailing list