[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaObjCXX / Inputs / nullability-consistency-7.h
blobed61666e6e746e2f28a3a67e398837e62368d535
1 #ifndef SOMEKIT_H
2 #define SOMEKIT_H
4 __attribute__((objc_root_class))
5 #ifndef NS_ASSUME_NONNULL_BEGIN
6 #if __has_feature(assume_nonnull)
7 #define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
8 #define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end")
9 #else
10 #define NS_ASSUME_NONNULL_BEGIN
11 #define NS_ASSUME_NONNULL_END
12 #endif
13 #endif
15 NS_ASSUME_NONNULL_BEGIN
17 @interface A
18 -(null_unspecified A*)transform:(null_unspecified A*)input __attribute__((unavailable("anything but this")));
19 -(A*)transform:(A*)input integer:(int)integer;
21 @property (null_unspecified, nonatomic, readonly, retain) A* someA;
22 @property (null_unspecified, nonatomic, retain) A* someOtherA;
24 @property (nonatomic) int intValue __attribute__((unavailable("wouldn't work anyway")));
25 @end
27 NS_ASSUME_NONNULL_END
30 __attribute__((unavailable("just don't")))
31 @interface B : A
32 @end
34 @interface C : A
35 - (instancetype)init; // expected-warning{{pointer is missing a nullability type specifier}}
36 // expected-note@-1{{insert '_Nullable' if the pointer may be null}}
37 // expected-note@-2{{insert '_Nonnull' if the pointer should never be null}}
38 - (instancetype)initWithA:( A*)a __attribute__((objc_designated_initializer)); // expected-warning 2{{pointer is missing a nullability type specifier}}
39 // expected-note@-1 2{{insert '_Nullable' if the pointer may be null}}
40 // expected-note@-2 2{{insert '_Nonnull' if the pointer should never be null}}
41 @end
43 #endif