1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx.cocoa.RetainCount,alpha.core -pedantic -verify -Wno-objc-root-class %s
3 // BEGIN delta-debugging reduced header stuff
5 typedef signed char BOOL;
6 typedef unsigned int NSUInteger;
7 typedef struct _NSZone NSZone;
10 - (BOOL)isEqual:(id)object;
12 - (oneway void)release;
15 - (id)copyWithZone:(NSZone *)zone;
18 - (void)encodeWithCoder:(NSCoder *)aCoder;
20 @interface NSObject <NSObject> {}
24 typedef double NSTimeInterval;
25 enum { NSAnimationEaseInOut, NSAnimationEaseIn, NSAnimationEaseOut, NSAnimationLinear };
26 typedef NSUInteger NSAnimationCurve;
27 @interface NSAnimation : NSObject <NSCopying, NSCoding> {}
28 - (id)initWithDuration:(NSTimeInterval)duration animationCurve:(NSAnimationCurve)animationCurve;
29 - (void)startAnimation;
30 - (void)setDelegate:(id)delegate;
33 // END delta-debugging reduced header stuff
35 // From NSAnimation Class Reference
36 // -(void)startAnimation
37 // The receiver retains itself and is then autoreleased at the end
38 // of the animation or when it receives stopAnimation.
40 @interface MyClass { }
41 - (void)animationDidEnd:(NSAnimation *)animation;
44 @implementation MyClass
46 // NOTE: The analyzer doesn't really handle this; it just stops tracking
47 // 'animation' when it is sent the message 'setDelegate:'.
48 NSAnimation *animation = [[NSAnimation alloc] // no-warning
50 animationCurve:NSAnimationEaseInOut];
52 [animation setDelegate:self];
53 [animation startAnimation];
57 NSAnimation *animation = [[NSAnimation alloc] // expected-warning{{leak}}
59 animationCurve:NSAnimationEaseInOut];
61 [animation startAnimation];
64 - (void)animationDidEnd:(NSAnimation *)animation {