From: Anna Zaks Date: Thu, 17 Nov 2011 01:09:19 +0000 (+0000) Subject: [analysis] Constify CheckerContext. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eeea7c44a6986752fedee1ef1bcef855db373872;p=clang [analysis] Constify CheckerContext. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144871 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index 181ff5d475..6f4bdd41fa 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -52,11 +52,11 @@ public: /// the state of the program before the checker ran. Note, checkers should /// not retain the node in their state since the nodes might get invalidated. ExplodedNode *getPredecessor() { return Pred; } - const ProgramState *getState() { return Pred->getState(); } + const ProgramState *getState() const { return Pred->getState(); } /// \brief Returns the number of times the current block has been visited /// along the analyzed path. - unsigned getCurrentBlockCount() { + unsigned getCurrentBlockCount() const { return NB.getContext().getCurrentBlockCount(); } @@ -64,7 +64,7 @@ public: return Eng.getContext(); } - const LocationContext *getLocationContext() { + const LocationContext *getLocationContext() const { return Pred->getLocationContext(); } @@ -84,7 +84,7 @@ public: return getSValBuilder().getSymbolManager(); } - bool isObjCGCEnabled() { + bool isObjCGCEnabled() const { return Eng.isObjCGCEnabled(); } @@ -143,7 +143,7 @@ public: } /// \brief Get the name of the called function (path-sensitive). - StringRef getCalleeName(const CallExpr *CE); + StringRef getCalleeName(const CallExpr *CE) const; private: ExplodedNode *addTransitionImpl(const ProgramState *State, diff --git a/lib/StaticAnalyzer/Core/CheckerContext.cpp b/lib/StaticAnalyzer/Core/CheckerContext.cpp index f5bcfa9868..75cb82a67c 100644 --- a/lib/StaticAnalyzer/Core/CheckerContext.cpp +++ b/lib/StaticAnalyzer/Core/CheckerContext.cpp @@ -16,7 +16,7 @@ using namespace clang; using namespace ento; -StringRef CheckerContext::getCalleeName(const CallExpr *CE) { +StringRef CheckerContext::getCalleeName(const CallExpr *CE) const { const ProgramState *State = getState(); const Expr *Callee = CE->getCallee(); SVal L = State->getSVal(Callee);