summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-18 23:06:21 +0000
committerAnna Zaks <ganna@apple.com>2011-10-18 23:06:21 +0000
commit6d285c58ec0e928de3ceae0c0442cdd6238c2845 (patch)
tree22cac613851bcc788e9dbdaaf887726834b75f92 /clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
parenteebbbc7253bed106fa7a607cac0d74ed5a7e5f2c (diff)
downloadbcm5719-llvm-6d285c58ec0e928de3ceae0c0442cdd6238c2845.tar.gz
bcm5719-llvm-6d285c58ec0e928de3ceae0c0442cdd6238c2845.zip
[analyzer] Modularize builder use in processBranch.
Take advantage of the new builders for branch processing. As part of this change pass generic NodeBuilder (instead of BranchNodeBuilder) to the BranchCondition callback and remove the unused methods form BranchBuilder. llvm-svn: 142448
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
index 8663893f2ed..451fa91b3ab 100644
--- a/clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
@@ -49,20 +49,27 @@ class UndefBranchChecker : public Checker<check::BranchCondition> {
};
public:
- void checkBranchCondition(const Stmt *Condition, BranchNodeBuilder &Builder,
+ void checkBranchCondition(const Stmt *Condition, NodeBuilder &Builder,
ExprEngine &Eng) const;
};
}
void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
- BranchNodeBuilder &Builder,
+ NodeBuilder &Builder,
ExprEngine &Eng) const {
const ProgramState *state = Builder.getState();
SVal X = state->getSVal(Condition);
if (X.isUndef()) {
- // Generate a sink node.
- ExplodedNode *N = Builder.generateNode(Condition, state, 0, true);
+ // TODO: The PP will be generated with the correct tag by the CheckerManager
+ // after we migrate the callback to CheckerContext.
+ const ProgramPointTag *Tag = 0;
+ ProgramPoint PP = PostCondition(Condition,
+ Builder.getPredecessor()->getLocationContext(), Tag);
+ // Generate a sink node, which implicitly marks both outgoing branches as
+ // infeasible.
+ ExplodedNode *N = Builder.generateNode(PP, state,
+ Builder.getPredecessor(), true);
if (N) {
if (!BT)
BT.reset(
@@ -102,9 +109,6 @@ void UndefBranchChecker::checkBranchCondition(const Stmt *Condition,
Eng.getBugReporter().EmitReport(R);
}
-
- Builder.markInfeasible(true);
- Builder.markInfeasible(false);
}
}
OpenPOWER on IntegriCloud