const ExplodedNode<GRState>* PrevN,
BugReporterContext& BRC) {
+ if (!isa<PostStmt>(N->getLocation()))
+ return NULL;
+
// Check if the type state has changed.
GRStateManager &StMgr = BRC.getStateManager();
GRStateRef PrevSt(PrevN->getState(), StMgr);
if (os.str().empty())
return 0; // We have nothing to say!
-
- Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
+
+ Stmt* S = cast<PostStmt>(N->getLocation()).getStmt();
PathDiagnosticLocation Pos(S, BRC.getSourceManager());
PathDiagnosticPiece* P = new PathDiagnosticEventPiece(Pos, os.str());
NSString *str = [[NSString alloc] init];
return [str autorelease]; // no-warning
}
+- (void)m1
+{
+ NSString *s = [[NSString alloc] init]; // expected-warning{{leak}}
+ [s retain];
+ [s autorelease];
+}
+- (void)m2
+{
+ NSString *s = [[[NSString alloc] init] autorelease]; // expected-warning{{leak}}
+ [s retain];
+}
+- (void)m3
+{
+ NSString *s = [[[NSString alloc] init] autorelease];
+ [s retain];
+ [s autorelease];
+}
+- (void)m4
+{
+ NSString *s = [[NSString alloc] init]; // expected-warning{{leak}}
+ [s retain];
+}
+- (void)m5
+{
+ NSString *s = [[NSString alloc] init];
+ [s autorelease];
+}
@end
@interface C1 : NSObject {}
return CFStringCreateWithFormat(kCFAllocatorDefault, ((void*)0), ((CFStringRef) __builtin___CFStringMakeConstantString ("" "%d" "")), 100); // expected-warning{{leak}}
}
-
-
// Test @synchronized
void test_synchronized(id x) {
@synchronized(x) {
}
}
-// Test return from method starting with 'new' or 'copy'
+