[clang] Thread Safety Analysis: Support reentrant capabilities (PR #137133)
Aaron Puchert via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 24 17:12:52 PDT 2025
================
@@ -163,15 +184,15 @@ using FactID = unsigned short;
/// the analysis of a single routine.
class FactManager {
private:
- std::vector<std::unique_ptr<const FactEntry>> Facts;
+ std::vector<std::unique_ptr<FactEntry>> Facts;
----------------
aaronpuchert wrote:
This does not work, `FactEntry` has to remain `const`. See Delesley's comment in https://reviews.llvm.org/D51187:
> It's been a while since I last looked at this code, but I don't think you can use mutable fields in a FactEntry. The analysis creates a FactSet for each program point, but each FactSet simply has pointers (FactIDs) for the underlying FactEntries. If you change the definition of a FactEntry, it will change that definition for every program point.
I think the same applies here. You need to create new facts. (As a follow-up to my mistake, I added this `const`. Perhaps I should add a comment that it's there for a reason.)
https://github.com/llvm/llvm-project/pull/137133
More information about the cfe-commits
mailing list