1*12887a20SGabor Marton // RUN: %clang_analyze_cc1 %s \ 2*12887a20SGabor Marton // RUN: -analyzer-checker=core \ 3*12887a20SGabor Marton // RUN: -analyzer-checker=debug.ExprInspection \ 4*12887a20SGabor Marton // RUN: -analyzer-config eagerly-assume=false \ 5*12887a20SGabor Marton // RUN: -verify 6*12887a20SGabor Marton 7*12887a20SGabor Marton // Here we test whether the SValBuilder is capable to simplify existing 8*12887a20SGabor Marton // SVals based on a newly added constraints when evaluating a BinOp. 9*12887a20SGabor Marton 10*12887a20SGabor Marton void clang_analyzer_eval(bool); 11*12887a20SGabor Marton test_evalBinOp_simplifies_lhs(int y)12*12887a20SGabor Martonvoid test_evalBinOp_simplifies_lhs(int y) { 13*12887a20SGabor Marton int x = y / 77; 14*12887a20SGabor Marton if (y != 77) 15*12887a20SGabor Marton return; 16*12887a20SGabor Marton 17*12887a20SGabor Marton // Below `x` is the LHS being simplified. 18*12887a20SGabor Marton clang_analyzer_eval(x == 1); // expected-warning{{TRUE}} 19*12887a20SGabor Marton (void)(x * y); 20*12887a20SGabor Marton } 21*12887a20SGabor Marton test_evalBinOp_simplifies_rhs(int y)22*12887a20SGabor Martonvoid test_evalBinOp_simplifies_rhs(int y) { 23*12887a20SGabor Marton int x = y / 77; 24*12887a20SGabor Marton if (y != 77) 25*12887a20SGabor Marton return; 26*12887a20SGabor Marton 27*12887a20SGabor Marton // Below `x` is the RHS being simplified. 28*12887a20SGabor Marton clang_analyzer_eval(1 == x); // expected-warning{{TRUE}} 29*12887a20SGabor Marton (void)(x * y); 30*12887a20SGabor Marton } 31