Does anyone know if clang static analyzer has the ability to tell me,
for each use of a variable, the program point(s) at which the
variable's current value might have first been obtained?
For example, suppose I have the code below. I'd like to know if the
static analyzer can tell me that on line 11, the value of 'z' is
definitely one of the RHS expressions on 2, 7, or 15.
Thanks,
Christian
begin example <<<<<<<<
int source1() {
int x = fread(...); <--- line 2
return x;
}
int source2() {
return 42; <--- line 7
}
void consumer( int y ) {
printf("%d", y); <--- line 11
};
int main( int argc, const char* argv ) {
int z = 9; <--- line 15
if (argc == 3) {
z = source1();
}
else if (argc > 3) {
z = source2();
}
consumer(z);
}