[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / test-objc-non-nil-return-value-checker.m
blob2a9063624639b87036968e0043fea0ceb82b539c
1 // RUN: %clang_analyze_cc1 -analyzer-checker=osx.cocoa.NonNilReturnValue,debug.ExprInspection -verify %s
3 typedef unsigned int NSUInteger;
4 typedef signed char BOOL;
6 @protocol NSObject  - (BOOL)isEqual:(id)object; @end
8 @interface NSObject <NSObject> {}
9 +(id)alloc;
10 +(id)new;
11 -(id)init;
12 -(id)autorelease;
13 -(id)copy;
14 - (Class)class;
15 -(id)retain;
16 @end
18 @interface NSArray : NSObject
19 - (id)objectAtIndex:(unsigned long)index;
20 @end
22 @interface NSArray (NSExtendedArray)
23 - (id)objectAtIndexedSubscript:(NSUInteger)idx;
24 @end
26 @interface NSMutableArray : NSArray
27 - (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;
28 @end
30 @interface NSOrderedSet : NSObject
31 @end
32 @interface NSOrderedSet (NSOrderedSetCreation)
33 - (id)objectAtIndexedSubscript:(NSUInteger)idx;
34 @end
36 void clang_analyzer_eval(id);
38 void assumeThatNSArrayObjectAtIndexIsNeverNull(NSArray *A, NSUInteger i) {
39   clang_analyzer_eval([A objectAtIndex: i]); // expected-warning {{TRUE}} 
40   id subscriptObj = A[1];
41   clang_analyzer_eval(subscriptObj); // expected-warning {{TRUE}} 
44 void assumeThatNSMutableArrayObjectAtIndexIsNeverNull(NSMutableArray *A, NSUInteger i) {
45   clang_analyzer_eval([A objectAtIndex: i]); // expected-warning {{TRUE}} 
48 void assumeThatNSArrayObjectAtIndexedSubscriptIsNeverNull(NSOrderedSet *A, NSUInteger i) {
49   clang_analyzer_eval(A[i]); // expected-warning {{TRUE}}