[clang] [WebKit Checkers] Treat const Objective-C ivar as a safe origin (PR #126353)

Rashmi Mudduluru via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 10 19:52:39 PST 2025


================
@@ -163,10 +163,13 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) {
     if (OCE->getOperator() == OO_Star && OCE->getNumArgs() == 1)
       E = OCE->getArg(0);
   }
-  auto *ME = dyn_cast<MemberExpr>(E);
-  if (!ME)
+  const ValueDecl *D = nullptr;
+  if (auto *ME = dyn_cast<MemberExpr>(E))
+    D = ME->getMemberDecl();
+  else if (auto *IVR = dyn_cast<ObjCIvarRefExpr>(E))
+    D = IVR->getDecl();
+  else
     return false;
-  auto *D = ME->getMemberDecl();
   if (!D)
----------------
t-rasmud wrote:

Is this check still needed? The else clause above should already return if D is a nullptr.

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


More information about the cfe-commits mailing list