[llvm-branch-commits] [cfe-branch] r71339 - in /cfe/branches/Apple/Dib/lib/Analysis: CFRefCount.cpp GRCoreEngine.cpp

Mike Stump mrs at apple.com
Fri May 8 23:21:34 PDT 2009


Author: mrs
Date: Sat May  9 01:21:34 2009
New Revision: 71339

URL: http://llvm.org/viewvc/llvm-project?rev=71339&view=rev
Log:
Merge in 71303:

More hacking on autorelease errors. We now can emit basic errors (disabled for
now until ready).

Modified:
    cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp
    cfe/branches/Apple/Dib/lib/Analysis/GRCoreEngine.cpp

Modified: cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp?rev=71339&r1=71338&r2=71339&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/CFRefCount.cpp Sat May  9 01:21:34 2009
@@ -179,7 +179,7 @@
                                Pred);
     
     assert(ENB);
-    return ENB->MakeNode(state, Pred);
+    return ENB->generateNode(state, Pred);
   }
 };
 } // end anonymous namespace
@@ -1552,6 +1552,10 @@
     case ErrorReleaseNotOwned:
       Out << "Release of Not-Owned [ERROR]";
       break;
+      
+    case RefVal::ErrorOverAutorelease:
+      Out << "Over autoreleased";
+      break;
   }
   
   if (ACnt) {
@@ -3185,8 +3189,14 @@
   unsigned Cnt = V.getCount();
   
   if (ACnt <= Cnt) {
-    V.setCount(Cnt - ACnt);
-    V.setAutoreleaseCount(0);
+    if (ACnt == Cnt) {
+      V.clearCounts();
+      V = V ^ RefVal::NotOwned;
+    }
+    else {      
+      V.setCount(Cnt - ACnt);
+      V.setAutoreleaseCount(0);
+    }
     state = state.set<RefBindings>(Sym, V);
     ExplodedNode<GRState> *N = Bd.MakeNode(state, Pred);
     stop = (N == 0);
@@ -3200,6 +3210,7 @@
   state = state.set<RefBindings>(Sym, V);
 
   if (ExplodedNode<GRState> *N = Bd.MakeNode(state, Pred)) {
+    N->markAsSink();
     CFRefReport *report =
       new CFRefReport(*static_cast<CFRefBug*>(overAutorelease),
                       *this, N, Sym);

Modified: cfe/branches/Apple/Dib/lib/Analysis/GRCoreEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/lib/Analysis/GRCoreEngine.cpp?rev=71339&r1=71338&r2=71339&view=diff

==============================================================================
--- cfe/branches/Apple/Dib/lib/Analysis/GRCoreEngine.cpp (original)
+++ cfe/branches/Apple/Dib/lib/Analysis/GRCoreEngine.cpp Sat May  9 01:21:34 2009
@@ -568,7 +568,6 @@
   Node->addPredecessor(P ? P : Pred);
   
   if (IsNew) {
-    Node->markAsSink();
     Eng.G->addEndOfPath(Node);
     return Node;
   }





More information about the llvm-branch-commits mailing list