[clang] [StatusOr] [10/N] Add support for absl CHECK macros (PR #169749)

Jan Voung via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 1 19:38:28 PST 2025


================
@@ -602,6 +627,67 @@ static void transferStatusConstructor(const CXXConstructExpr *Expr,
   if (State.Env.getValue(locForOk(StatusLoc)) == nullptr)
     initializeStatus(StatusLoc, State.Env);
 }
+static void
+transferLoggingGetReferenceableValueCall(const CallExpr *Expr,
+                                         const MatchFinder::MatchResult &,
+                                         LatticeTransferState &State) {
+  assert(Expr->getNumArgs() == 1);
+  if (Expr->getArg(0)->isPRValue())
+    return;
+  auto *ArgLoc = State.Env.getStorageLocation(*Expr->getArg(0));
+  if (ArgLoc == nullptr)
+    return;
+
+  State.Env.setStorageLocation(*Expr, *ArgLoc);
+}
+
+static void transferLoggingCheckEqImpl(const CallExpr *Expr,
+                                       const MatchFinder::MatchResult &,
+                                       LatticeTransferState &State) {
+  assert(Expr->getNumArgs() > 2);
+
+  auto *EqVal = evaluateEquality(Expr->getArg(0), Expr->getArg(1), State.Env);
+  if (EqVal == nullptr)
+    return;
+
+  // TODO(sgatev): Model pointer nullability more accurately instead of
----------------
jvoung wrote:

Should the TODO be updated? (not sgatev ?)

Might also be good to explain a bit more what's going on here, e.g., to explain why the `makeNot`  (the EQImpl returns a `char*` and when equal is ... nullptr?)

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


More information about the cfe-commits mailing list