[Mlir-commits] [mlir] [MLIR] add C-API bindings for complex dialect (PR #173228)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Dec 22 02:27:03 PST 2025


Sergio =?utf-8?q?Sánchez_Ramírez?=,
Sergio =?utf-8?q?Sánchez_Ramírez?=,
Sergio =?utf-8?q?Sánchez_Ramírez?=,
Sergio =?utf-8?q?Sánchez_Ramírez?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/173228 at github.com>


================
@@ -0,0 +1,43 @@
+//===- Complex.cpp - C Interface for Complex dialect ----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir-c/Dialect/Complex.h"
+#include "mlir-c/IR.h"
+#include "mlir-c/Support.h"
+#include "mlir/CAPI/Registration.h"
+
+MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Complex, complex,
+                                      mlir::complex::ComplexDialect)
+
+bool mlirAttributeIsAComplex(MlirAttribute attr) {
+  return llvm::isa<ComplexAttr>(unwrap(attr));
----------------
ftynse wrote:

Nit
```suggestion
  return isa<ComplexAttr>(unwrap(attr));
```

https://github.com/llvm/llvm-project/pull/173228


More information about the Mlir-commits mailing list