This is an archive of the discontinued LLVM Phabricator instance.

[clang][analyzer] Extend StreamChecker with some new functions.

Authored by balazske on Dec 20 2022, 5:58 AM.



The stream handling functions ftell, rewind, fgetpos, fsetpos
are evaluated in the checker more exactly than before.
New tests are added to test behavior of the checker together with
StdLibraryFunctionsChecker. The option ModelPOSIX of that checker
affects if (most of) the stream functions are recognized, and checker
StdLibraryFunctionArgs generates warnings if constraints for arguments
are not satisfied. The state of errno is set by StdLibraryFunctionsChecker
too for every case in the stream functions.
StreamChecker works with the stream state only, does not set the errno state,
and is not dependent on other checkers.

Diff Detail

Event Timeline

balazske created this revision.Dec 20 2022, 5:58 AM
Herald added a reviewer: NoQ. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
balazske requested review of this revision.Dec 20 2022, 5:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2022, 5:58 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript

Does this patch fix any false positives from before, or is this just all new stuff? I ask, because I wonder whats the shortest path towards popping these checkers out of alpha, and fix what we already have. By no means am I saying that we should postpone landing this, but take a more directed attempt at tying off loose ends after this stack.


Why the comment? Seems like its solely StdLibraryFunctionChecker's job to handle errno.




Can you break this line up, such that we have an -analyzer-checker= argument for each package/checker?

balazske updated this revision to Diff 485928.Jan 3 2023, 12:28 AM
balazske marked 2 inline comments as done.

Removed old commment, updated a test run line.

Mostly LGTM, but I see that you have tests for the predecessor patch here as well, so I'll accept both at once.


When can this occur?

This revision is now accepted and ready to land.Jan 4 2023, 6:36 AM