From 6750365d544faad358db69e2e75d9bf9e580e570 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Wed, 21 Dec 2022 17:42:37 +0100 Subject: [PATCH] Applying readability-simplify-boolean-expr clang-tidy fixes --- src/class_diagram/model/template_parameter.cc | 8 +++----- src/common/model/diagram_filter.h | 5 +---- src/common/model/tvl.h | 4 ++-- src/sequence_diagram/visitor/translation_unit_visitor.cc | 5 +---- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/class_diagram/model/template_parameter.cc b/src/class_diagram/model/template_parameter.cc index 1fe15bcc..32a8c510 100644 --- a/src/class_diagram/model/template_parameter.cc +++ b/src/class_diagram/model/template_parameter.cc @@ -86,11 +86,9 @@ bool template_parameter::is_variadic() const noexcept { return is_variadic_; } bool template_parameter::is_specialization_of( const template_parameter &ct) const { - if ((ct.is_template_parameter() || ct.is_template_template_parameter()) && - !is_template_parameter()) - return true; - - return false; + return (ct.is_template_parameter() || + ct.is_template_template_parameter()) && + !is_template_parameter(); } void template_parameter::add_template_param(template_parameter &&ct) diff --git a/src/common/model/diagram_filter.h b/src/common/model/diagram_filter.h index 0d521048..09944f95 100644 --- a/src/common/model/diagram_filter.h +++ b/src/common/model/diagram_filter.h @@ -347,10 +347,7 @@ public: auto inc = tvl::all_of(inclusive_.begin(), inclusive_.end(), [this, &e](const auto &in) { return in->match(diagram_, e); }); - if (tvl::is_undefined(inc) || tvl::is_true(inc)) - return true; - - return false; + return static_cast(tvl::is_undefined(inc) || tvl::is_true(inc)); } private: diff --git a/src/common/model/tvl.h b/src/common/model/tvl.h index 4f31b93f..1d795708 100644 --- a/src/common/model/tvl.h +++ b/src/common/model/tvl.h @@ -38,7 +38,7 @@ inline value_t all_of(InputIterator first, InputIterator last, Predicate pred) for (InputIterator it = first; it != last; it++) { value_t m = pred(*it); if (m.has_value()) { - if (m.value() == true) { + if (m.value()) { res = true; } else { @@ -59,7 +59,7 @@ inline value_t any_of(InputIterator first, InputIterator last, Predicate pred) for (InputIterator it = first; it != last; it++) { value_t m = pred(*it); if (m.has_value()) { - if (m.value() == true) { + if (m.value()) { res = true; break; } diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index 648907e1..e78b65dd 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -2125,10 +2125,7 @@ bool translation_unit_visitor::should_include(const clang::CallExpr *expr) const return false; const auto expr_file = expr->getBeginLoc().printToString(source_manager()); - if (!diagram().should_include(common::model::source_file{expr_file})) - return false; - - return true; + return diagram().should_include(common::model::source_file{expr_file}); } bool translation_unit_visitor::should_include(