aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/CFRefCount.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-05-09 00:44:07 +0000
committerTed Kremenek <kremenek@apple.com>2009-05-09 00:44:07 +0000
commit80c24182549f45b9b3aa1cec1e547e8c4c09179b (patch)
treeb598680e10434be75f1afe253e0a4973374e43ca /lib/Analysis/CFRefCount.cpp
parent369de565a7d710ba9c672a488d48f6c6ea3f39ad (diff)
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
Diffstat (limited to 'lib/Analysis/CFRefCount.cpp')
-rw-r--r--lib/Analysis/CFRefCount.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index e45b3b37f8..c8d0bf78ae 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -179,7 +179,7 @@ public:
Pred);
assert(ENB);
- return ENB->MakeNode(state, Pred);
+ return ENB->generateNode(state, Pred);
}
};
} // end anonymous namespace
@@ -1552,6 +1552,10 @@ void RefVal::print(std::ostream& Out) const {
case ErrorReleaseNotOwned:
Out << "Release of Not-Owned [ERROR]";
break;
+
+ case RefVal::ErrorOverAutorelease:
+ Out << "Over autoreleased";
+ break;
}
if (ACnt) {
@@ -3185,8 +3189,14 @@ CFRefCount::HandleAutoreleaseCounts(GRStateRef state, GenericNodeBuilder Bd,
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 @@ CFRefCount::HandleAutoreleaseCounts(GRStateRef state, GenericNodeBuilder Bd,
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);