[PATCH] D80018: [Analyzer][StreamChecker] Added check for "indeterminate file position".

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 27 05:55:09 PDT 2020


Szelethus accepted this revision.
Szelethus added a comment.
This revision is now accepted and ready to land.

LGTM! This patch is great! I think you're doing a great job with this project.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:670
 
-  State = State->set<StreamMap>(StreamSym, StreamState::getOpened(Desc));
+  // FilePositionIndeterminate is not cleared.
+  State = State->set<StreamMap>(
----------------
balazske wrote:
> Szelethus wrote:
> > But what if I inspect errno and conclude that the file position is intact? Is there such a thing? After a call to stream operation that might leave the file position indicator indeterminate and getting ferror, am I supposed to fseek or reopen the file no matter what?
> > 
> > 
> There is not much information about what `errno` values mean an indeterminate file position (and what errno values are possible at all after a specific operation). Probably we can assume that only position reset (`fseek`, `fsetpos`, `rewind`) and `fflush` fixes the wrong state. Many of stream handling code anyway aborts the operation if error happens.
Yeah, this makes sense. We should double check the standard in time though.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80018





More information about the cfe-commits mailing list