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