[Mlir-commits] [mlir] 58ec17c - Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)

Mehdi Amini llvmlistbot at llvm.org
Thu Jan 13 18:28:12 PST 2022


Author: Mehdi Amini
Date: 2022-01-14T02:26:28Z
New Revision: 58ec17cb4ea4f3b76f0c948cf4c894ea7ea43552

URL: https://github.com/llvm/llvm-project/commit/58ec17cb4ea4f3b76f0c948cf4c894ea7ea43552
DIFF: https://github.com/llvm/llvm-project/commit/58ec17cb4ea4f3b76f0c948cf4c894ea7ea43552.diff

LOG: Apply clang-tidy fixes for readability-simplify-boolean-expr to MLIR (NFC)

Added: 
    

Modified: 
    mlir/include/mlir/Bindings/Python/PybindAdaptors.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Bindings/Python/PybindAdaptors.h b/mlir/include/mlir/Bindings/Python/PybindAdaptors.h
index 05fb0844ac62..0340e9cc4b87 100644
--- a/mlir/include/mlir/Bindings/Python/PybindAdaptors.h
+++ b/mlir/include/mlir/Bindings/Python/PybindAdaptors.h
@@ -86,10 +86,7 @@ struct type_caster<MlirAttribute> {
   bool load(handle src, bool) {
     py::object capsule = mlirApiObjectToCapsule(src);
     value = mlirPythonCapsuleToAttribute(capsule.ptr());
-    if (mlirAttributeIsNull(value)) {
-      return false;
-    }
-    return true;
+    return !mlirAttributeIsNull(value);
   }
   static handle cast(MlirAttribute v, return_value_policy, handle) {
     py::object capsule =
@@ -117,10 +114,7 @@ struct type_caster<MlirContext> {
     }
     py::object capsule = mlirApiObjectToCapsule(src);
     value = mlirPythonCapsuleToContext(capsule.ptr());
-    if (mlirContextIsNull(value)) {
-      return false;
-    }
-    return true;
+    return !mlirContextIsNull(value);
   }
 };
 
@@ -132,10 +126,7 @@ struct type_caster<MlirLocation> {
   bool load(handle src, bool) {
     py::object capsule = mlirApiObjectToCapsule(src);
     value = mlirPythonCapsuleToLocation(capsule.ptr());
-    if (mlirLocationIsNull(value)) {
-      return false;
-    }
-    return true;
+    return !mlirLocationIsNull(value);
   }
   static handle cast(MlirLocation v, return_value_policy, handle) {
     py::object capsule =
@@ -154,10 +145,7 @@ struct type_caster<MlirModule> {
   bool load(handle src, bool) {
     py::object capsule = mlirApiObjectToCapsule(src);
     value = mlirPythonCapsuleToModule(capsule.ptr());
-    if (mlirModuleIsNull(value)) {
-      return false;
-    }
-    return true;
+    return !mlirModuleIsNull(value);
   }
   static handle cast(MlirModule v, return_value_policy, handle) {
     py::object capsule =
@@ -176,10 +164,7 @@ struct type_caster<MlirOperation> {
   bool load(handle src, bool) {
     py::object capsule = mlirApiObjectToCapsule(src);
     value = mlirPythonCapsuleToOperation(capsule.ptr());
-    if (mlirOperationIsNull(value)) {
-      return false;
-    }
-    return true;
+    return !mlirOperationIsNull(value);
   }
   static handle cast(MlirOperation v, return_value_policy, handle) {
     if (v.ptr == nullptr)
@@ -200,10 +185,7 @@ struct type_caster<MlirPassManager> {
   bool load(handle src, bool) {
     py::object capsule = mlirApiObjectToCapsule(src);
     value = mlirPythonCapsuleToPassManager(capsule.ptr());
-    if (mlirPassManagerIsNull(value)) {
-      return false;
-    }
-    return true;
+    return !mlirPassManagerIsNull(value);
   }
 };
 
@@ -214,10 +196,7 @@ struct type_caster<MlirType> {
   bool load(handle src, bool) {
     py::object capsule = mlirApiObjectToCapsule(src);
     value = mlirPythonCapsuleToType(capsule.ptr());
-    if (mlirTypeIsNull(value)) {
-      return false;
-    }
-    return true;
+    return !mlirTypeIsNull(value);
   }
   static handle cast(MlirType t, return_value_policy, handle) {
     py::object capsule =


        


More information about the Mlir-commits mailing list