[PATCH] D137790: [clang][analyzer] Remove report of null stream from StreamChecker.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 4 07:40:23 PST 2023


balazske added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:507-511
+  // FIXME: Use a return value from EvalFn instead of isDifferent.
+  // Some functions should not change state and not have any other
+  // (invalidation, including errno) effect.
+  // For example if 'feof' is used with unknown stream we know that errno does
+  // not change (and presumably no other state that is otherwise invalidated).
----------------
Szelethus wrote:
> Okay, but how does `CheckerContext::isDifferent()` misbehave in that case?
I do not know exactly why I put this this FIXME here. I was probably thinking about a situation when `errno` does not change in any case and the modeled function (`feof`) has no other effect. But `feof` should not change `errno` only if the stream is valid, and if the stream is unknown it may be invalid. Now the `evalCall` returns false, a default evaluation follows and `errno` is invalidated, this is how it should work. The FIXME can be removed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137790



More information about the cfe-commits mailing list