diff options
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core')
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 15 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/CheckerContext.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 8 |
3 files changed, 11 insertions, 15 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 6b9aaa64b3d..6ff18c21a53 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -235,7 +235,7 @@ public: // Check the return value. ProgramStateRef State = Node->getState(); - SVal RetVal = State->getSVal(S, Node->getLocationContext()); + SVal RetVal = Node->getSVal(S); // Handle cases where a reference is returned and then immediately used. if (cast<Expr>(S)->isGLValue()) @@ -717,7 +717,7 @@ FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ, if (VR) { // See if we can get the BlockVarRegion. ProgramStateRef State = StoreSite->getState(); - SVal V = State->getSVal(S, PS->getLocationContext()); + SVal V = StoreSite->getSVal(S); if (const BlockDataRegion *BDR = dyn_cast_or_null<BlockDataRegion>(V.getAsRegion())) { if (const VarRegion *OriginalR = BDR->getOriginalRegion(VR)) { @@ -1104,7 +1104,7 @@ bool bugreporter::trackNullOrUndefValue(const ExplodedNode *N, if (Inner && ExplodedGraph::isInterestingLValueExpr(Inner)) { const ExplodedNode *LVNode = findNodeForExpression(N, Inner); ProgramStateRef LVState = LVNode->getState(); - SVal LVal = LVState->getSVal(Inner, LVNode->getLocationContext()); + SVal LVal = LVNode->getSVal(Inner); const MemRegion *RR = getLocationRegionIfReference(Inner, N); bool LVIsNull = LVState->isNull(LVal).isConstrainedTrue(); @@ -1123,7 +1123,7 @@ bool bugreporter::trackNullOrUndefValue(const ExplodedNode *N, // If the LVal is null, check if we are dealing with null reference. // For those, we want to track the location of the reference. const MemRegion *R = (RR && LVIsNull) ? RR : - LVState->getSVal(Inner, LVNode->getLocationContext()).getAsRegion(); + LVNode->getSVal(Inner).getAsRegion(); if (R) { // Mark both the variable region and its contents as interesting. @@ -1203,7 +1203,7 @@ const Expr *NilReceiverBRVisitor::getNilReceiver(const Stmt *S, return nullptr; if (const Expr *Receiver = ME->getInstanceReceiver()) { ProgramStateRef state = N->getState(); - SVal V = state->getSVal(Receiver, N->getLocationContext()); + SVal V = N->getSVal(Receiver); if (state->isNull(V).isConstrainedTrue()) return Receiver; } @@ -1259,8 +1259,7 @@ void FindLastStoreBRVisitor::registerStatementVarDecls(BugReport &BR, const Stmt *Head = WorkList.front(); WorkList.pop_front(); - ProgramStateRef state = N->getState(); - ProgramStateManager &StateMgr = state->getStateManager(); + ProgramStateManager &StateMgr = N->getState()->getStateManager(); if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Head)) { if (const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl())) { @@ -1268,7 +1267,7 @@ void FindLastStoreBRVisitor::registerStatementVarDecls(BugReport &BR, StateMgr.getRegionManager().getVarRegion(VD, N->getLocationContext()); // What did we load? - SVal V = state->getSVal(S, N->getLocationContext()); + SVal V = N->getSVal(S); if (V.getAs<loc::ConcreteInt>() || V.getAs<nonloc::ConcreteInt>()) { // Register a new visitor with the BugReport. diff --git a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp index 61cbf3854bb..6cf931abbdd 100644 --- a/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp +++ b/clang/lib/StaticAnalyzer/Core/CheckerContext.cpp @@ -20,9 +20,8 @@ using namespace clang; using namespace ento; const FunctionDecl *CheckerContext::getCalleeDecl(const CallExpr *CE) const { - ProgramStateRef State = getState(); const Expr *Callee = CE->getCallee(); - SVal L = State->getSVal(Callee, Pred->getLocationContext()); + SVal L = Pred->getSVal(Callee); return L.getAsFunctionDecl(); } diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index 82ab910d1e3..fac0d380d47 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -1195,12 +1195,10 @@ std::string StackHintGeneratorForSymbol::getMessage(const ExplodedNode *N){ return getMessageForSymbolNotFound(); // Check if one of the parameters are set to the interesting symbol. - ProgramStateRef State = N->getState(); - const LocationContext *LCtx = N->getLocationContext(); unsigned ArgIndex = 0; for (CallExpr::const_arg_iterator I = CE->arg_begin(), E = CE->arg_end(); I != E; ++I, ++ArgIndex){ - SVal SV = State->getSVal(*I, LCtx); + SVal SV = N->getSVal(*I); // Check if the variable corresponding to the symbol is passed by value. SymbolRef AS = SV.getAsLocSymbol(); @@ -1210,7 +1208,7 @@ std::string StackHintGeneratorForSymbol::getMessage(const ExplodedNode *N){ // Check if the parameter is a pointer to the symbol. if (Optional<loc::MemRegionVal> Reg = SV.getAs<loc::MemRegionVal>()) { - SVal PSV = State->getSVal(Reg->getRegion()); + SVal PSV = N->getState()->getSVal(Reg->getRegion()); SymbolRef AS = PSV.getAsLocSymbol(); if (AS == Sym) { return getMessageForArg(*I, ArgIndex); @@ -1219,7 +1217,7 @@ std::string StackHintGeneratorForSymbol::getMessage(const ExplodedNode *N){ } // Check if we are returning the interesting symbol. - SVal SV = State->getSVal(CE, LCtx); + SVal SV = N->getSVal(CE); SymbolRef RetSym = SV.getAsLocSymbol(); if (RetSym == Sym) { return getMessageForReturn(CE); |

