ExplodedNode<GRState> *MakeNode(const GRState *state,
ExplodedNode<GRState> *Pred) {
if (SNB)
- return SNB->generateNode(PostStmt(S, tag), state,
- Pred);
+ return SNB->generateNode(PostStmt(S, tag), state, Pred);
assert(ENB);
return ENB->generateNode(state, Pred);
// Update the autorelease counts.
state = SendAutorelease(state, ARCountFactory, sym);
V = V.autorelease();
+ break;
case StopTracking:
return state.remove<RefBindings>(sym);
return Pred;
// Generate an intermediate node representing the leak point.
- ExplodedNode<GRState> *N = Builder.MakeNode(state, Pred);
+ ExplodedNode<GRState> *N = Builder.MakeNode(state, Pred);
if (N) {
for (llvm::SmallVectorImpl<SymbolRef>::iterator
Builder.BuildSinks = true;
GRExprEngine::NodeTy* N = Builder.MakeNode(Dst, NodeExpr, Pred, St);
- if (!N) return;
+ if (!N)
+ return;
CFRefBug *BT = 0;
}
void f13_autorelease() {
- CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
+ CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning
[(id) A autorelease]; // no-warning
}
+void f13_autorelease_b() {
+ CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
+ [(id) A autorelease];
+ [(id) A autorelease]; // expected-warning{{Object will be sent more -release messages from its containing autorelease pools than it has retain counts}}
+}
+
+CFMutableArrayRef f13_autorelease_c() {
+ CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
+ [(id) A autorelease];
+ [(id) A autorelease];
+ return A; // expected-warning{{Object will be sent more -release messages from its containing autorelease pools than it has retain counts}}
+}
+
+CFMutableArrayRef f13_autorelease_d() {
+ CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
+ [(id) A autorelease];
+ [(id) A autorelease];
+ CFMutableArrayRef B = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{Object will be sent more -release messages}}
+ CFRelease(B); // no-warning
+}
+
+
// This case exercises the logic where the leak site is the same as the allocation site.
void f14_leakimmediately() {
CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{leak}}