[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Analysis / nonnull.cpp
bloba3a0568686ae2b787a86160e40613aee52b11d72
1 // RUN: %clang_analyze_cc1 -std=c++11 -analyzer-checker=core -verify %s
3 void nonnull [[gnu::nonnull]] (int *q);
5 void f1(int *p) {
6 if (p)
7 return;
8 nonnull(p); //expected-warning{{nonnull}}
11 void f2(int *p) {
12 if (p)
13 return;
14 auto lambda = [](int *q) __attribute__((nonnull)){};
15 lambda(p); //expected-warning{{nonnull}}
18 template <class... ARGS>
19 void variadicNonnull(ARGS... args) __attribute__((nonnull));
21 void f3(int a, float b, int *p) {
22 if (p)
23 return;
24 variadicNonnull(a, b, p); //expected-warning{{nonnull}}
27 int globalVar = 15;
28 void moreParamsThanArgs [[gnu::nonnull(2, 4)]] (int a, int *p, int b = 42, int *q = &globalVar);
30 void f4(int a, int *p) {
31 if (p)
32 return;
33 moreParamsThanArgs(a, p); //expected-warning{{nonnull}}