This is an archive of the discontinued LLVM Phabricator instance.

[Analyzer][StreamChecker] Adding PreCall and refactoring (NFC).
ClosedPublic

Authored by balazske on Mar 4 2020, 7:53 AM.

Details

Summary

Adding PreCall callback.
Argument validity checks are moved into the PreCall callback.
Code is restructured, functions renamed.
There are "pre" and "eval" functions for the file operations.
And additional state check (validate) functions.

Diff Detail

Event Timeline

balazske created this revision.Mar 4 2020, 7:53 AM
Herald added a project: Restricted Project. · View Herald Transcript
Szelethus accepted this revision.Mar 5 2020, 3:13 AM

LGTM! Lets have a link to the original discussion: D75163

This revision is now accepted and ready to land.Mar 5 2020, 3:13 AM

Wouldn't it be better just to upload this diff to D75163 by the way? It feels like we're discarding much of the discussion.

This revision was automatically updated to reflect the committed changes.
martong added inline comments.Mar 6 2020, 6:48 AM
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
321

Just a quick note here. We are going to be able to do similar arg checks but in a generic way, once apiModeling.StdLibraryFunctionsChecker is clever enough. https://reviews.llvm.org/D75063
Sooner or later we will have a summary for these file handling functions, and that time the non-null argument constraint violation will be reported by either of the two checkers. Then we would be able to remove the nonnull check from here if we make StdLibraryFunctionsChecker a dependency.