[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / uninit-val-const-likeness.c
blob013ab7882755a06632119d37ad35473b3550afb1
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core %s -verify
2 // expected-no-diagnostics
4 #define SIZE 2
6 typedef struct {
7 int noOfSymbols;
8 } Params;
10 static void create(const Params * const params, int fooList[]) {
11 int tmpList[SIZE] = {0};
12 for (int i = 0; i < params->noOfSymbols; i++)
13 fooList[i] = tmpList[i];
16 int work(Params * const params) {
17 int fooList[SIZE];
18 create(params, fooList);
19 int sum = 0;
20 for (int i = 0; i < params->noOfSymbols; i++)
21 sum += fooList[i]; // no-warning
22 return sum;
25 static void create2(const Params * const * pparams, int fooList[]) {
26 const Params * params = *pparams;
27 int tmpList[SIZE] = {0};
28 for (int i = 0; i < params->noOfSymbols; i++)
29 fooList[i] = tmpList[i];
32 int work2(const Params * const params) {
33 int fooList[SIZE];
34 create2(&params, fooList);
35 int sum = 0;
36 for (int i = 0; i < params->noOfSymbols; i++)
37 sum += fooList[i]; // no-warning
38 return sum;
41 static void create3(Params * const * pparams, int fooList[]) {
42 const Params * params = *pparams;
43 int tmpList[SIZE] = {0};
44 for (int i = 0; i < params->noOfSymbols; i++)
45 fooList[i] = tmpList[i];
48 int work3(const Params * const params) {
49 int fooList[SIZE];
50 Params *const *ptr = (Params *const*)&params;
51 create3(ptr, fooList);
52 int sum = 0;
53 for (int i = 0; i < params->noOfSymbols; i++)
54 sum += fooList[i]; // no-warning
55 return sum;
58 typedef Params ParamsTypedef;
59 typedef const ParamsTypedef *ConstParamsTypedef;
61 static void create4(ConstParamsTypedef const params, int fooList[]) {
62 int tmpList[SIZE] = {0};
63 for (int i = 0; i < params->noOfSymbols; i++)
64 fooList[i] = tmpList[i];
67 int work4(Params * const params) {
68 int fooList[SIZE];
69 create4(params, fooList);
70 int sum = 0;
71 for (int i = 0; i < params->noOfSymbols; i++)
72 sum += fooList[i]; // no-warning
73 return sum;