1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s 2 3 void clang_analyzer_eval(int); 4 5 void testAnd(int i, int *p) { 6 int *nullP = 0; 7 int *knownP = &i; 8 clang_analyzer_eval((knownP && knownP) == 1); // expected-warning{{TRUE}} 9 clang_analyzer_eval((knownP && nullP) == 0); // expected-warning{{TRUE}} 10 clang_analyzer_eval((knownP && p) == 1); // expected-warning{{UNKNOWN}} 11 } 12 13 void testOr(int i, int *p) { 14 int *nullP = 0; 15 int *knownP = &i; 16 clang_analyzer_eval((nullP || knownP) == 1); // expected-warning{{TRUE}} 17 clang_analyzer_eval((nullP || nullP) == 0); // expected-warning{{TRUE}} 18 clang_analyzer_eval((nullP || p) == 1); // expected-warning{{UNKNOWN}} 19 } 20 21 22 // PR13461 23 int testTypeIsInt(int i, void *p) { 24 if (i | (p && p)) 25 return 1; 26 return 0; 27 } 28