[clang] [webkit.RefCntblBaseVirtualDtor] ThreadSafeRefCounted still generates warnings (PR #108656)

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 14:04:33 PDT 2024


================
@@ -84,13 +84,22 @@ class DerefFuncDeleteExprVisitor
     E = E->IgnoreParenCasts();
     if (auto *TempE = dyn_cast<CXXBindTemporaryExpr>(E))
       E = TempE->getSubExpr();
+    E = E->IgnoreParenCasts();
+    if (auto *Ref = dyn_cast<DeclRefExpr>(E)) {
+      if (auto *Decl = Ref->getDecl()) {
+        if (auto *VD = dyn_cast<VarDecl>(Decl))
----------------
haoNoQ wrote:

You can combine the two ifs with `dyn_cast_or_null`. Though, I also don't think a `DeclRefExpr`'s decl can be null in the first place. (If only we could, you know, annotate that somehow...)

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


More information about the cfe-commits mailing list