Fixed clang-tidy warnings

This commit is contained in:
Bartek Kryza
2024-01-02 23:17:32 +01:00
parent eec73a79e8
commit da7870f50f
43 changed files with 188 additions and 226 deletions

View File

@@ -74,7 +74,7 @@ common::optional_ref<clanguml::common::model::diagram_element> diagram::get(
}
common::optional_ref<clanguml::common::model::diagram_element> diagram::get(
const clanguml::common::model::diagram_element::id_t id) const
const clanguml::common::id_t id) const
{
common::optional_ref<clanguml::common::model::diagram_element> res;
@@ -149,8 +149,7 @@ void diagram::get_parents(
}
}
bool diagram::has_element(
clanguml::common::model::diagram_element::id_t id) const
bool diagram::has_element(clanguml::common::id_t id) const
{
const auto has_class = std::any_of(classes().begin(), classes().end(),
[id](const auto &c) { return c.get().id() == id; });
@@ -168,8 +167,7 @@ bool diagram::has_element(
[id](const auto &c) { return c.get().id() == id; });
}
std::string diagram::to_alias(
clanguml::common::model::diagram_element::id_t id) const
std::string diagram::to_alias(clanguml::common::id_t id) const
{
LOG_DBG("Looking for alias for {}", id);

View File

@@ -103,7 +103,7 @@ public:
* @param id Element id.
* @return Optional reference to a diagram element.
*/
opt_ref<diagram_element> get(diagram_element::id_t id) const override;
opt_ref<diagram_element> get(common::id_t id) const override;
/**
* @brief Get list of references to classes in the diagram model.
@@ -172,8 +172,7 @@ public:
* @param id Id of the element
* @return Optional reference to a diagram element
*/
template <typename ElementT>
opt_ref<ElementT> find(diagram_element::id_t id) const;
template <typename ElementT> opt_ref<ElementT> find(common::id_t id) const;
/**
* @brief Get reference to vector of elements of specific type
@@ -219,7 +218,7 @@ public:
* @param id Id of the diagram element.
* @return PlantUML alias.
*/
std::string to_alias(diagram_element::id_t id) const;
std::string to_alias(common::id_t id) const;
/**
* @brief Given an initial set of classes, add all their parents to the
@@ -236,7 +235,7 @@ public:
* @param id Id of the element.
* @return True, if diagram contains an element with a specific id.
*/
bool has_element(diagram_element::id_t id) const override;
bool has_element(common::id_t id) const override;
/**
* @brief Remove redundant dependency relationships
@@ -421,7 +420,7 @@ std::vector<opt_ref<ElementT>> diagram::find(
}
template <typename ElementT>
opt_ref<ElementT> diagram::find(diagram_element::id_t id) const
opt_ref<ElementT> diagram::find(common::id_t id) const
{
for (const auto &element : element_view<ElementT>::view()) {
if (element.get().id() == id) {

View File

@@ -216,7 +216,7 @@ std::unique_ptr<class_> template_builder::build(const clang::NamedDecl *cls,
std::string best_match_full_name{};
auto full_template_name = template_instantiation.full_name(false);
int best_match{};
common::model::diagram_element::id_t best_match_id{0};
common::id_t best_match_id{0};
for (const auto templ : diagram().classes()) {
if (templ.get() == template_instantiation)
@@ -318,7 +318,7 @@ template_builder::build_from_class_template_specialization(
std::string best_match_full_name{};
auto full_template_name = template_instantiation.full_name(false);
int best_match{};
common::model::diagram_element::id_t best_match_id{0};
common::id_t best_match_id{0};
for (const auto templ : diagram().classes()) {
if (templ.get() == template_instantiation)

View File

@@ -30,9 +30,8 @@ using common::model::namespace_;
using common::model::relationship_t;
using common::model::template_parameter;
using found_relationships_t =
std::vector<std::pair<clanguml::common::model::diagram_element::id_t,
common::model::relationship_t>>;
using found_relationships_t = std::vector<
std::pair<clanguml::common::id_t, common::model::relationship_t>>;
class translation_unit_visitor;

View File

@@ -116,7 +116,7 @@ bool translation_unit_visitor::VisitEnumDecl(clang::EnumDecl *enm)
const auto *parent = enm->getParent();
std::optional<common::model::diagram_element::id_t> id_opt;
std::optional<common::id_t> id_opt;
if (parent != nullptr) {
const auto *parent_record_decl =
@@ -863,7 +863,7 @@ void translation_unit_visitor::process_record_parent(
{
const auto *parent = cls->getParent();
std::optional<common::model::diagram_element::id_t> id_opt;
std::optional<common::id_t> id_opt;
auto parent_ns = ns;
if (parent != nullptr) {

View File

@@ -477,7 +477,7 @@ private:
template_builder template_builder_;
std::map<common::model::diagram_element::id_t,
std::map<common::id_t,
std::unique_ptr<clanguml::class_diagram::model::class_>>
forward_declarations_;