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`.
/// 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: