diff options
author | Anna Zaks <ganna@apple.com> | 2011-10-26 21:06:44 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-10-26 21:06:44 +0000 |
commit | 39ac1876f6f9a1a8e0070f0df61036c7ba05202b (patch) | |
tree | 8dff9d61b82ff4b796c0e3b6c11ec05ed7f09a04 /lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp | |
parent | 48468dfeb3ccf099ed51ff5dcb8ae0fe783692fd (diff) |
[analyzer] Add getLocationContext to CheckerContext
CheckerContext::getPredecessor is only used to get to the LocationContext
half of the times.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp b/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp index a064a65b10..ab3242bdf5 100644 --- a/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp @@ -395,8 +395,7 @@ const MemRegion *IteratorsChecker::getRegion(const ProgramState *state, // with the same tag. void IteratorsChecker::checkExpr(CheckerContext &C, const Expr *E) const { const ProgramState *state = C.getState(); - const MemRegion *MR = getRegion(state, E, - C.getPredecessor()->getLocationContext()); + const MemRegion *MR = getRegion(state, E, C.getLocationContext()); if (!MR) return; @@ -466,7 +465,7 @@ void IteratorsChecker::checkPreStmt(const CallExpr *CE, void IteratorsChecker::checkPreStmt(const CXXOperatorCallExpr *OCE, CheckerContext &C) const { - const LocationContext *LC = C.getPredecessor()->getLocationContext(); + const LocationContext *LC = C.getLocationContext(); const ProgramState *state = C.getState(); OverloadedOperatorKind Kind = OCE->getOperator(); if (Kind == OO_Equal) { @@ -525,7 +524,7 @@ void IteratorsChecker::checkPreStmt(const DeclStmt *DS, // Get the MemRegion associated with the iterator and mark it as Undefined. const ProgramState *state = C.getState(); - Loc VarLoc = state->getLValue(VD, C.getPredecessor()->getLocationContext()); + Loc VarLoc = state->getLValue(VD, C.getLocationContext()); const MemRegion *MR = VarLoc.getAsRegion(); if (!MR) return; @@ -545,8 +544,7 @@ void IteratorsChecker::checkPreStmt(const DeclStmt *DS, E = M->GetTemporaryExpr(); if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) InitEx = ICE->getSubExpr(); - state = handleAssign(state, MR, InitEx, - C.getPredecessor()->getLocationContext()); + state = handleAssign(state, MR, InitEx, C.getLocationContext()); } } } |