1 // RUN: %clang_cc1 -analyzer-check-objc-mem -verify %s
2 typedef signed char BOOL;
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> {
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;
18 NSFastEnumerationState;
19 @protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len;
21 typedef struct _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> {
33 @end @protocol NSAnimatablePropertyContainer - (id)animator;
34 @end extern NSString *NSAnimationTriggerOrderIn ;
35 @interface NSView : NSResponder <NSAnimatablePropertyContainer> {
37 @end @class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView;
38 @interface NSWindowController : NSResponder <NSCoding> {
40 @end @class NSArray, NSFont, NSTabViewItem;
41 @interface NSTabView : NSView {
43 - (NSArray *)tabViewItems;
46 PBXNoItemChanged = 0x00, PBXProjectItemChanged = 0x01, PBXReferenceChanged = 0x02, PBXGroupChanged = 0x04, PBXTargetChanged = 0x08, PBXBuildPhaseChanged = 0x10, PBXBuildFileChanged = 0x20, PBXBreakpointChanged = 0x40, }
48 @interface PBXModule : NSWindowController {
51 PBXFindMatchContains, PBXFindMatchStartsWith, PBXFindMatchWholeWords, PBXFindMatchEndsWith }
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> {
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> {
69 @end @class PBXProjectDocument, PBXFileReference, PBXModule, XCWindowTool;
70 @interface XCPerspectiveModule : PBXProjectModule <PBXSelectionTarget> { // expected-note {{required for direct or indirect protocol 'PBXSelectionTarget'}}
71 XCExtendedTabView *_perspectivesTabView;
73 - (PBXModule *) moduleForTab:(NSTabViewItem *)item; // expected-note {{method definition for 'moduleForTab:' not found}}
75 @implementation XCPerspectiveModule // expected-warning {{incomplete implementation}} \
76 // expected-warning {{method in protocol not implemented [-Wprotocol]}}
77 + (void) openForProjectDocument:(PBXProjectDocument *)projectDocument {
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];
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];
93 - (BOOL)buffer:(char *)buf containsAnyPrompts:(char *[])prompts