[cfe-commits] r138382 - /cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp

Jordy Rose jediknil at belkadan.com
Tue Aug 23 16:06:32 CDT 2011


Author: jrose
Date: Tue Aug 23 16:06:32 2011
New Revision: 138382

URL: http://llvm.org/viewvc/llvm-project?rev=138382&view=rev
Log:
[analyzer] Cleanup: Move temporary declarations of CFRefCount variables closer to their uses. No functionality change.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp?rev=138382&r1=138381&r2=138382&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CFRefCount.cpp Tue Aug 23 16:06:32 2011
@@ -2963,9 +2963,6 @@
                                         const CallOrObjCMessage &CallOrMsg,
                                         InstanceReceiver Receiver,
                                         CheckerContext &C) const {
-  // FIXME: This goes away when the RetainSummaryManager moves to the checker.
-  CFRefCount &TF = static_cast<CFRefCount&>(C.getEngine().getTF());
-
   const ProgramState *state = C.getState();
 
   // Evaluate the effect of the arguments.
@@ -3013,10 +3010,13 @@
   RetEffect RE = Summ.getRetEffect();
 
   if (RE.getKind() == RetEffect::OwnedWhenTrackedReceiver) {
-    if (ReceiverIsTracked)
-      RE = TF.Summaries.getObjAllocRetEffect();
-    else
+    if (ReceiverIsTracked) {
+      // FIXME: This goes away if the RetainSummaryManager moves to the checker.
+      CFRefCount &TF = static_cast<CFRefCount&>(C.getEngine().getTF());
+      RE = TF.Summaries.getObjAllocRetEffect();      
+    } else {
       RE = RetEffect::MakeNoRet();
+    }
   }
 
   switch (RE.getKind()) {
@@ -3399,17 +3399,12 @@
   if (!Pred)
     return;
 
-  ExprEngine &Eng = C.getEngine();
-  // FIXME: This goes away once HandleAutoreleaseCount() and the
-  // RetainSummariesManager move to RetainReleaseChecker.
-  CFRefCount &TF = static_cast<CFRefCount&>(Eng.getTF());
-
   // Update the autorelease counts.
   static SimpleProgramPointTag
          AutoreleaseTag("RetainReleaseChecker : Autorelease");
   GenericNodeBuilderRefCount Bd(C.getNodeBuilder(), S, &AutoreleaseTag);
-  llvm::tie(Pred, state) = handleAutoreleaseCounts(state, Bd, Pred, Eng,
-                                                   Sym, X);
+  llvm::tie(Pred, state) = handleAutoreleaseCounts(state, Bd, Pred,
+                                                   C.getEngine(), Sym, X);
 
   // Did we cache out?
   if (!Pred)
@@ -3423,6 +3418,9 @@
   // Consult the summary of the enclosing method.
   const Decl *CD = &Pred->getCodeDecl();
 
+  // FIXME: This goes away once the RetainSummariesManager moves to the checker.
+  CFRefCount &TF = static_cast<CFRefCount&>(C.getEngine().getTF());
+
   if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(CD)) {
     // Unlike regular functions, /all/ ObjC methods are assumed to always
     // follow Cocoa retain-count conventions, not just those with special




More information about the cfe-commits mailing list