xref: /llvm-project/clang/test/Analysis/nullability-arc.mm (revision b22a5d46179b0ec2d5350c078dc349f09177b9ed)
1// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,nullability\
2// RUN:                       -analyzer-output=text -verify %s
3// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,nullability\
4// RUN:                       -analyzer-output=text -verify %s -fobjc-arc
5
6
7
8#define nil ((id)0)
9
10@interface Param
11@end
12
13@interface Base
14- (void)foo:(Param *_Nonnull)param;
15@end
16
17@interface Derived : Base
18@end
19
20@implementation Derived
21- (void)foo:(Param *)param {
22  // FIXME: Why do we not emit the warning under ARC?
23  [super foo:param];
24
25  [self foo:nil];
26  // expected-warning@-1{{nil passed to a callee that requires a non-null 1st parameter}}
27  // expected-note@-2   {{nil passed to a callee that requires a non-null 1st parameter}}
28}
29@end
30
31