blob: c32a7f780ece0afddb3c523ad9499f3eccc6f962 [file] [log] [blame]
Jordan Rosefe6a0112012-07-02 19:28:21 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
2
3@interface MyObject
4- (void)takePointer:(void *)ptr __attribute__((nonnull(1)));
5@end
6
7void testNonNullMethod(int *p, MyObject *obj) {
8 if (p)
9 return;
10 [obj takePointer:p]; // expected-warning{{nonnull}}
11}
12
13
14@interface Subclass : MyObject
15// [[nonnull]] is an inherited attribute.
16- (void)takePointer:(void *)ptr;
17@end
18
19void testSubclass(int *p, Subclass *obj) {
20 if (p)
21 return;
22 [obj takePointer:p]; // expected-warning{{nonnull}}
23}