diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-08-22 06:00:18 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-08-22 06:00:18 +0000 |
commit | 1afcb7442fb26b6369dd95b76acea25cbbdac651 (patch) | |
tree | 81c9abae4690ec1d140638d1ec3ce473c4d81fd9 /clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | |
parent | 2cd56c4c6ecc6943257a4f7d007a1464d93feea8 (diff) | |
download | bcm5719-llvm-1afcb7442fb26b6369dd95b76acea25cbbdac651.tar.gz bcm5719-llvm-1afcb7442fb26b6369dd95b76acea25cbbdac651.zip |
Remove Store::bindDecl() and Store::bindDeclWithNoInit(), and
all forwarding methods.
This functionality is already covered by bindLoc().
llvm-svn: 162346
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngine.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index d7666829d51..031aa9b98f1 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1540,7 +1540,8 @@ void ExprEngine::VisitMemberExpr(const MemberExpr *M, ExplodedNode *Pred, /// This method is used by evalStore and (soon) VisitDeclStmt, and others. void ExprEngine::evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE, ExplodedNode *Pred, - SVal location, SVal Val, bool atDeclInit) { + SVal location, SVal Val, + bool atDeclInit) { // Do a previsit of the bind. ExplodedNodeSet CheckedSet; @@ -1548,6 +1549,13 @@ void ExprEngine::evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE, StoreE, *this, ProgramPoint::PostStmtKind); + // If the location is not a 'Loc', it will already be handled by + // the checkers. There is nothing left to do. + if (!isa<Loc>(location)) { + Dst = CheckedSet; + return; + } + ExplodedNodeSet TmpDst; StmtNodeBuilder Bldr(CheckedSet, TmpDst, *currentBuilderContext); @@ -1556,24 +1564,20 @@ void ExprEngine::evalBind(ExplodedNodeSet &Dst, const Stmt *StoreE, I!=E; ++I) { ExplodedNode *PredI = *I; ProgramStateRef state = PredI->getState(); - - if (atDeclInit) { - const VarRegion *VR = - cast<VarRegion>(cast<loc::MemRegionVal>(location).getRegion()); - - state = state->bindDecl(VR, Val); - } else { - state = state->bindLoc(location, Val); - } - + + // When binding the value, pass on the hint that this is a initialization. + // For initializations, we do not need to inform clients of region + // changes. + state = state->bindLoc(cast<Loc>(location), + Val, /* notifyChanges = */ !atDeclInit); + const MemRegion *LocReg = 0; - if (loc::MemRegionVal *LocRegVal = dyn_cast<loc::MemRegionVal>(&location)) + if (loc::MemRegionVal *LocRegVal = dyn_cast<loc::MemRegionVal>(&location)) { LocReg = LocRegVal->getRegion(); - + } const ProgramPoint L = PostStore(StoreE, LC, LocReg, 0); Bldr.generateNode(L, state, PredI); } - Dst.insert(TmpDst); } |