Small fixes to shore up overhauling of transfer function logic for '&&' and '||.

llvm-svn: 47620
This commit is contained in:
Ted Kremenek 2008-02-26 19:40:44 +00:00
parent a736c001b6
commit bc54390803
2 changed files with 15 additions and 4 deletions

View File

@ -148,8 +148,8 @@ void GRExprEngine::ProcessBranch(Expr* Condition, Stmt* Term,
break;
case RVal::UnknownKind:
builder.generateNode(PrevState, true);
builder.generateNode(PrevState, false);
builder.generateNode(MarkBranch(PrevState, Term, true), true);
builder.generateNode(MarkBranch(PrevState, Term, false), false);
return;
case RVal::UninitializedKind: {
@ -368,6 +368,13 @@ void GRExprEngine::VisitLogicalExpr(BinaryOperator* B, NodeTy* Pred,
X = GetBlkExprRVal(St, Ex);
// Handle uninitialized values.
if (X.isUninit()) {
Nodify(Dst, B, Pred, SetBlkExprRVal(St, B, X));
return;
}
// We took the RHS. Because the value of the '&&' or '||' expression must
// evaluate to 0 or 1, we must assume the value of the RHS evaluates to 0
// or 1. Alternatively, we could take a lazy approach, and calculate this

View File

@ -336,12 +336,16 @@ RVal ValueStateManager::GetRVal(ValueState St, Expr* E) {
ValueState::ExprBindingsTy::TreeTy* T = St->SubExprBindings.SlimFind(E);
return T ? T->getValue().second : GetBlkExprRVal(St, E);
if (T)
return T->getValue().second;
T = St->BlockExprBindings.SlimFind(E);
return T ? T->getValue().second : UnknownVal();
}
RVal ValueStateManager::GetBlkExprRVal(ValueState St, Expr* E) {
assert (!isa<ParenExpr>(E));
E = E->IgnoreParens();
switch (E->getStmtClass()) {
case Stmt::CharacterLiteralClass: {