[PATCH] D75682: [Analyzer][StreamChecker] Introduction of stream error handling.

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 03:45:38 PDT 2020


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

LGTM, let's go! Thank you so much for sticking this out!



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:42-51
   /// The error state of a stream.
+  /// Valid only if the stream is opened.
   enum ErrorKindTy {
-    NoError,    /// No error flag is set or stream is not open.
-    EofError,   /// EOF condition (`feof` is true).
-    OtherError, /// Other (non-EOF) error (`ferror` is true).
-    AnyError    /// EofError or OtherError, used if exact error is unknown.
+    /// No error flag is set (or stream is not open).
+    NoError,
+    /// EOF condition (`feof` is true).
+    FEof,
----------------
Can a stream be both `feof` and `ferror`? Let's not delay this patch one moment longer, but a `TODO` to give this some thought might be nice.


================
Comment at: clang/test/Analysis/stream-error.c:1
-// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.unix.Stream -analyzer-checker=debug.ExprInspection -analyzer-store region -verify %s
+// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.unix.StreamTester -analyzer-checker=debug.ExprInspection -analyzer-store region -verify %s
 
----------------
`core` isn't enabled! :o


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75682





More information about the cfe-commits mailing list