[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Analysis / region-store.c
blob86b8c27991f80a9ec9d62c1bec545bd39fc963c2
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,unix,debug.ExprInspection -verify -analyzer-config eagerly-assume=false %s
3 int printf(const char *restrict,...);
5 // Testing core functionality of the region store.
6 // radar://10127782
7 int compoundLiteralTest(void) {
8 int index = 0;
9 for (index = 0; index < 2; index++) {
10 int thing = (int []){0, 1}[index];
11 printf("thing: %i\n", thing);
13 return 0;
16 int compoundLiteralTest2(void) {
17 int index = 0;
18 for (index = 0; index < 3; index++) {
19 int thing = (int [][3]){{0,0,0}, {1,1,1}, {2,2,2}}[index][index];
20 printf("thing: %i\n", thing);
22 return 0;
25 int concreteOffsetBindingIsInvalidatedBySymbolicOffsetAssignment(int length,
26 int i) {
27 int values[length];
28 values[i] = 4;
29 return values[0]; // no-warning
32 struct X{
33 int mem;
35 int initStruct(struct X *st);
36 int structOffsetBindingIsInvalidated(int length, int i){
37 struct X l;
38 initStruct(&l);
39 return l.mem; // no-warning
42 void clang_analyzer_eval(int);
43 void testConstraintOnRegionOffset(int *values, int length, int i){
44 if (values[1] == 4) {
45 values[i] = 5;
46 clang_analyzer_eval(values[1] == 4);// expected-warning {{UNKNOWN}}
50 int initArray(int *values);
51 void testConstraintOnRegionOffsetStack(int *values, int length, int i) {
52 if (values[0] == 4) {
53 initArray(values);
54 clang_analyzer_eval(values[0] == 4);// expected-warning {{UNKNOWN}}