[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / Analysis / explain-svals.c
blob4e095efbab777dc054cc21d2823d340c5ea8a539
1 // RUN: %clang_analyze_cc1 -triple i386-apple-darwin10 -verify %s \
2 // RUN: -analyzer-checker=core.builtin \
3 // RUN: -analyzer-checker=debug.ExprInspection \
4 // RUN: -analyzer-checker=unix.cstring \
5 // RUN: -analyzer-config display-checker-name=false
7 struct S {
8 int z;
9 };
11 void clang_analyzer_explain_int(int);
12 void clang_analyzer_explain_voidp(void *);
13 void clang_analyzer_explain_S(struct S);
15 int glob;
17 void test_1(int param, void *ptr) {
18 clang_analyzer_explain_voidp(&glob); // expected-warning-re{{{{^pointer to global variable 'glob'$}}}}
19 clang_analyzer_explain_int(param); // expected-warning-re{{{{^argument 'param'$}}}}
20 clang_analyzer_explain_voidp(ptr); // expected-warning-re{{{{^argument 'ptr'$}}}}
21 if (param == 42)
22 clang_analyzer_explain_int(param); // expected-warning-re{{{{^signed 32-bit integer '42'$}}}}
25 void test_2(struct S s) {
26 clang_analyzer_explain_S(s); //expected-warning-re{{{{^lazily frozen compound value of parameter 's'$}}}}
27 clang_analyzer_explain_voidp(&s); // expected-warning-re{{{{^pointer to parameter 's'$}}}}
28 clang_analyzer_explain_int(s.z); // expected-warning-re{{{{^initial value of field 'z' of parameter 's'$}}}}
31 void test_3(int param) {
32 clang_analyzer_explain_voidp(&param); // expected-warning-re{{{{^pointer to parameter 'param'$}}}}
35 void test_non_top_level(int param) {
36 clang_analyzer_explain_voidp(&param); // expected-warning-re{{{{^pointer to parameter 'param'$}}}}
39 void test_4(int n) {
40 test_non_top_level(n);