Skip to content

Commit

Permalink
[MLIR] Make DictionaryAttr::getAs take name as && reference
Browse files Browse the repository at this point in the history
As a follow-up to the discussion in https://reviews.llvm.org/D103822,
make the templated `DictionaryAttr::getAs` take the name by `&&`
reference and properly forward the argument to the underlying `get`.
  • Loading branch information
fabianschuiki committed Jun 9, 2021
1 parent 4144827 commit 41135a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions mlir/include/mlir/IR/BuiltinAttributes.td
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,9 @@ def Builtin_DictionaryAttr : Builtin_Attr<"Dictionary"> {
/// Return the specified attribute if present and is an instance of
/// `AttrClass`, null otherwise.
template<typename AttrClass, typename NameClass>
AttrClass getAs(NameClass name) const {
return get(name).template dyn_cast_or_null<AttrClass>();
AttrClass getAs(NameClass &&name) const {
return get(std::forward<NameClass>(name))
.template dyn_cast_or_null<AttrClass>();
}

private:
Expand Down

0 comments on commit 41135a4

Please sign in to comment.