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

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 1 08:24:30 PDT 2022


martong added inline comments.


================
Comment at: clang/include/clang/StaticAnalyzer/Checkers/Checkers.td:554
+    CmdLineOption<Boolean,
+                  "AllowNonConditionErrnoRead",
+                  "Allow read of undefined value from errno outside of conditions",
----------------
I think this name would be much more easier to read.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoChecker.cpp:46
+
+  /// Indicates if a read (load) of 'errno' is allowed in a non-conditional
+  /// statement.
----------------
Or `in a statement without a condition` ?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/ErrnoChecker.cpp:67
+
+static bool isInCondition(const Stmt *S, CheckerContext &C) {
+  ParentMapContext &ParentCtx = C.getASTContext().getParentMapContext();
----------------
Please add a documentation to this.


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