[PATCH] D132249: [clang][analyzer] Add some functions to StreamChecker with errno modeling.

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 00:46:00 PDT 2022


martong added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.h:110
+/// \arg \c InvalE Expression that causes invalidation of \c errno.
+ProgramStateRef setErrnoStdMustBeChecked(ProgramStateRef State,
+                                         CheckerContext &C, const Expr *InvalE);
----------------
Why do you consider important the `Std` part in the naming?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:880
+
+  // In the success case, do not change 'errno' and errno state.
+  StateFailed = errno_modeling::setErrnoForStdFailure(StateFailed, C,
----------------
Could you please elaborate in the comment why don't we have to use `errno_modeling::setErrnoForStdSuccess` here? 


================
Comment at: clang/test/Analysis/stream-error.c:246
+  int rc = fsetpos(F, &Pos);
+  clang_analyzer_eval(feof(F)); // expected-warning{{FALSE}}
+  if (rc) {
----------------
This might be `TRUE` as well isn't it?  Because only the "successful call to the fseek() function clears the end-of-file indicator". I'd expect this to be TRUE only in the block of `if (rc)`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132249/new/

https://reviews.llvm.org/D132249



More information about the cfe-commits mailing list