balazske marked an inline comment as done. balazske added a comment. I do not like to make difference between error from `fseek` and error from any other function that may fail. `AnyError` can be used to handle every case. After a failed file operation we do not know if it was `feof` or `ferror` kind of error. `fseek` is only special because it can fail additionally without `feof` or `ferror`. If the kind of the last operation needs to be known later, it can be saved in the stream state.
================ Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:382-384 + C.addTransition(StateNotFailed); + C.addTransition(StateFailedWithFError); + C.addTransition(StateFailedWithoutFError); ---------------- Szelethus wrote: > This seems a bit excessive, we could merge the last two into `FSeekError`. There are 3 cases: - `fseek` did not fail at all. Return value is zero. This is `StateNotFailed`. - `fseek` failed but none of the error flags is true afterwards. Return value is nonzero but `feof` and `ferror` are not true. This is `StateFailedWithoutFError`. - `fseek` failed and we have `feof` or `ferror` set (never both). Return value is nonzero and `feof` or `ferror` will be true. This is `StateFailedWithFError`. And an use of `AnyError`, otherwise we need here 2 states, one for `feof` and one for `ferror`. But it is not important here if `feof` or `ferror` is actually true, so the special value `AnyError` is used and only one new state instead of two. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75851/new/ https://reviews.llvm.org/D75851 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits