This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Add 'freopen' support to SimpleStreamChecker.
AbandonedPublic

Authored by balazske on Sep 11 2019, 11:46 PM.

Details

Reviewers
NoQ
Szelethus
Summary

The checker now recognizes 'freopen' as file opening function.
Added support for binding the return value to the passed stream.

Event Timeline

balazske created this revision.Sep 11 2019, 11:46 PM
Szelethus retitled this revision from [Clang][Checkers] Add 'freopen' support to SimpleStreamChecker. to [analyzer] Add 'freopen' support to SimpleStreamChecker..Sep 12 2019, 8:18 AM
Szelethus added reviewers: NoQ, Szelethus.
NoQ added a comment.Sep 12 2019, 2:45 PM

SimpleStreamChecker is a historical tutorial example, i don't think we should be updating it other than for modernizing checker API use. It was supposed to handle a few simple examples correctly but it wasn't supposed to support all sorts of different APIs.

I'd recommend improving StreamChecker instead if you're interested in having a production-quality checker for everyday use.

Code of StreamChecker does not look much better, it uses deprecated eval::Call and does not check for escape. But it handles more functions and error at open (still not freopen). A mixture of both would be a better option.

balazske abandoned this revision.Sep 18 2019, 2:45 AM

I try to improve StreamChecker instead.

NoQ added a comment.Sep 18 2019, 2:41 PM

Btw, evalCall is not deprecated. In fact, there are no alternatives for it in many cases.