Update the existing modeling of stream functions in StreamChecker
with 'errno' modeling. The not (yet) evaluated stream functions
are not updated.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp | ||
---|---|---|
283–284 | Have you considered using llvm::Optional<int> for this? | |
537 | I believe, getDecl() might return null, e.g. for calling a function pointer. | |
clang/test/Analysis/stream-errno.c | ||
13–14 | So these two lines correspond to the following clang_analyzer_eval(). |
StdLibraryFunctionsChecker should not overwrite errno constraints
that are set by StreamChecker.
- Use Optional for EofInitialized
- Split tests into two files with and without note check.
clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp | ||
---|---|---|
537 | In this case the function should be known (we know that fopen is the called function, if the name is known the Decl should be known too), I think it can not be null here. |
LGTM, thanks!
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | ||
---|---|---|
465 | Makes sense. |
A new solution is in D135247. The new approach is that only StdLibraryFunctionsChecker adds the errno modeling part, together with other checks (that are applicable if StreamChecker is turned off) for pre and post conditions at the stream functions.
Makes sense.