This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] [NFC] Heavy refactoring of trackNullOrUndefValue
ClosedPublic

Authored by george.karpenkov on Sep 25 2018, 2:07 PM.

Details

Summary

Last time spent fixing a bug here encouraged me to try to understand semantics of this method,
and it seems there was a lot of code duplication and convoluted logic here.

This patch aims to straighten semantics up, or at least make it somewhat more straightforward.
We have an input statement, and for it we try to find a sub-expression "Inner".
Then we try to find a node corresponding to "Inner", and we add visitors there, if it is "interesting".

Otherwise, we try to track the value and the contents of the sub-expression at a state.

Diff Detail

Event Timeline

NoQ accepted this revision.Sep 26 2018, 3:55 PM

Hope this code will eventually become understandable :)

clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
1612–1619

I think this comment is still relevant (though probably it should be made more clear, because it takes me like 10 minutes to figure out what exactly did i mean here every time i read it).

1648

I remember very vaguely that this assertion helped us find a bug once. If it's possible to keep it somehow, it'd be great. But it's not worth the extra argument.

This revision is now accepted and ready to land.Sep 26 2018, 3:55 PM
george.karpenkov marked an inline comment as done.Sep 26 2018, 6:36 PM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.