[llvm] d5fcb79 - [STLExtras] Make const the * operator for mapped_iterator.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 11:05:03 PDT 2020
Author: Alina Sbirlea
Date: 2020-04-14T11:04:20-07:00
New Revision: d5fcb7966e0eded6393d728e2a38f2d55e2d61e0
URL: https://github.com/llvm/llvm-project/commit/d5fcb7966e0eded6393d728e2a38f2d55e2d61e0
DIFF: https://github.com/llvm/llvm-project/commit/d5fcb7966e0eded6393d728e2a38f2d55e2d61e0.diff
LOG: [STLExtras] Make const the * operator for mapped_iterator.
Summary:
The current non-const * operator shadows the const operator in
iterator_adaptor_base.
Reviewers: mehdi_amini, rriddle!, dblaikie, timshen
Subscribers: dexonsmith, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78073
Added:
Modified:
llvm/include/llvm/ADT/STLExtras.h
mlir/include/mlir/IR/Attributes.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 529219ef239c..215bc5a2919f 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -214,7 +214,7 @@ class mapped_iterator
ItTy getCurrent() { return this->I; }
- FuncReturnTy operator*() { return F(*this->I); }
+ FuncReturnTy operator*() const { return F(*this->I); }
private:
FuncTy F;
diff --git a/mlir/include/mlir/IR/Attributes.h b/mlir/include/mlir/IR/Attributes.h
index e71359e0dacb..51b6edf8ddda 100644
--- a/mlir/include/mlir/IR/Attributes.h
+++ b/mlir/include/mlir/IR/Attributes.h
@@ -228,7 +228,7 @@ class ArrayAttr : public Attribute::AttrBase<ArrayAttr, Attribute,
explicit attr_value_iterator(ArrayAttr::iterator it)
: llvm::mapped_iterator<ArrayAttr::iterator, AttrTy (*)(Attribute)>(
it, [](Attribute attr) { return attr.cast<AttrTy>(); }) {}
- AttrTy operator*() { return (*this->I).template cast<AttrTy>(); }
+ AttrTy operator*() const { return (*this->I).template cast<AttrTy>(); }
};
public:
More information about the llvm-commits
mailing list