This is an archive of the discontinued LLVM Phabricator instance.

PDB HashTable: Make iterator type const
ClosedPublic

Authored by thakis on Jul 12 2019, 8:35 AM.

Details

Summary

Having the hash table key change during iteration is bad, so make it
impossible. Nothing relied on the key type not being const. Nothing
needed a mutable value either, so make the whole pair const.
Also rename the iterator typedef to const_iterator.

(This is also necessary to be able to call the const version of
iterator_facade_base::operator->(). Nothing calls this yet, but
I'm adding a few calls to it in a dependent change.)

No behavior change.

Diff Detail

Event Timeline

thakis created this revision.Jul 12 2019, 8:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2019, 8:35 AM
thakis edited the summary of this revision. (Show Details)Jul 12 2019, 9:22 AM
thakis retitled this revision from PDB HashTable: Make iterator key type const to PDB HashTable: Make iterator type const.Jul 14 2019, 6:02 PM
thakis edited the summary of this revision. (Show Details)
compnerd accepted this revision.Jul 14 2019, 6:43 PM
compnerd added a subscriber: compnerd.

Yeah, mutations of the hashtable during iteration would be bad. LGTM.

This revision is now accepted and ready to land.Jul 14 2019, 6:43 PM
This revision was automatically updated to reflect the committed changes.