[cfe-commits] r143513 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Anna Zaks ganna at apple.com
Tue Nov 1 15:41:01 PDT 2011


Author: zaks
Date: Tue Nov  1 17:41:01 2011
New Revision: 143513

URL: http://llvm.org/viewvc/llvm-project?rev=143513&view=rev
Log:
[analyzer] CheckerContext::getPredecessor() cleanup

Remove unnecessary calls to CheckerContext::getPredecessor() + Comments.

Modified:
    cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
    cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp

Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h?rev=143513&r1=143512&r2=143513&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h Tue Nov  1 17:41:01 2011
@@ -48,6 +48,9 @@
     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(); }
 

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp?rev=143513&r1=143512&r2=143513&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp Tue Nov  1 17:41:01 2011
@@ -307,8 +307,8 @@
   }
 
   // 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);

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=143513&r1=143512&r2=143513&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Tue Nov  1 17:41:01 2011
@@ -2606,13 +2606,12 @@
 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);    





More information about the cfe-commits mailing list