diff --git a/mlir/include/mlir/IR/BuiltinAttributes.td b/mlir/include/mlir/IR/BuiltinAttributes.td --- a/mlir/include/mlir/IR/BuiltinAttributes.td +++ b/mlir/include/mlir/IR/BuiltinAttributes.td @@ -114,13 +114,13 @@ public: template - iterator_range> getAsRange() { + iterator_range> getAsRange() const { return llvm::make_range(attr_value_iterator(begin()), attr_value_iterator(end())); } template - auto getAsValueRange() { + auto getAsValueRange() const { return llvm::map_range(getAsRange(), [](AttrTy attr) { return static_cast(attr.getValue()); }); @@ -345,9 +345,9 @@ /// Return the specified attribute if present and is an instance of /// `AttrClass`, null otherwise. - template - AttrClass getAs(StringRef name) { - return get(name).dyn_cast_or_null(); + template + AttrClass getAs(NameClass name) const { + return get(name).template dyn_cast_or_null(); } private: