[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / Analysis / main.c
bloba3b4a958e0b592d4719896e55fca47adf5c1c8b3
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -verify %s
3 int x = 1;
5 struct {
6 int a, b;
7 } s = {2, 3};
9 int arr[] = {4, 5, 6};
11 void clang_analyzer_eval(int);
13 int main(void) {
14 // In main() we know that the initial values are still valid.
15 clang_analyzer_eval(x == 1); // expected-warning{{TRUE}}
16 clang_analyzer_eval(s.a == 2); // expected-warning{{TRUE}}
17 clang_analyzer_eval(s.b == 3); // expected-warning{{TRUE}}
18 clang_analyzer_eval(arr[0] == 4); // expected-warning{{TRUE}}
19 clang_analyzer_eval(arr[1] == 5); // expected-warning{{TRUE}}
20 clang_analyzer_eval(arr[2] == 6); // expected-warning{{TRUE}}
21 return 0;
24 void foo(void) {
25 // In other functions these values may already be overwritten.
26 clang_analyzer_eval(x == 1); // expected-warning{{TRUE}} // expected-warning{{FALSE}}
27 clang_analyzer_eval(s.a == 2); // expected-warning{{TRUE}} // expected-warning{{FALSE}}
28 clang_analyzer_eval(s.b == 3); // expected-warning{{TRUE}} // expected-warning{{FALSE}}
29 clang_analyzer_eval(arr[0] == 4); // expected-warning{{TRUE}} // expected-warning{{FALSE}}
30 clang_analyzer_eval(arr[1] == 5); // expected-warning{{TRUE}} // expected-warning{{FALSE}}
31 clang_analyzer_eval(arr[2] == 6); // expected-warning{{TRUE}} // expected-warning{{FALSE}}