diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-02-26 19:40:44 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-02-26 19:40:44 +0000 |
commit | 58b3321009b3f750fb4587b12c2024bb77e6ebf0 (patch) | |
tree | e1ba6c9d65ed921486ce71f911d56d4426c152c6 | |
parent | 7695f70bbd3e4d42adaa1ef2ff5e1b9ab3d9c345 (diff) |
Small fixes to shore up overhauling of transfer function logic for '&&' and '||.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47620 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Analysis/GRExprEngine.cpp | 11 | ||||
-rw-r--r-- | Analysis/ValueState.cpp | 8 |
2 files changed, 15 insertions, 4 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index c0f53fe8c7..1dae433e8f 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -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 diff --git a/Analysis/ValueState.cpp b/Analysis/ValueState.cpp index 7f3e733dbb..b892fd6852 100644 --- a/Analysis/ValueState.cpp +++ b/Analysis/ValueState.cpp @@ -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: { |