diff --git a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp index 2e9893e78fa7d..4fc8f27ffc9b2 100644 --- a/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp +++ b/clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp @@ -123,13 +123,10 @@ class TerminatorVisitor private: TerminatorVisitorRetTy extendFlowCondition(const Expr &Cond) { // The terminator sub-expression might not be evaluated. - if (Env.getStorageLocation(Cond, SkipPast::None) == nullptr) + if (Env.getValueStrict(Cond) == nullptr) transfer(StmtToEnv, Cond, Env); - // FIXME: The flow condition must be an r-value, so `SkipPast::None` should - // suffice. - auto *Val = - cast_or_null(Env.getValue(Cond, SkipPast::Reference)); + auto *Val = cast_or_null(Env.getValueStrict(Cond)); // Value merging depends on flow conditions from different environments // being mutually exclusive -- that is, they cannot both be true in their // entirety (even if they may share some clauses). So, we need *some* value @@ -303,18 +300,14 @@ builtinTransferInitializer(const CFGInitializer &Elt, auto *InitStmt = Init->getInit(); assert(InitStmt != nullptr); - auto *InitStmtLoc = Env.getStorageLocation(*InitStmt, SkipPast::Reference); - if (InitStmtLoc == nullptr) - return; - - auto *InitStmtVal = Env.getValue(*InitStmtLoc); - if (InitStmtVal == nullptr) - return; - if (Member->getType()->isReferenceType()) { + auto *InitStmtLoc = Env.getStorageLocationStrict(*InitStmt); + if (InitStmtLoc == nullptr) + return; + auto &MemberLoc = ThisLoc.getChild(*Member); Env.setValue(MemberLoc, Env.create(*InitStmtLoc)); - } else { + } else if (auto *InitStmtVal = Env.getValueStrict(*InitStmt)) { auto &MemberLoc = ThisLoc.getChild(*Member); Env.setValue(MemberLoc, *InitStmtVal); }