[cfe-commits] r141027 - /cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
Anna Zaks
ganna at apple.com
Mon Oct 3 14:16:33 PDT 2011
Author: zaks
Date: Mon Oct 3 16:16:32 2011
New Revision: 141027
URL: http://llvm.org/viewvc/llvm-project?rev=141027&view=rev
Log:
[analyzer] Cleanup in UndefBranchChecker:
- Remove unused FindUndefExpr::ProgramStateManager.
- The Condition parameter of the callback is the terminator of the block, no need to retrieve it again.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp?rev=141027&r1=141026&r2=141027&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp Mon Oct 3 16:16:32 2011
@@ -27,10 +27,9 @@
mutable llvm::OwningPtr<BuiltinBug> BT;
struct FindUndefExpr {
- ProgramStateManager& VM;
const ProgramState *St;
- FindUndefExpr(ProgramStateManager& V, const ProgramState *S) : VM(V), St(S) {}
+ FindUndefExpr(const ProgramState *S) : St(S) {}
const Expr *FindExpr(const Expr *Ex) {
if (!MatchesCriteria(Ex))
@@ -74,19 +73,17 @@
// branch condition." We do a recursive walk of the condition's
// subexpressions and roughly look for the most nested subexpression
// that binds to Undefined. We then highlight that expression's range.
- BlockEdge B = cast<BlockEdge>(N->getLocation());
- const Expr *Ex = cast<Expr>(B.getSrc()->getTerminatorCondition());
- assert (Ex && "Block must have a terminator.");
// Get the predecessor node and check if is a PostStmt with the Stmt
// being the terminator condition. We want to inspect the state
// of that node instead because it will contain main information about
// the subexpressions.
- assert (!N->pred_empty());
// Note: any predecessor will do. They should have identical state,
// since all the BlockEdge did was act as an error sink since the value
// had to already be undefined.
+ assert (!N->pred_empty());
+ const Expr *Ex = cast<Expr>(Condition);
ExplodedNode *PrevN = *N->pred_begin();
ProgramPoint P = PrevN->getLocation();
const ProgramState *St = N->getState();
@@ -95,7 +92,7 @@
if (PS->getStmt() == Ex)
St = PrevN->getState();
- FindUndefExpr FindIt(Eng.getStateManager(), St);
+ FindUndefExpr FindIt(St);
Ex = FindIt.FindExpr(Ex);
// Emit the bug report.
More information about the cfe-commits
mailing list