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

This commit is contained in:
Mehdi Amini 2022-01-14 01:36:05 +00:00
parent cac7aabbd8
commit 58ec17cb4e
1 changed files with 7 additions and 28 deletions

View File

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