Home | History | Annotate | Download | only in Analysis
      1 // RUN: %clang_cc1 -analyzer-checker=core -verify %s
      2 typedef signed char BOOL;
      3 typedef int NSInteger;
      4 typedef unsigned int NSUInteger;
      5 typedef struct _NSZone NSZone;
      6 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator;
      7 @protocol NSObject  - (BOOL)isEqual:(id)object;
      8 @end  @protocol NSCopying  - (id)copyWithZone:(NSZone *)zone;
      9 @end  @protocol NSMutableCopying  - (id)mutableCopyWithZone:(NSZone *)zone;
     10 @end  @protocol NSCoding  - (void)encodeWithCoder:(NSCoder *)aCoder;
     11 @end    @interface NSObject <NSObject> {
     12 }
     13 @end    extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
     14 @interface NSValue : NSObject <NSCopying, NSCoding>  - (void)getValue:(void *)value;
     15 @end       @class NSString, NSData, NSMutableData, NSMutableDictionary, NSMutableArray;
     16 typedef struct {
     17 }
     18   NSFastEnumerationState;
     19 @protocol NSFastEnumeration  - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
     20 @end        @class NSString;
     21 typedef struct _NSRange {
     22 }
     23   NSRange;
     24 @interface NSValue (NSValueRangeExtensions)  + (NSValue *)valueWithRange:(NSRange)range;
     25 - (id)objectAtIndex:(NSUInteger)index;
     26 @end         typedef unsigned short unichar;
     27 @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding>    - (NSUInteger)length;
     28 @end       @class NSArray, NSDictionary, NSString, NSError;
     29 @interface NSSet : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration>  - (NSUInteger)count;
     30 @end    extern NSString *NSAccessibilityRoleDescription(NSString *role, NSString *subrole)     ;
     31 @interface NSResponder : NSObject <NSCoding> {
     32 }
     33 @end    @protocol NSAnimatablePropertyContainer      - (id)animator;
     34 @end  extern NSString *NSAnimationTriggerOrderIn ;
     35 @interface NSView : NSResponder  <NSAnimatablePropertyContainer>  {
     36 }
     37 @end  @class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView;
     38 @interface NSWindowController : NSResponder <NSCoding> {
     39 }
     40 @end @class NSArray, NSFont, NSTabViewItem;
     41 @interface NSTabView : NSView {
     42 }
     43 - (NSArray *)tabViewItems;
     44 - (NSString *)label;
     45 @end typedef enum {
     46 PBXNoItemChanged = 0x00,     PBXProjectItemChanged = 0x01,     PBXReferenceChanged = 0x02,     PBXGroupChanged = 0x04,     PBXTargetChanged = 0x08,     PBXBuildPhaseChanged = 0x10,     PBXBuildFileChanged = 0x20,     PBXBreakpointChanged = 0x40, }
     47   PBXArchiveMask;
     48 @interface PBXModule : NSWindowController {
     49 }
     50 @end       typedef enum {
     51 PBXFindMatchContains,     PBXFindMatchStartsWith,     PBXFindMatchWholeWords,     PBXFindMatchEndsWith }
     52   PBXFindMatchStyle;
     53 @protocol PBXSelectableText  - (NSString *)selectedString;
     54 @end  @protocol PBXFindableText <PBXSelectableText>    - (BOOL)findText:(NSString *)string ignoreCase:(BOOL)ignoreCase matchStyle:(PBXFindMatchStyle)matchStyle backwards:(BOOL)backwards wrap:(BOOL)wrap;
     55 @end  @class PBXProjectDocument, PBXProject, PBXAttributedStatusView;
     56 @interface PBXProjectModule : PBXModule <PBXFindableText> {
     57 }
     58 @end @class PBXBookmark;
     59 @protocol PBXSelectionTarget - (NSObject <PBXSelectionTarget> *) performAction:(id)action withSelection:(NSArray *)selection;  // expected-note {{method declared here}}
     60 @end @class XCPropertyDictionary, XCPropertyCondition, XCPropertyConditionSet, XCMutablePropertyConditionSet;
     61 extern NSMutableArray *XCFindPossibleKeyModules(PBXModule *module, BOOL useExposedModulesOnly);
     62 @interface NSString (StringUtilities) - (NSString *) trimToLength:(NSInteger)length preserveRange:(NSRange)range;
     63 - (id) objectOfType:(Class)type matchingFunction:(BOOL (void *, void *))comparator usingData:(void *)data;
     64 @end  @class XCControlView;
     65 @protocol XCDockViewHeader - (NSImage *) headerImage;
     66 @end  @class XCDockableTabModule;
     67 @interface XCExtendedTabView : NSTabView <XCDockViewHeader> {
     68 }
     69 @end     @class PBXProjectDocument, PBXFileReference, PBXModule, XCWindowTool;
     70 @interface XCPerspectiveModule : PBXProjectModule <PBXSelectionTarget> { // expected-note {{required for direct or indirect protocol 'PBXSelectionTarget'}}
     71   XCExtendedTabView *_perspectivesTabView;
     72 }
     73 - (PBXModule *) moduleForTab:(NSTabViewItem *)item; // expected-note {{method definition for 'moduleForTab:' not found}}
     74 @end  
     75 @implementation XCPerspectiveModule // expected-warning {{incomplete implementation}} \
     76 				    // expected-warning {{method in protocol not implemented [-Wprotocol]}}
     77 + (void) openForProjectDocument:(PBXProjectDocument *)projectDocument {
     78 }
     79 - (PBXModule *) type:(Class)type inPerspective:(id)perspectiveIdentifer  matchingFunction:(BOOL (void *, void *))comparator usingData:(void *)data {
     80   NSArray *allItems = [_perspectivesTabView tabViewItems];
     81   NSInteger i, c = [allItems count];
     82   for (i = 0;
     83        i < c;
     84        i++) {
     85     NSTabViewItem *item = [allItems objectAtIndex:i];
     86     if ([[item label] isEqual:perspectiveIdentifer]) {
     87       PBXProjectModule *pModule = (PBXProjectModule *)[self moduleForTab:item];
     88       PBXModule *obj = [XCFindPossibleKeyModules(pModule, (BOOL)0) objectOfType:type     matchingFunction:comparator usingData:data];
     89     }
     90   }
     91   return 0;
     92 }
     93 - (BOOL)buffer:(char *)buf containsAnyPrompts:(char *[])prompts
     94 {
     95  prompts++;
     96  return (BOOL)0;
     97 }
     98 @end
     99