[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)
Marco Elver via cfe-commits
cfe-commits at lists.llvm.org
Fri May 9 11:36: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));
+ }
+
----------------
melver wrote:
replaceLock without caller-iterator still saves a copy+pop_back+push_back. Not much, but not nothing either.
This PR should include the bare minimum use of replaceLock - I have one patch queued that is not part of this PR to do an unrelated substitution with replaceLock.
If anything I'd move replaceLock introduction before this PR, but I think we're just splitting hairs at that point.
https://github.com/llvm/llvm-project/pull/137133
More information about the cfe-commits
mailing list