[PATCH] D122150: [clang][analyzer] Add checker for bad use of 'errno'.

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 19 00:57:26 PDT 2022


steakhal accepted this revision.
steakhal added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoChecker.cpp:47
+  /// Indicates if a read (load) of \c errno is allowed in a non-condition part
+  /// of \c if, \c switch, loop and conditional statements when the errno
+  /// value may be undefined.
----------------
You prefixed the previous two keywords with the `\c` marker. Why is it missing from the `switch`?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoChecker.cpp:100
+    case Expr::BinaryConditionalOperatorClass:
+      CondFound = (S == cast<BinaryConditionalOperator>(ParentS)->getCommon());
+      break;
----------------
Oh, so the test added for this actually uncovered a bug?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122150



More information about the cfe-commits mailing list