Applied llvm-else-after-return clang-tidy fixes

This commit is contained in:
Bartek Kryza
2022-12-20 23:56:18 +01:00
parent 8e4c2af279
commit e32e4cd2aa
8 changed files with 17 additions and 36 deletions

View File

@@ -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(

View File

@@ -286,7 +286,7 @@ template <> id_t to_id(const clang::TemplateArgument &template_argument)
return to_id(*template_argument.getAsType()
->getAs<clang::EnumType>()
->getAsTagDecl());
else if (template_argument.getAsType()->getAs<clang::RecordType>())
if (template_argument.getAsType()->getAs<clang::RecordType>())
return to_id(*template_argument.getAsType()
->getAs<clang::RecordType>()
->getAsRecordDecl());

View File

@@ -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<std::string> elements)

View File

@@ -70,11 +70,9 @@ public:
if (parent && dynamic_cast<nested_trait<T, Path> *>(&parent.value()))
return dynamic_cast<nested_trait<T, Path> &>(parent.value())
.template add_element<V>(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 <typename V = T> auto get_element(const Path &path) const

View File

@@ -63,9 +63,7 @@ inline value_t any_of(InputIterator first, InputIterator last, Predicate pred)
res = true;
break;
}
else {
res = false;
}
res = false;
}
}

View File

@@ -308,7 +308,7 @@ std::shared_ptr<clanguml::config::diagram> parse_diagram_config(const Node &d)
if (diagram_type == "class") {
return std::make_shared<class_diagram>(d.as<class_diagram>());
}
else if (diagram_type == "sequence") {
if (diagram_type == "sequence") {
return std::make_shared<sequence_diagram>(d.as<sequence_diagram>());
}
else if (diagram_type == "package") {

View File

@@ -29,7 +29,7 @@ std::shared_ptr<decorator> 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) {

View File

@@ -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(