brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · a732170 Raw
38 lines · cpp
1// RUN: %clang_analyze_cc1 %s \2// RUN:   -analyzer-checker=core \3// RUN:   -analyzer-checker=debug.ExprInspection \4// RUN:   -analyzer-config eagerly-assume=false \5// RUN:   -verify6 7// In this test we check whether the solver's symbol simplification mechanism8// is capable of re-assuming simiplified symbols.9 10void clang_analyzer_eval(bool);11void clang_analyzer_warnIfReached();12 13void test_reassume_false_range(int x, int y) {14  if (x + y != 0) // x + y == 015    return;16  if (x != 1)     // x == 117    return;18  clang_analyzer_eval(y == -1); // expected-warning{{TRUE}}19}20 21void test_reassume_true_range(int x, int y) {22  if (x + y != 1) // x + y == 123    return;24  if (x != 1)     // x == 125    return;26  clang_analyzer_eval(y == 0); // expected-warning{{TRUE}}27}28 29void test_reassume_inclusive_range(int x, int y) {30  if (x + y < 0 || x + y > 1) // x + y: [0, 1]31    return;32  if (x != 1)                 // x == 133    return;34                              // y: [-1, 0]35  clang_analyzer_eval(y > 0); // expected-warning{{FALSE}}36  clang_analyzer_eval(y < -1);// expected-warning{{FALSE}}37}38