[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 26 12:08:41 PDT 2025


================
@@ -235,6 +266,20 @@ class FactSet {
     return false;
   }
 
+  std::optional<FactID> replaceLock(FactManager &FM, iterator It,
+                                    std::unique_ptr<FactEntry> Entry) {
+    if (It == end())
+      return std::nullopt;
+    FactID F = FM.newFact(std::move(Entry));
+    *It = F;
+    return F;
+  }
+
+  std::optional<FactID> replaceLock(FactManager &FM, const CapabilityExpr &CapE,
+                                    std::unique_ptr<FactEntry> Entry) {
+    return replaceLock(FM, findLockIter(FM, CapE), std::move(Entry));
+  }
+
----------------
aaronpuchert wrote:

Can't we just use `removeLock` and then `addLock`?

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


More information about the cfe-commits mailing list