[PATCH] D122231: [clang][dataflow] Add support for `value_or` in a comparison.

Stanislav Gatev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 00:35:15 PDT 2022


sgatev accepted this revision.
sgatev added inline comments.


================
Comment at: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp:275
+      State.Env.getValue(*ValueOrPredExpr, SkipPast::None));
+  if (ExprValue == nullptr) {
+    auto &ExprLoc = State.Env.createStorageLocation(*ValueOrPredExpr);
----------------
ymandel wrote:
> sgatev wrote:
> > Why do this conditionally? I think we should set a value regardless of whether another model has already done so.
> Why? I figured we're agnostic to the underlying value, and only care about relating it via the implication. We're setting it only so we have something to anchor that implication on.  If we always set it, then we're erasing the information from another model.
Nevermind. I probably didn't follow carefully around all the comment blocks and thought that `addToFlowCondition` also happens conditionally. The current approach looks good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122231/new/

https://reviews.llvm.org/D122231



More information about the cfe-commits mailing list