This is an archive of the discontinued LLVM Phabricator instance.

Support value-typed references in iterator facade's operator->()
ClosedPublic

Authored by csigg on Sep 9 2021, 1:12 AM.

Details

Summary

Add a PointerProxy similar to the existing iterator_facade_base::ReferenceProxy and return it from the arrow operator. This prevents iterator facades with a reference type that is not a true reference to take the address of a temporary.

Forward the reference type of the mapped_iterator to the iterator adaptor which in turn forwards it to the iterator facade. This fixes mlir::op_iterator::operator->() to take the address of a temporary.

Make some polishing changes to op_iterator and op_filter_iterator.

Diff Detail

Event Timeline

csigg created this revision.Sep 9 2021, 1:12 AM
csigg requested review of this revision.Sep 9 2021, 1:12 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptSep 9 2021, 1:12 AM
csigg edited the summary of this revision. (Show Details)Sep 9 2021, 1:14 AM
csigg updated this revision to Diff 371786.Sep 9 2021, 10:29 PM

Rebase.

rriddle accepted this revision.Sep 20 2021, 10:08 AM

Thanks!

mlir/include/mlir/IR/BlockSupport.h
166

Is this the only situation this happens? Can you fix any others as well.

This revision is now accepted and ready to land.Sep 20 2021, 10:08 AM
csigg updated this revision to Diff 373860.Sep 21 2021, 4:37 AM

Fix other mapped_iterators as well.