diff options
author | Anna Zaks <ganna@apple.com> | 2011-11-01 22:41:01 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2011-11-01 22:41:01 +0000 |
commit | a2a860306e3697fcf7a12c5ba59551ca60578968 (patch) | |
tree | 45a556b882757fd73e1c8d682b7ee1dc0b1b6027 | |
parent | 6706e9783fc18cb32810404b599bf88aeaa389dc (diff) |
[analyzer] CheckerContext::getPredecessor() cleanup
Remove unnecessary calls to CheckerContext::getPredecessor() + Comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143513 91177308-0d34-0410-b5e6-96231b3b80d8
3 files changed, 6 insertions, 4 deletions
diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h index 077c6b6abc..2ef306d7b1 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h @@ -48,6 +48,9 @@ public: return Eng.getStoreManager(); } + /// \brief Returns the previous node in the exploded graph, which includes + /// 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(); } diff --git a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp index 944bff6626..914b806dd7 100644 --- a/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp @@ -307,8 +307,8 @@ void CallAndMessageChecker::HandleNilReceiver(CheckerContext &C, } // Other cases: check if sizeof(return type) > sizeof(void*) - if (CanRetTy != Ctx.VoidTy && - C.getPredecessor()->getParentMap().isConsumedExpr(msg.getOriginExpr())) { + if (CanRetTy != Ctx.VoidTy && C.getLocationContext()->getParentMap() + .isConsumedExpr(msg.getOriginExpr())) { // Compute: sizeof(void *) and sizeof(return type) const uint64_t voidPtrSize = Ctx.getTypeSize(Ctx.VoidPtrTy); const uint64_t returnTypeSize = Ctx.getTypeSize(CanRetTy); diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp index 8f9f7d51fc..4969546de2 100644 --- a/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp @@ -2606,13 +2606,12 @@ void RetainCountChecker::checkPostStmt(const CXXConstructExpr *CE, void RetainCountChecker::checkPostObjCMessage(const ObjCMessage &Msg, CheckerContext &C) const { const ProgramState *state = C.getState(); - ExplodedNode *Pred = C.getPredecessor(); RetainSummaryManager &Summaries = getSummaryManager(C); const RetainSummary *Summ; if (Msg.isInstanceMessage()) { - const LocationContext *LC = Pred->getLocationContext(); + const LocationContext *LC = C.getLocationContext(); Summ = Summaries.getInstanceMethodSummary(Msg, state, LC); } else { Summ = Summaries.getClassMethodSummary(Msg); |