This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Add `TaintBugVisitor` to the ArrayBoundV2, DivideZero and VLASize.
ClosedPublic

Authored by MTC on Apr 24 2018, 6:15 AM.

Diff Detail

Repository
rC Clang

Event Timeline

MTC created this revision.Apr 24 2018, 6:15 AM

Mostly LG.

lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
75

In this patch, sometimes we check the visitor to be non-null, sometimes not. As I can see, BugReport::addVisitor() works well with nullptr arguments (it checks arguments) so I think we can omit the checks.

MTC marked an inline comment as done.Apr 25 2018, 5:25 AM
MTC added inline comments.
lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp
75

Thanks for your reminder, a.sidorin!

My mistakes led to some checkers doing the check and some did not check! But as you said, there is no need to check the nullptr.

I will update the patch.

MTC updated this revision to Diff 143908.Apr 25 2018, 5:31 AM
MTC marked an inline comment as done.

Since BugReport::addVisitor() has checks for the null Visitor, remove the checks before BugReport->addVisitor().

NoQ accepted this revision.Apr 27 2018, 5:08 PM

Looks great, thanks!

I think the overall plan for any taint work would be to remove it from the program state API and move getters/setters into its own translation unit (like dynamic type propagation) as part of the overall plan to introduce shared checker states. So, like, not just the visitor, but the whole trait itself.

This revision is now accepted and ready to land.Apr 27 2018, 5:08 PM
This revision was automatically updated to reflect the committed changes.