This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Allow null false positive suppression for conditions
Needs ReviewPublic

Authored by Szelethus on Mar 5 2020, 9:56 AM.

Details

Summary

If the a value has received its value through suspicious means, we suppress it. Tracked conditions are very much relevant to the occurrence of a bug, if their value is fishy, the entire bug report probably is as well.

Diff Detail

Event Timeline

Szelethus created this revision.Mar 5 2020, 9:56 AM
NoQ added a comment.Mar 5 2020, 11:33 AM

Aha! We need some positive results tho, given that these are heuristics.

clang/test/Analysis/inlining/inline-defensive-checks.m
113

This code definitely deserves a warning tho. Regardless of any path-sensitive reasoning, it's trivial to prove that either this line has a division by zero or it's outright dead code. I'd leave a FIXME here. This shouldn't be suppressed.

More importantly, we should have more tests to demonstrate how this patch is useful. I.e., some code snippets in which it's obvious that the suppressed warning is a false positive.

I'm too sure what the implications of such a change is, so I'll get some real-life results before even thinking of commiting.