This is an archive of the discontinued LLVM Phabricator instance.

DebugInfo: Make DWARFExpression::iterator a const iterator
ClosedPublic

Authored by dexonsmith on Nov 15 2021, 5:39 PM.

Details

Summary

3d1d8c767be5537eb5510ee0522e2f3475fe7c04 made
DWARFExpression::iterator's Operation member mutable. After a few prep
commits, the iterator can instead be made a const iterator since no
caller can change the Operation.

Depends on https://reviews.llvm.org/D113957.

Diff Detail

Event Timeline

dexonsmith created this revision.Nov 15 2021, 5:39 PM
dexonsmith requested review of this revision.Nov 15 2021, 5:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2021, 5:39 PM
Herald added a subscriber: MaskRay. · View Herald Transcript

[No change; just re-triggering builds after telling Phabricator this depends on the other patch.]

Clang-format nit, as per linter. Otherwise, seems reasonable to me (if it can be const it probably should be!). My only question is should it be renamed to const_iterator to avoid any confusion?

dblaikie accepted this revision.Nov 16 2021, 9:17 AM

Looks good to me - I don't mind it still being called iterator rather than const_iterator - if it's the only iterator over the range anyway. (ArrayRef's iterator isn't called const_iterator for instance, even though it is only constant)

llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
132–133

Side note: the class keyword here could be removed.

This revision is now accepted and ready to land.Nov 16 2021, 9:17 AM
This revision was landed with ongoing or failed builds.Nov 16 2021, 10:26 AM
This revision was automatically updated to reflect the committed changes.
dexonsmith marked an inline comment as done.

Thanks for the reviews! Pushed in fd6018072ace7d5cdf537fd63a44c050a98e52fc.

Clang-format nit, as per linter.

Fixed!

My only question is should it be renamed to const_iterator to avoid any confusion?

Tend to agree with @dblaikie that iterator is clear/simple so I left this as is.

llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
132–133

Fixed.