================ @@ -114,31 +112,39 @@ class FactEntry : public CapabilityExpr { }; private: - const FactEntryKind Kind : 8; + const FactEntryKind Kind : 4; /// Exclusive or shared. - LockKind LKind : 8; + const LockKind LKind : 4; + + /// How it was acquired. + const SourceKind Source : 4; - // How it was acquired. - SourceKind Source : 8; + /// Reentrancy depth; 16 bits should be enough given that FactID is a short, + /// and thus we can't store more than 65536 facts anyway. + unsigned int ReentrancyDepth : 16; /// Where it was acquired. - SourceLocation AcquireLoc; + const SourceLocation AcquireLoc; public: FactEntry(FactEntryKind FK, const CapabilityExpr &CE, LockKind LK, SourceLocation Loc, SourceKind Src) - : CapabilityExpr(CE), Kind(FK), LKind(LK), Source(Src), AcquireLoc(Loc) {} + : CapabilityExpr(CE), Kind(FK), LKind(LK), Source(Src), + ReentrancyDepth(0), AcquireLoc(Loc) {} virtual ~FactEntry() = default; LockKind kind() const { return LKind; } SourceLocation loc() const { return AcquireLoc; } FactEntryKind getFactEntryKind() const { return Kind; } + unsigned int getReentrancyDepth() const { return ReentrancyDepth; } bool asserted() const { return Source == Asserted; } bool declared() const { return Source == Declared; } bool managed() const { return Source == Managed; } + virtual std::unique_ptr<FactEntry> clone() const = 0; ---------------- aaronpuchert wrote:
Not sure if this makes sense. When we clone facts (to modify them), we should always know which kind of fact we're dealing with. In our case it should always be a `LockableFactEntry`. So you can just use `cast` and the copy constructor. https://github.com/llvm/llvm-project/pull/137133 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits