================
@@ -938,57 +926,82 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator*
U, ExplodedNode *Pred,
case UO_Not: {
assert (!U->isGLValue());
const Expr *Ex = U->getSubExpr()->IgnoreParens();
- ProgramStateRef state = N->getState();
- const StackFrame *SF = N->getStackFrame();
+ ProgramStateRef state = Pred->getState();
+ const StackFrame *SF = Pred->getStackFrame();
// Get the value of the subexpression.
SVal V = state->getSVal(Ex, SF);
if (V.isUnknownOrUndef()) {
- EvalSet.insert(Engine.makeNodeWithBinding(N, U, V));
+ Dst.insert(Engine.makeNodeWithBinding(Pred, U, V));
break;
}
switch (U->getOpcode()) {
- default:
- llvm_unreachable("Invalid Opcode.");
- case UO_Not:
- // FIXME: Do we need to handle promotions?
- state = state->BindExpr(
- U, SF, svalBuilder.evalComplement(V.castAs<NonLoc>()));
- break;
- case UO_Minus:
- // FIXME: Do we need to handle promotions?
- state =
- state->BindExpr(U, SF,
svalBuilder.evalMinus(V.castAs<NonLoc>()));
- break;
- case UO_LNot:
- // C99 6.5.3.3: "The expression !E is equivalent to (0==E)."
- //
- // Note: technically we do "E == 0", but this is the same in the
- // transfer functions as "0 == E".
- SVal Result;
- if (std::optional<Loc> LV = V.getAs<Loc>()) {
+ default:
+ llvm_unreachable("Invalid Opcode.");
+ case UO_Not:
+ // FIXME: Do we need to handle promotions?
+ state = state->BindExpr(U, SF,
+
svalBuilder.evalComplement(V.castAs<NonLoc>()));
+ break;
+ case UO_Minus:
+ // FIXME: Do we need to handle promotions?
+ state =
+ state->BindExpr(U, SF, svalBuilder.evalMinus(V.castAs<NonLoc>()));
+ break;
+ case UO_LNot:
+ // C99 6.5.3.3: "The expression !E is equivalent to (0==E)."
+ //
+ // Note: technically we do "E == 0", but this is the same in the
+ // transfer functions as "0 == E".
+ SVal Result;
+ if (std::optional<Loc> LV = V.getAs<Loc>()) {
Loc X = svalBuilder.makeNullWithType(Ex->getType());
Result = evalBinOp(state, BO_EQ, *LV, X, U->getType());
- } else if (Ex->getType()->isFloatingType()) {
+ } else if (Ex->getType()->isFloatingType()) {
// FIXME: handle floating point types.
Result = UnknownVal();
- } else {
+ } else {
nonloc::ConcreteInt X(getBasicVals().getValue(0, Ex->getType()));
Result = evalBinOp(state, BO_EQ, V.castAs<NonLoc>(), X,
U->getType());
- }
+ }
- state = state->BindExpr(U, SF, Result);
- break;
+ state = state->BindExpr(U, SF, Result);
+ break;
}
- EvalSet.insert(Engine.makePostStmtNode(U, state, N));
+ Dst.insert(Engine.makePostStmtNode(U, state, Pred));
break;
}
}
- }
+ };
+
+ if (AMgr.options.ShouldEagerlyAssume && (U->getOpcode() == UO_LNot)) {
+ ExplodedNodeSet Tmp;
+ VisitUnaryOperatorImpl(Tmp);
+ evalEagerlyAssumeBifurcation(Dst, Tmp, U);
+ } else
+ VisitUnaryOperatorImpl(Dst);
+}
+
+void ExprEngine::VisitPseudoObjectExpr(const PseudoObjectExpr *PE,
+ ExplodedNode *Pred,
+ ExplodedNodeSet &Dst) {
+ SVal V = UnknownVal();
+ if (const Expr *Result = PE->getResultExpr())
+ V = Pred->getState()->getSVal(Result, Pred->getStackFrame());
+ Dst.insert(Engine.makeNodeWithBinding(Pred, PE, V));
+}
- getCheckerManager().runCheckersForPostStmt(Dst, EvalSet, U, *this);
+void ExprEngine::VisitObjCIndirectCopyRestoreClass(
----------------
tigbr wrote:
Sure, that sounds reasonable.
https://github.com/llvm/llvm-project/pull/218691
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits