llvm-project
703f0ae7 - [ADT] Remove CRTP from FoldingSet and ContextualFoldingSet (NFC) (#216830)

Commit
36 days ago
[ADT] Remove CRTP from FoldingSet and ContextualFoldingSet (NFC) (#216830) This patch simplifies FoldingSet by removing CRTP from FoldingSet and ContextualFoldingSet. Without this patch, FoldingSetImpl uses CRTP to get FoldingSetInfo, a custom "vtable", from FoldingSet and ContextualFoldingSet. With this patch, we put ContextStorage as the base class of FoldingSetImpl. FoldingSetImpl directly takes FoldingSetTrait as a template parameter. This allows us to: - populate FoldingSetInfo for both FoldingSet and ContextualFoldingSet as a static constexpr variable. - rely on the empty base optimization (EBO) on ContextStorage so that FoldingSet incurs no memory overhead. - turn FoldingSet and ContextualFoldingSet into simple type aliases of FoldingSetImpl. Assisted-by: Antigravity
Parents
Loading