[clang] [alpha.webkit.UnretainedCallArgsChecker] Recognize [allocObj() init] pattern (PR #161019)

Balázs Benics via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 18 04:23:57 PST 2025


================
@@ -321,6 +321,51 @@ bool isExprToGetCheckedPtrCapableMember(const clang::Expr *E) {
   return result && *result;
 }
 
+bool isAllocInit(const Expr *E, const Expr **InnerExpr) {
+  auto *ObjCMsgExpr = dyn_cast<ObjCMessageExpr>(E);
+  if (auto *POE = dyn_cast<PseudoObjectExpr>(E)) {
+    if (unsigned ExprCount = POE->getNumSemanticExprs()) {
+      auto *Expr = POE->getSemanticExpr(ExprCount - 1)->IgnoreParenCasts();
----------------
steakhal wrote:

Could `ExprCount - 1` underflow in this context?

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


More information about the cfe-commits mailing list