llvm-project
627f8018 - [ADT] Rename NumNonEmpty to NumEntries in SmallPtrSet (NFC) (#153757)

Commit
48 days ago
[ADT] Rename NumNonEmpty to NumEntries in SmallPtrSet (NFC) (#153757) Without this patch, we use NumNonEmpty, which keeps track of the number of valid entries plus tombstones even though we have a separate variable to keep track of the number of tombstones. This patch simplifies the metadata. Specifically, it changes the name and semantics of the variable to NumEntries to keep track of the number of valid entries. The difference in semantics requires some code changes aside from mechanical replacements: - size() just returns NumEntries. - erase_imp() and remove_if() need to decrement NumEntries in the large mode. - insert_imp_big() increments NumEntries for successful insertions, regardless of whether a tombstone is being replaced with a valid entry. It also computes the number of non-tombstone empty slots as: CurArraySize - NumEntries - NumTombstones - Grow() no longer needs NumNonEmpty -= NumTombstones. Overall, the resulting code should look more intuitive and more consistent with DenseMapSet.
Parents
Loading