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

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 26 08:07:17 PDT 2020


balazske marked an inline comment as done.
balazske added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:857-868
+    // FEof and other states are possible.
+    // The path with FEof is the one that can continue.
+    // For this reason a non-fatal error is generated to continue the analysis
+    // with only FEof state set.
+    ExplodedNode *N = C.generateNonFatalErrorNode(State);
+    if (N) {
+      C.emitReport(std::make_unique<PathSensitiveBugReport>(
----------------
Szelethus wrote:
> Szelethus wrote:
> > Ugh, tough one. I think this just isn't really *the* error to highlight here, but rather that its bad practice to not check on the stream after an operation. But I'm willing to accept I might be wrong here.
> Actually, I take this back. If we had `NoteTag`s to explain that "this stream operation failed and left the stream file position indication in an indeterminate state", this would be great.
Adding of `NoteTag` and other bug path improvements are planned in the next changes. (The message text could mention that error check was probably forgotten. But the faulty function can be called despite the error check was done.)


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