diff --git a/src/class_diagram/visitor/translation_unit_visitor.cc b/src/class_diagram/visitor/translation_unit_visitor.cc index fa76e677..21452752 100644 --- a/src/class_diagram/visitor/translation_unit_visitor.cc +++ b/src/class_diagram/visitor/translation_unit_visitor.cc @@ -315,10 +315,8 @@ bool translation_unit_visitor::VisitClassTemplateDecl( forward_declarations_.emplace(id, std::move(c_ptr)); return true; } - else { - process_class_declaration(*cls->getTemplatedDecl(), *c_ptr); - forward_declarations_.erase(id); - } + process_class_declaration(*cls->getTemplatedDecl(), *c_ptr); + forward_declarations_.erase(id); if (diagram_.should_include(*c_ptr)) { const auto name = c_ptr->full_name(); @@ -387,8 +385,7 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) forward_declarations_.emplace(id, std::move(c_ptr)); return true; } - else - forward_declarations_.erase(id); + forward_declarations_.erase(id); if (diagram_.should_include(class_model)) { LOG_DBG("Adding class {} with id {}", class_model.full_name(false), @@ -2152,8 +2149,7 @@ bool translation_unit_visitor::simplify_system_template( ct.clear_params(); return true; } - else - return false; + return false; } void translation_unit_visitor::set_ast_local_id( diff --git a/src/common/clang_utils.cc b/src/common/clang_utils.cc index 26afd5c0..f9dd7a7f 100644 --- a/src/common/clang_utils.cc +++ b/src/common/clang_utils.cc @@ -286,7 +286,7 @@ template <> id_t to_id(const clang::TemplateArgument &template_argument) return to_id(*template_argument.getAsType() ->getAs() ->getAsTagDecl()); - else if (template_argument.getAsType()->getAs()) + if (template_argument.getAsType()->getAs()) return to_id(*template_argument.getAsType() ->getAs() ->getAsRecordDecl()); diff --git a/src/common/model/diagram_filter.cc b/src/common/model/diagram_filter.cc index 69b64aec..11353147 100644 --- a/src/common/model/diagram_filter.cc +++ b/src/common/model/diagram_filter.cc @@ -194,12 +194,8 @@ tvl::value_t namespace_filter::match( return result; }); } - else { - return tvl::any_of( - namespaces_.begin(), namespaces_.end(), [&e](const auto &nsit) { - return e.get_namespace().starts_with(nsit); - }); - } + return tvl::any_of(namespaces_.begin(), namespaces_.end(), + [&e](const auto &nsit) { return e.get_namespace().starts_with(nsit); }); } element_filter::element_filter(filter_t type, std::vector elements) diff --git a/src/common/model/nested_trait.h b/src/common/model/nested_trait.h index bc74cf0d..43b23bef 100644 --- a/src/common/model/nested_trait.h +++ b/src/common/model/nested_trait.h @@ -70,11 +70,9 @@ public: if (parent && dynamic_cast *>(&parent.value())) return dynamic_cast &>(parent.value()) .template add_element(std::move(p)); - else { - spdlog::info("No parent element found at: {}", path.to_string()); - throw std::runtime_error( - "No parent element found for " + path.to_string()); - } + spdlog::info("No parent element found at: {}", path.to_string()); + throw std::runtime_error( + "No parent element found for " + path.to_string()); } template auto get_element(const Path &path) const diff --git a/src/common/model/tvl.h b/src/common/model/tvl.h index b77dcf7e..4f31b93f 100644 --- a/src/common/model/tvl.h +++ b/src/common/model/tvl.h @@ -63,9 +63,7 @@ inline value_t any_of(InputIterator first, InputIterator last, Predicate pred) res = true; break; } - else { - res = false; - } + res = false; } } diff --git a/src/config/config.cc b/src/config/config.cc index 6890ecf3..0ecb0ccc 100644 --- a/src/config/config.cc +++ b/src/config/config.cc @@ -308,7 +308,7 @@ std::shared_ptr parse_diagram_config(const Node &d) if (diagram_type == "class") { return std::make_shared(d.as()); } - else if (diagram_type == "sequence") { + if (diagram_type == "sequence") { return std::make_shared(d.as()); } else if (diagram_type == "package") { diff --git a/src/decorators/decorators.cc b/src/decorators/decorators.cc index b75840c7..3cfc08cd 100644 --- a/src/decorators/decorators.cc +++ b/src/decorators/decorators.cc @@ -29,7 +29,7 @@ std::shared_ptr decorator::from_string(std::string_view c) if (c.find(note::label) == 0) { return note::from_string(c); } - else if (c.find(skip_relationship::label) == 0) { + if (c.find(skip_relationship::label) == 0) { return skip_relationship::from_string(c); } else if (c.find(skip::label) == 0) { diff --git a/src/sequence_diagram/visitor/translation_unit_visitor.cc b/src/sequence_diagram/visitor/translation_unit_visitor.cc index f1d206de..ecf37dbd 100644 --- a/src/sequence_diagram/visitor/translation_unit_visitor.cc +++ b/src/sequence_diagram/visitor/translation_unit_visitor.cc @@ -116,9 +116,7 @@ bool translation_unit_visitor::VisitCXXRecordDecl(clang::CXXRecordDecl *cls) forward_declarations_.emplace(id, std::move(c_ptr)); return true; } - else { - forward_declarations_.erase(id); - } + forward_declarations_.erase(id); if (diagram().should_include(class_model)) { LOG_DBG("Adding class {} with id {}", class_model.full_name(false), @@ -169,9 +167,7 @@ bool translation_unit_visitor::VisitClassTemplateDecl( forward_declarations_.emplace(id, std::move(c_ptr)); return true; } - else { - forward_declarations_.erase(id); - } + forward_declarations_.erase(id); if (diagram().should_include(*c_ptr)) { LOG_DBG("Adding class template {} with id {}", cls_full_name, id); @@ -216,9 +212,7 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl( id, std::move(template_specialization_ptr)); return true; } - else { - forward_declarations_.erase(id); - } + forward_declarations_.erase(id); if (diagram().should_include(*template_specialization_ptr)) { LOG_DBG("Adding class template specialization {} with id {}", @@ -2005,8 +1999,7 @@ bool translation_unit_visitor::simplify_system_template( ct.clear_params(); return true; } - else - return false; + return false; } std::string translation_unit_visitor::simplify_system_template(