[llvm-branch-commits] [clang] Thread Safety Analysis: Track try-acquired capabilities as a ternary try-held state (PR #220635)
Aaron Puchert via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Nov 15 16:53:02 PST 2026
================
@@ -149,6 +219,26 @@ class FactEntry : public CapabilityExpr {
bool declared() const { return Source == Declared; }
bool managed() const { return Source == Managed; }
+ bool tryHeld() const { return TryLock.getInt(); }
+ const Expr *tryLockCall() const { return TryLock.getPointer(); }
+
+ /// Whether the capability is definitely held at least once: it is not
+ /// try-held, or only the top level of a reentrant acquisition is
+ /// conditional while the levels below it are definite.
+ virtual bool definitelyHeld() const { return !tryHeld(); }
+
+ /// The fact's reentrancy depth; only lockable facts can be reentrant.
----------------
aaronpuchert wrote:
That begs the question: why is this a virtual function on `FactEntry`, instead of only a function on `LockableFactEntry`?
https://github.com/llvm/llvm-project/pull/220635
More information about the llvm-branch-commits
mailing list