view clang/test/SemaObjCXX/Inputs/nullability-consistency-1.h @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1d019706d866
children
line wrap: on
line source

void f1(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}}
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}

void f2(int * _Nonnull);

#include "nullability-consistency-2.h"

void f3(int *ptr) { // expected-warning{{pointer is missing a nullability type specifier}}
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
  int *other = ptr; // shouldn't warn
}

class X {
  void mf(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}}
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
  int X:: *memptr; // expected-warning{{member pointer is missing a nullability type specifier}}
// expected-note@-1 {{insert '_Nullable' if the member pointer may be null}}
// expected-note@-2 {{insert '_Nonnull' if the member pointer should never be null}}
};

template <typename T>
struct Typedefs {
  typedef T *Base; // no-warning
  typedef Base *type; // expected-warning{{pointer is missing a nullability type specifier}}
// expected-note@-1 {{insert '_Nullable' if the pointer may be null}}
// expected-note@-2 {{insert '_Nonnull' if the pointer should never be null}}
};

Typedefs<int> xx;
Typedefs<void *> yy;