Support value-typed references in iterator facade's operator->()
authorChristian Sigg <csigg@google.com>
Tue, 21 Sep 2021 11:37:06 +0000 (13:37 +0200)
committerChristian Sigg <csigg@google.com>
Tue, 21 Sep 2021 18:42:22 +0000 (20:42 +0200)
commit9149ae09bd1ef2934e2bc7bcaeffbb055739f074
tree7701a18ac75f4e55b890e927252e9eff76469707
parent49c519a84856d018578ed2af625b114771f666e4
Support value-typed references in iterator facade's operator->()

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.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D109490
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/ADT/iterator.h
mlir/include/mlir/IR/BlockSupport.h
mlir/include/mlir/IR/BuiltinAttributes.h
mlir/include/mlir/IR/TypeRange.h
mlir/include/mlir/IR/TypeUtilities.h
mlir/include/mlir/IR/UseDefLists.h
mlir/include/mlir/TableGen/Operator.h