This patch introduces the clang_analyzer_isTainted expression inspection check for checking taint.
Using this we could query the analyzer whether the expression used as the argument is tainted or not.
This would be useful in tests, where we don't want to issue warning for all tainted expressions in a given file (like the debug.TaintTest would do) but only for certain expressions.
Example usage:
int read_integer() { int n; clang_analyzer_isTainted(n); // expected-warning{{NO}} scanf("%d", &n); clang_analyzer_isTainted(n); // expected-warning{{YES}} clang_analyzer_isTainted(n + 2); // expected-warning{{YES}} clang_analyzer_isTainted(n > 0); // expected-warning{{YES}} return n; }
I think a comment somewhere why/when do we check only the prefix would be useful.