From 41135a4367a75cf02d9873be7bd904456ce77329 Mon Sep 17 00:00:00 2001 From: Fabian Schuiki Date: Wed, 9 Jun 2021 10:03:18 +0200 Subject: [PATCH] [MLIR] Make DictionaryAttr::getAs take name as && reference 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`. --- mlir/include/mlir/IR/BuiltinAttributes.td | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mlir/include/mlir/IR/BuiltinAttributes.td b/mlir/include/mlir/IR/BuiltinAttributes.td index c25c5ad..4947c26 100644 --- a/mlir/include/mlir/IR/BuiltinAttributes.td +++ b/mlir/include/mlir/IR/BuiltinAttributes.td @@ -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 - AttrClass getAs(NameClass name) const { - return get(name).template dyn_cast_or_null(); + AttrClass getAs(NameClass &&name) const { + return get(std::forward(name)) + .template dyn_cast_or_null(); } private: -- 2.7.4