================ @@ -941,43 +966,68 @@ class LockableFactEntry : public FactEntry { } }; -class ScopedLockableFactEntry : public FactEntry { +enum UnderlyingCapabilityKind { + UCK_Acquired, ///< Any kind of acquired capability. + UCK_ReleasedShared, ///< Shared capability that was released. + UCK_ReleasedExclusive, ///< Exclusive capability that was released. +}; + +struct UnderlyingCapability { + CapabilityExpr Cap; + UnderlyingCapabilityKind Kind; +}; + +class ScopedLockableFactEntry final + : public FactEntry, + private llvm::TrailingObjects<ScopedLockableFactEntry, + UnderlyingCapability> { + friend TrailingObjects; + private: - enum UnderlyingCapabilityKind { - UCK_Acquired, ///< Any kind of acquired capability. - UCK_ReleasedShared, ///< Shared capability that was released. - UCK_ReleasedExclusive, ///< Exclusive capability that was released. - }; + const unsigned ManagedCapacity; + unsigned ManagedSize = 0; - struct UnderlyingCapability { - CapabilityExpr Cap; - UnderlyingCapabilityKind Kind; - }; + ScopedLockableFactEntry(const CapabilityExpr &CE, SourceLocation Loc, + SourceKind Src, unsigned ManagedCapacity) + : FactEntry(ScopedLockable, CE, LK_Exclusive, Loc, Src), + ManagedCapacity(ManagedCapacity) {} - SmallVector<UnderlyingCapability, 2> UnderlyingMutexes; + void addManaged(const CapabilityExpr &M, UnderlyingCapabilityKind UCK) { + assert(ManagedSize < ManagedCapacity); ---------------- melver wrote:
Fair points. At the very least more comments above the ScopedLockableFactEntry::create and addManaged and wherever else needed to make the danger here clear. https://github.com/llvm/llvm-project/pull/149660 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits