summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-18 23:06:04 +0000
committerAnna Zaks <ganna@apple.com>2011-10-18 23:06:04 +0000
commitce5e97efddd3045b9ef77ce358438805873f6fd8 (patch)
treed0c2fa1cbaaadb89030847ac1e24e9b75116210f /clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
parentfc0189aadc380b8727f874e942a7d3db798c3a72 (diff)
downloadbcm5719-llvm-ce5e97efddd3045b9ef77ce358438805873f6fd8.tar.gz
bcm5719-llvm-ce5e97efddd3045b9ef77ce358438805873f6fd8.zip
[analyzer] NodeBuilder Refactoring: Subclass BranchNodeBuilder from NodeBuilder.
llvm-svn: 142444
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/ExprEngine.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
index ac9cf0b08d4..cc170bc1e64 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -940,11 +940,17 @@ static SVal RecoverCastedSymbol(ProgramStateManager& StateMgr,
}
void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term,
- BranchNodeBuilder& builder) {
+ NodeBuilderContext& BldCtx,
+ const CFGBlock *DstT,
+ const CFGBlock *DstF) {
+
+ BranchNodeBuilder builder(BldCtx, DstT, DstF);
// Check for NULL conditions; e.g. "for(;;)"
if (!Condition) {
- builder.markInfeasible(false);
+ BranchNodeBuilder NullCondBldr(BldCtx, DstT, DstF);
+ NullCondBldr.markInfeasible(false);
+ Engine.enqueue(NullCondBldr);
return;
}
@@ -952,11 +958,9 @@ void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term,
Condition->getLocStart(),
"Error evaluating branch");
- getCheckerManager().runCheckersForBranchCondition(Condition, builder, *this);
-
- // If the branch condition is undefined, return;
- if (!builder.isFeasible(true) && !builder.isFeasible(false))
- return;
+ //TODO: This should take the NodeBuiolder.
+ getCheckerManager().runCheckersForBranchCondition(Condition, builder,
+ *this);
const ProgramState *PrevState = builder.getState();
SVal X = PrevState->getSVal(Condition);
@@ -982,6 +986,8 @@ void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term,
if (X.isUnknownOrUndef()) {
builder.generateNode(MarkBranch(PrevState, Term, true), true);
builder.generateNode(MarkBranch(PrevState, Term, false), false);
+ // Enqueue the results into the work list.
+ Engine.enqueue(builder);
return;
}
}
@@ -1003,6 +1009,9 @@ void ExprEngine::processBranch(const Stmt *Condition, const Stmt *Term,
else
builder.markInfeasible(false);
}
+
+ // Enqueue the results into the work list.
+ Engine.enqueue(builder);
}
/// processIndirectGoto - Called by CoreEngine. Used to generate successor
OpenPOWER on IntegriCloud