[analyzer] Add getLocationContext to CheckerContext

CheckerContext::getPredecessor is only used to get to the LocationContext
half of the times.

llvm-svn: 143061
diff --git a/clang/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp
index a064a65..ab3242b 100644
--- a/clang/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/IteratorsChecker.cpp
@@ -395,8 +395,7 @@
 // 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 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 @@
 
   // 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 @@
           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());
       }
     }
   }