[clang] [WebKit Checkers] Trace through temporaries in tryToFindPtrOrigin (PR #224877)

Ryosuke Niwa via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 19 21:36:48 PDT 2026


================
@@ -73,12 +81,17 @@ bool tryToFindPtrOrigin(
       continue;
     }
     if (auto *Expr = dyn_cast<ConditionalOperator>(E)) {
-      return tryToFindPtrOrigin(Expr->getTrueExpr(), StopAtFirstRefCountedObj,
-                                isSafePtr, isSafePtrType, isSafeGlobalDecl,
-                                callback) &&
+      const bool ShortLivedOnEntry =
+          CrossedShortLivedTemporary && *CrossedShortLivedTemporary;
+      bool TrueResult = tryToFindPtrOrigin(
+          Expr->getTrueExpr(), StopAtFirstRefCountedObj, isSafePtr,
+          isSafePtrType, isSafeGlobalDecl, callback, CrossedShortLivedTemporary);
+      if (CrossedShortLivedTemporary)
+        *CrossedShortLivedTemporary = ShortLivedOnEntry;
----------------
rniwa wrote:

Something isn't right about this code. Are we trying to preserve the old value of `CrossedShortLivedTemporary`??

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


More information about the cfe-commits mailing list