From 7d76da539fca28c6e2b920d760223fc39b15d21a Mon Sep 17 00:00:00 2001 From: Adrian Kuegel Date: Fri, 29 Jul 2022 15:17:57 +0200 Subject: [PATCH] [mlir][Complex] Add a convenience getValue() method. This method returns the value as std::complex Differential Revision: https://reviews.llvm.org/D130770 --- mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td b/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td index ab6074e..afae94c 100644 --- a/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td +++ b/mlir/include/mlir/Dialect/Complex/IR/ComplexAttributes.td @@ -53,6 +53,12 @@ def Complex_NumberAttr : Complex_Attr<"Number", "number"> { }]> ]; + let extraClassDeclaration = [{ + std::complex getValue() { + return std::complex(getReal(), getImag()); + } + }]; + let genVerifyDecl = 1; let hasCustomAssemblyFormat = 1; let skipDefaultBuilders = 1; -- 2.7.4