================ @@ -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 = ---------------- steakhal wrote:
Personally, I'd prefer a mutable check field for this optional. I kinda dislike local statics. They are harmful for unittesting. For example, if we had 2 unittests, one testing the case where this macro is defined as `1`, and the next one where it's `2`, then the lucky (the faster) unittest would initialize this "global" (static local) optional to `1` and the second unittest would fail. On the other hand, if we had checker locals, then as the engine gets reconstructed, the fields would get a new chance of getting initialized. I had the pleasure debugging similar unittests, and it was not fun. It failed nondeterministically if the whole suite was running, but if you only ran that particular test case, it never failed. That day I learned to avoid local statics. https://github.com/llvm/llvm-project/pull/127049 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits