Ted Kremenek | 565e465 | 2010-02-05 02:06:54 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s |
| 2 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=basic -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s |
| 3 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify -triple x86_64-apple-darwin9 %s |
| 4 | // RUN: %clang_cc1 -analyze -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify -triple x86_64-apple-darwin9 %s |
Ted Kremenek | 868210e | 2009-04-21 23:53:32 +0000 | [diff] [blame] | 5 | |
| 6 | //===----------------------------------------------------------------------===// |
| 7 | // Delta-debugging produced forward declarations. |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | typedef signed char BOOL; |
| 11 | typedef struct _NSZone NSZone; |
| 12 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 13 | @protocol NSObject - (BOOL)isEqual:(id)object; |
| 14 | @end @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; |
| 15 | @end @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; |
| 16 | @end @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; |
| 17 | @end @interface NSObject <NSObject> { |
| 18 | } |
| 19 | @end extern id <NSObject> NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone); |
| 20 | @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding> - (unsigned)count; |
| 21 | @end @class NSTimer, NSPort, NSArray; |
| 22 | @class NSURLHandle, NSMutableArray, NSMutableData, NSData, NSURL; |
| 23 | @interface NSResponder : NSObject <NSCoding> { |
| 24 | } |
| 25 | @end @class NSBitmapImageRep, NSCursor, NSGraphicsContext, NSImage, NSPasteboard, NSScrollView, NSWindow, NSAttributedString; |
| 26 | @interface NSView : NSResponder { |
| 27 | struct __VFlags2 { |
| 28 | } |
| 29 | _vFlags2; |
| 30 | } |
| 31 | @end @class NSTextField, NSPanel, NSArray, NSWindow, NSImage, NSButton, NSError; |
| 32 | @interface NSBox : NSView { |
| 33 | } |
| 34 | @end @class GDataFeedDocList, GDataServiceTicket, GDataServiceTicket, IHGoogleDocsAdapter; |
| 35 | @protocol IHGoogleDocsAdapterDelegate - (void)googleDocsAdapter:(IHGoogleDocsAdapter*)inGoogleDocsAdapter accountVerifyIsValid:(BOOL)inIsValid error:(NSError *)inError; |
| 36 | @end @interface IHGoogleDocsAdapter : NSObject { |
| 37 | } |
Fariborz Jahanian | 8822f7c | 2010-03-27 19:02:17 +0000 | [diff] [blame] | 38 | - (NSArray *)entries; // expected-note {{method definition for 'entries' not found}} |
Ted Kremenek | 868210e | 2009-04-21 23:53:32 +0000 | [diff] [blame] | 39 | @end extern Class const kGDataUseRegisteredClass ; |
Fariborz Jahanian | 8822f7c | 2010-03-27 19:02:17 +0000 | [diff] [blame] | 40 | @interface IHGoogleDocsAdapter () - (GDataFeedDocList *)feedDocList; // expected-note {{method definition for 'feedDocList' not found}} |
| 41 | - (NSArray *)directoryPathComponents; // expected-note {{method definition for 'directoryPathComponents' not found}} |
| 42 | - (unsigned int)currentPathComponentIndex; // expected-note {{method definition for 'currentPathComponentIndex' not found}} |
| 43 | - (void)setCurrentPathComponentIndex:(unsigned int)aCurrentPathComponentIndex; // expected-note {{method definition for 'setCurrentPathComponentIndex:' not found}} |
| 44 | - (NSURL *)folderFeedURL; // expected-note {{method definition for 'folderFeedURL' not found}} |
Fariborz Jahanian | 63e963c | 2009-11-16 18:57:01 +0000 | [diff] [blame] | 45 | @end |
| 46 | |
Fariborz Jahanian | 8822f7c | 2010-03-27 19:02:17 +0000 | [diff] [blame] | 47 | @implementation IHGoogleDocsAdapter - (id)initWithUsername:(NSString *)inUsername password:(NSString *)inPassword owner:(NSObject <IHGoogleDocsAdapterDelegate> *)owner { // expected-warning {{incomplete implementation}} |
Mike Stump | 3a3c624 | 2009-07-21 18:58:50 +0000 | [diff] [blame] | 48 | return 0; |
Ted Kremenek | 868210e | 2009-04-21 23:53:32 +0000 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | //===----------------------------------------------------------------------===// |
| 52 | // Actual test case: |
| 53 | // |
| 54 | // The analyzer currently doesn't reason about ObjCKVCRefExpr. Have both |
| 55 | // GRExprEngine::Visit and GRExprEngine::VisitLValue have such expressions |
| 56 | // evaluate to UnknownVal. |
| 57 | //===----------------------------------------------------------------------===// |
| 58 | |
| 59 | - (void)docListListFetchTicket:(GDataServiceTicket *)ticket finishedWithFeed:(GDataFeedDocList *)feed { |
| 60 | BOOL doGetDir = self.directoryPathComponents != 0 && self.currentPathComponentIndex < [self.directoryPathComponents count]; |
| 61 | if (doGetDir) { |
| 62 | BOOL isDirExisting = [[self.feedDocList entries] count] > 0; |
| 63 | if (isDirExisting) { |
| 64 | if (self.folderFeedURL != 0) { |
| 65 | if (++self.currentPathComponentIndex == [self.directoryPathComponents count]) { |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | } |
Fariborz Jahanian | 63e963c | 2009-11-16 18:57:01 +0000 | [diff] [blame] | 71 | @end |