[clang] [clang][analyzer] Fix false positive of BlockInCriticalSectionChecker (PR #127049)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 13 19:49:08 PST 2025


================
@@ -306,6 +314,25 @@ void BlockInCriticalSectionChecker::handleUnlock(
   C.addTransition(State);
 }
 
+void BlockInCriticalSectionChecker::handleOpen(const CallEvent &Call,
+                                               CheckerContext &C) const {
+  const auto *Flag = Call.getArgExpr(1);
+  static std::optional<int> ValueOfONonBlockVFlag =
----------------
flovent wrote:

I think in this specific situation `O_NONBLOCK` Marco should not be redefined in user code normally since it's used by system API like `open`? should we evaluate it's value every time?

https://github.com/llvm/llvm-project/pull/127049


More information about the cfe-commits mailing list