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