[clang] [webkit.RefCntblBaseVirtualDtor] Make ThreadSafeRefCounted not generate warnings (PR #107676)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 10 21:33:58 PDT 2024


================
@@ -67,6 +68,48 @@ class DerefFuncDeleteExprVisitor
     const Decl *D = CE->getCalleeDecl();
     if (D && D->hasBody())
       return VisitBody(D->getBody());
+    else {
+      auto name = safeGetName(D);
+      if (name == "ensureOnMainThread" || name == "ensureOnMainRunLoop") {
+        for (unsigned i = 0; i < CE->getNumArgs(); ++i) {
+          auto *Arg = CE->getArg(i);
+          if (FindLabmda(Arg))
+            return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  bool FindLabmda(const Expr *E) {
+    while (E) {
+      if (auto *TempE = dyn_cast<MaterializeTemporaryExpr>(E)) {
----------------
rniwa wrote:

Ah, that's so nice!

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


More information about the cfe-commits mailing list