[PATCH] D72705: [analyzer] Added new checker 'alpha.unix.ErrorReturn'.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 08:22:06 PDT 2020


balazske added a comment.

More results in CodeChecker: emacs_errorreturn <https://codechecker-demo.eastus.cloudapp.azure.com/Default/reports?run=emacs_errorreturn&review-status=Unreviewed&review-status=Confirmed%20bug&detection-status=New&detection-status=Reopened&detection-status=Unresolved>



================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrorReturnChecker.cpp:79-80
+                                  bool ChildIsLHS) const override {
+    if (!KnownValue)
+      return false;
+
----------------
balazske wrote:
> balazske wrote:
> > Szelethus wrote:
> > > So if we failed to get retrieve the value we're checking against, we automatically assume that its not a proper check? Shouldn't we be conservative here? What if that value is something like `getEOFValue()`?
> > This case needs attention, now it is detected as failure (maybe the function can return `Optional<bool>` to indicate a non-determinable case).
> This case is now not error.
> A test is added for this case.
> ```
>   int R = fputs("str", file());
>   if (R == getEOFValue())
>     return;
> ```
> This is no warning now (but `getEOFValue` can return anything).
The whole function is now refactored to have better behavior.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72705



More information about the cfe-commits mailing list