[RISCV] Simplify usage of SplatPat_simm5_plus1. NFC (#125340)
[llvm-project.git] / clang / test / Analysis / suppression-attr.cpp
blob89bc3c47dbd51a095c59cd649e5382cbe8d0d087
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core -verify %s
3 namespace [[clang::suppress]]
4 suppressed_namespace {
5 int foo() {
6 int *x = 0;
7 return *x;
10 int foo_forward();
13 int suppressed_namespace::foo_forward() {
14 int *x = 0;
15 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
18 // Another instance of the same namespace.
19 namespace suppressed_namespace {
20 int bar() {
21 int *x = 0;
22 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
26 void lambda() {
27 [[clang::suppress]] {
28 auto lam = []() {
29 int *x = 0;
30 return *x;
35 class [[clang::suppress]] SuppressedClass {
36 int foo() {
37 int *x = 0;
38 return *x;
41 int bar();
44 int SuppressedClass::bar() {
45 int *x = 0;
46 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
49 class SuppressedMethodClass {
50 [[clang::suppress]] int foo() {
51 int *x = 0;
52 return *x;
55 [[clang::suppress]] int bar1();
56 int bar2();
59 int SuppressedMethodClass::bar1() {
60 int *x = 0;
61 return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}}
64 [[clang::suppress]]
65 int SuppressedMethodClass::bar2() {
66 int *x = 0;
67 return *x; // no-warning