More hacking on autorelease errors. We now can emit basic errors (disabled for
now until ready).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71303 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index e45b3b3..c8d0bf7 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -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);
diff --git a/lib/Analysis/GRCoreEngine.cpp b/lib/Analysis/GRCoreEngine.cpp
index c75fd9a..ff7b548 100644
--- a/lib/Analysis/GRCoreEngine.cpp
+++ b/lib/Analysis/GRCoreEngine.cpp
@@ -568,7 +568,6 @@
Node->addPredecessor(P ? P : Pred);
if (IsNew) {
- Node->markAsSink();
Eng.G->addEndOfPath(Node);
return Node;
}