Add API for bulk-setting attributes in an OperationState
authorKrzysztof Drewniak <krzysd@google.com>
Thu, 25 Jul 2019 23:13:18 +0000 (16:13 -0700)
committerjpienaar <jpienaar@google.com>
Fri, 26 Jul 2019 02:48:25 +0000 (19:48 -0700)
This API is needed for the TFLite flatbuffer importer as the importer constructs
arrays of NamedAttributes based on the flatbuffer that need to be added to an
operation.

PiperOrigin-RevId: 260041403

mlir/include/mlir/IR/OperationSupport.h

index e1971f1..c76f1d6 100644 (file)
@@ -287,6 +287,11 @@ public:
     attributes.push_back({name, attr});
   }
 
+  /// Add an array of named attributes.
+  void addAttributes(ArrayRef<NamedAttribute> newAttributes) {
+    attributes.append(newAttributes.begin(), newAttributes.end());
+  }
+
   void addSuccessor(Block *successor, ArrayRef<Value *> succOperands) {
     successors.push_back(successor);
     // Insert a sentinal operand to mark a barrier between successor operands.