[Mlir-commits] [mlir] 0aa3072 - [mlir] NFC NamedAttrList append with StringAttr
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Feb 17 12:30:36 PST 2022
Author: Mogball
Date: 2022-02-17T20:30:25Z
New Revision: 0aa3072649f20756bc06e8747d1a39cb1bbaeab1
URL: https://github.com/llvm/llvm-project/commit/0aa3072649f20756bc06e8747d1a39cb1bbaeab1
DIFF: https://github.com/llvm/llvm-project/commit/0aa3072649f20756bc06e8747d1a39cb1bbaeab1.diff
LOG: [mlir] NFC NamedAttrList append with StringAttr
NamedAttrList.append(StringAttr, StringAttr) fails to compile because it is
matched to the IteratorT append. Fixes the method to only match if the type is
an iterator.
Added:
Modified:
mlir/include/mlir/IR/OperationSupport.h
mlir/unittests/IR/OperationSupportTest.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 7a055bf055c7d..5ae07287b88c0 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -466,7 +466,10 @@ class NamedAttrList {
}
/// Add a range of named attributes.
- template <typename IteratorT>
+ template <typename IteratorT,
+ typename = std::enable_if_t<std::is_convertible<
+ typename std::iterator_traits<IteratorT>::iterator_category,
+ std::input_iterator_tag>::value>>
void append(IteratorT in_start, IteratorT in_end) {
// TODO: expand to handle case where values appended are in order & after
// end of current list.
diff --git a/mlir/unittests/IR/OperationSupportTest.cpp b/mlir/unittests/IR/OperationSupportTest.cpp
index 6484d7c50d19b..2511a5d3b6bfd 100644
--- a/mlir/unittests/IR/OperationSupportTest.cpp
+++ b/mlir/unittests/IR/OperationSupportTest.cpp
@@ -232,7 +232,7 @@ TEST(NamedAttrListTest, TestAppendAssign) {
NamedAttrList attrs;
Builder b(&ctx);
- attrs.append("foo", b.getStringAttr("bar"));
+ attrs.append(b.getStringAttr("foo"), b.getStringAttr("bar"));
attrs.append("baz", b.getStringAttr("boo"));
{
More information about the Mlir-commits
mailing list