From: Argyrios Kyrtzidis Date: Wed, 23 Feb 2011 19:38:45 +0000 (+0000) Subject: [analyzer] const goodness. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cd50e136ad7dc721822f5e6350769a37c216612d;p=clang [analyzer] const goodness. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126326 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/CheckerManager.h b/include/clang/StaticAnalyzer/Core/CheckerManager.h index 6a875571c7..fd12864e11 100644 --- a/include/clang/StaticAnalyzer/Core/CheckerManager.h +++ b/include/clang/StaticAnalyzer/Core/CheckerManager.h @@ -133,7 +133,7 @@ public: /// \brief Run checkers for pre-visiting Stmts. void runCheckersForPreStmt(ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng) { runCheckersForStmt(/*isPreVisit=*/true, Dst, Src, S, Eng); @@ -141,7 +141,7 @@ public: /// \brief Run checkers for post-visiting Stmts. void runCheckersForPostStmt(ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng) { runCheckersForStmt(/*isPreVisit=*/false, Dst, Src, S, Eng); @@ -149,12 +149,12 @@ public: /// \brief Run checkers for visiting Stmts. void runCheckersForStmt(bool isPreVisit, - ExplodedNodeSet &Dst, ExplodedNodeSet &Src, + ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng); /// \brief Run checkers for pre-visiting obj-c messages. void runCheckersForPreObjCMessage(ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, const ObjCMessage &msg, ExprEngine &Eng) { runCheckersForObjCMessage(/*isPreVisit=*/true, Dst, Src, msg, Eng); @@ -162,7 +162,7 @@ public: /// \brief Run checkers for post-visiting obj-c messages. void runCheckersForPostObjCMessage(ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, const ObjCMessage &msg, ExprEngine &Eng) { runCheckersForObjCMessage(/*isPreVisit=*/false, Dst, Src, msg, Eng); @@ -170,12 +170,13 @@ public: /// \brief Run checkers for visiting obj-c messages. void runCheckersForObjCMessage(bool isPreVisit, - ExplodedNodeSet &Dst, ExplodedNodeSet &Src, + ExplodedNodeSet &Dst, + const ExplodedNodeSet &Src, const ObjCMessage &msg, ExprEngine &Eng); /// \brief Run checkers for load/store of a location. void runCheckersForLocation(ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, SVal location, bool isLoad, const Stmt *S, const GRState *state, diff --git a/lib/StaticAnalyzer/Core/CheckerManager.cpp b/lib/StaticAnalyzer/Core/CheckerManager.cpp index 55d2140a6a..e24ee52f31 100644 --- a/lib/StaticAnalyzer/Core/CheckerManager.cpp +++ b/lib/StaticAnalyzer/Core/CheckerManager.cpp @@ -64,7 +64,7 @@ void CheckerManager::runCheckersOnASTBody(const Decl *D, AnalysisManager& mgr, template static void expandGraphWithCheckers(CHECK_CTX checkCtx, ExplodedNodeSet &Dst, - ExplodedNodeSet &Src) { + const ExplodedNodeSet &Src) { typename CHECK_CTX::CheckersTy::const_iterator I = checkCtx.checkers_begin(), E = checkCtx.checkers_end(); @@ -73,15 +73,15 @@ static void expandGraphWithCheckers(CHECK_CTX checkCtx, return; } - ExplodedNodeSet Tmp; - ExplodedNodeSet *PrevSet = &Src; + ExplodedNodeSet Tmp1, Tmp2; + const ExplodedNodeSet *PrevSet = &Src; for (; I != E; ++I) { ExplodedNodeSet *CurrSet = 0; if (I+1 == E) CurrSet = &Dst; else { - CurrSet = (PrevSet == &Tmp) ? &Src : &Tmp; + CurrSet = (PrevSet == &Tmp1) ? &Tmp2 : &Tmp1; CurrSet->clear(); } @@ -123,7 +123,7 @@ namespace { /// \brief Run checkers for visiting Stmts. void CheckerManager::runCheckersForStmt(bool isPreVisit, ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng) { CheckStmtContext C(isPreVisit, *getCachedStmtCheckersFor(S, isPreVisit), @@ -160,7 +160,7 @@ namespace { /// \brief Run checkers for visiting obj-c messages. void CheckerManager::runCheckersForObjCMessage(bool isPreVisit, ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, const ObjCMessage &msg, ExprEngine &Eng) { CheckObjCMessageContext C(isPreVisit, @@ -201,7 +201,7 @@ namespace { /// \brief Run checkers for load/store of a location. void CheckerManager::runCheckersForLocation(ExplodedNodeSet &Dst, - ExplodedNodeSet &Src, + const ExplodedNodeSet &Src, SVal location, bool isLoad, const Stmt *S, const GRState *state,