[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaObjCXX / Inputs / nullability-consistency-1.h
blobf04b5692c88d934591ec251cbbfcb4f3bd2f1076
1 void f1(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}}
2 // expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
3 // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
5 void f2(int * _Nonnull);
7 #include "nullability-consistency-2.h"
9 void f3(int *ptr) { // expected-warning{{pointer is missing a nullability type specifier}}
10 // expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
11 // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
12 int *other = ptr; // shouldn't warn
15 class X {
16 void mf(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}}
17 // expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
18 // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
19 int X:: *memptr; // expected-warning{{member pointer is missing a nullability type specifier}}
20 // expected-note@-1 {{insert '_Nullable' if the member pointer may be null}}
21 // expected-note@-2 {{insert '_Nonnull' if the member pointer should never be null}}
24 template <typename T>
25 struct Typedefs {
26 typedef T *Base; // no-warning
27 typedef Base *type; // expected-warning{{pointer is missing a nullability type specifier}}
28 // expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
29 // expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
32 Typedefs<int> xx;
33 Typedefs<void *> yy;