[Mlir-commits] [llvm] [mlir] [mlir] Fix bazel after efd96af. (PR #160158)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Sep 22 10:50:24 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- mlir/lib/Bindings/Python/IRCore.cpp mlir/lib/Bindings/Python/IRModule.h mlir/lib/Bindings/Python/NanobindUtils.h
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp
index 9e60bc6a6..70058d8ca 100644
--- a/mlir/lib/Bindings/Python/IRCore.cpp
+++ b/mlir/lib/Bindings/Python/IRCore.cpp
@@ -1550,8 +1550,10 @@ nb::typed<nb::object, PyOpView> PyOperation::createOpView() {
   auto operationCls = PyGlobals::get().lookupOperationClass(
       StringRef(identStr.data, identStr.length));
   if (operationCls)
-    return nanobind::cast<nanobind::typed<nanobind::object, PyOpView>>(PyOpView::constructDerived(*operationCls, getRef().getObject()));
-  return nanobind::cast<nanobind::typed<nanobind::object, PyOpView>>(nb::cast(PyOpView(getRef().getObject())));
+    return nanobind::cast<nanobind::typed<nanobind::object, PyOpView>>(
+        PyOpView::constructDerived(*operationCls, getRef().getObject()));
+  return nanobind::cast<nanobind::typed<nanobind::object, PyOpView>>(
+      nb::cast(PyOpView(getRef().getObject())));
 }
 
 void PyOperation::erase() {
@@ -2143,8 +2145,10 @@ nb::typed<nb::object, PyAttribute> PyAttribute::maybeDownCast() {
   // contents into a new instance that will be owned by Python.
   nb::object thisObj = nb::cast(this, nb::rv_policy::move);
   if (!typeCaster)
-    return nanobind::cast<nanobind::typed<nanobind::object, PyAttribute>>(thisObj);
-  return nanobind::cast<nanobind::typed<nanobind::object, PyAttribute>>(typeCaster.value()(thisObj));
+    return nanobind::cast<nanobind::typed<nanobind::object, PyAttribute>>(
+        thisObj);
+  return nanobind::cast<nanobind::typed<nanobind::object, PyAttribute>>(
+      typeCaster.value()(thisObj));
 }
 
 //------------------------------------------------------------------------------
@@ -2190,7 +2194,8 @@ nb::typed<nb::object, PyType> PyType::maybeDownCast() {
   nb::object thisObj = nb::cast(this, nb::rv_policy::move);
   if (!typeCaster)
     return nanobind::cast<nanobind::typed<nanobind::object, PyType>>(thisObj);
-  return nanobind::cast<nanobind::typed<nanobind::object, PyType>>(typeCaster.value()(thisObj));
+  return nanobind::cast<nanobind::typed<nanobind::object, PyType>>(
+      typeCaster.value()(thisObj));
 }
 
 //------------------------------------------------------------------------------
@@ -2231,7 +2236,8 @@ nanobind::typed<nanobind::object, PyValue> PyValue::maybeDownCast() {
   nb::object thisObj = nb::cast(this, nb::rv_policy::move);
   if (!valueCaster)
     return nanobind::cast<nanobind::typed<nanobind::object, PyValue>>(thisObj);
-  return nanobind::cast<nanobind::typed<nanobind::object, PyValue>>(valueCaster.value()(thisObj));
+  return nanobind::cast<nanobind::typed<nanobind::object, PyValue>>(
+      valueCaster.value()(thisObj));
 }
 
 PyValue PyValue::createFromCapsule(nb::object capsule) {
diff --git a/mlir/lib/Bindings/Python/IRModule.h b/mlir/lib/Bindings/Python/IRModule.h
index 633b11f6f..c4e87e5ea 100644
--- a/mlir/lib/Bindings/Python/IRModule.h
+++ b/mlir/lib/Bindings/Python/IRModule.h
@@ -53,7 +53,8 @@ template <typename T>
 class PyObjectRef {
 public:
   PyObjectRef(T *referrent, nanobind::object object)
-      : referrent(referrent), object(nanobind::cast<nanobind::typed<nanobind::object, T>>(object)) {
+      : referrent(referrent),
+        object(nanobind::cast<nanobind::typed<nanobind::object, T>>(object)) {
     assert(this->referrent &&
            "cannot construct PyObjectRef with null referrent");
     assert(this->object && "cannot construct PyObjectRef with null object");

``````````

</details>


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


More information about the Mlir-commits mailing list