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

@@ -127,7 +127,7 @@ void generate_diagram_impl(const std::string &name,
auto from_values = model->list_from_values();
for (const auto &from : from_values) {
std::cout << from << std::endl;
std::cout << from << '\n';
}
return;
@@ -136,7 +136,7 @@ void generate_diagram_impl(const std::string &name,
auto to_values = model->list_to_values();
for (const auto &to : to_values) {
std::cout << "|" << to << "|" << std::endl;
std::cout << "|" << to << "|" << '\n';
}
return;

View File

@@ -65,7 +65,7 @@ public:
* @return Optional reference to a diagram element.
*/
virtual common::optional_ref<clanguml::common::model::diagram_element> get(
diagram_element::id_t id) const = 0;
common::id_t id) const = 0;
/**
* Return optional reference to a diagram_element by name and namespace.
@@ -152,10 +152,7 @@ public:
// Disallow std::string overload
bool should_include(const std::string &s) const = delete;
virtual bool has_element(const diagram_element::id_t /*id*/) const
{
return false;
}
virtual bool has_element(const common::id_t /*id*/) const { return false; }
virtual bool should_include(
const namespace_ &ns, const std::string &name) const;

View File

@@ -26,16 +26,16 @@ namespace clanguml::common::model {
diagram_element::diagram_element() = default;
diagram_element::id_t diagram_element::id() const { return id_; }
common::id_t diagram_element::id() const { return id_; }
void diagram_element::set_id(diagram_element::id_t id) { id_ = id; }
void diagram_element::set_id(common::id_t id) { id_ = id; }
std::optional<id_t> diagram_element::parent_element_id() const
{
return parent_element_id_;
}
void diagram_element::set_parent_element_id(diagram_element::id_t id)
void diagram_element::set_parent_element_id(common::id_t id)
{
parent_element_id_ = id;
}

View File

@@ -39,8 +39,6 @@ namespace clanguml::common::model {
*/
class diagram_element : public decorated_element, public source_location {
public:
using id_t = int64_t;
diagram_element();
~diagram_element() override = default;
@@ -55,14 +53,14 @@ public:
*
* @return Elements id.
*/
id_t id() const;
common::id_t id() const;
/**
* Set elements id.
*
* @param id Elements id.
*/
void set_id(id_t id);
void set_id(common::id_t id);
/**
* Get elements parent package id.
@@ -76,7 +74,7 @@ public:
*
* @param id Id of parent package.
*/
void set_parent_element_id(diagram_element::id_t id);
void set_parent_element_id(id_t id);
/**
* @brief Return elements' diagram alias.

View File

@@ -595,8 +595,8 @@ tvl::value_t module_access_filter::match(
access_.begin(), access_.end(), [&e](const auto &access) {
if (access == module_access_t::kPublic)
return !e.module_private();
else
return e.module_private();
return e.module_private();
});
}

View File

@@ -58,8 +58,7 @@ public:
*
* @return
*/
common::optional_ref<T> get(
clanguml::common::model::diagram_element::id_t id) const
common::optional_ref<T> get(clanguml::common::id_t id) const
{
for (const auto &e : elements_) {
if (e.get().id() == id) {

View File

@@ -29,6 +29,9 @@ std::string to_string(const path_type pt)
return "namespace";
case path_type::kFilesystem:
return "directory";
default:
assert(false);
return "";
}
}

View File

@@ -40,7 +40,7 @@ namespace clanguml::common::visitor {
*/
class ast_id_mapper {
public:
using id_t = common::model::diagram_element::id_t;
using id_t = common::id_t;
ast_id_mapper() = default;

View File

@@ -20,8 +20,10 @@
#include "comment/clang_visitor.h"
#include "comment/plain_visitor.h"
#include "common/clang_utils.h"
#include "clang/Basic/Module.h"
#include <clang/AST/Expr.h>
#include <clang/Basic/Module.h>
namespace clanguml::common::visitor {

View File

@@ -18,9 +18,12 @@
#pragma once
#include "comment/comment_visitor.h"
#include "common/model/element.h"
#include "common/model/source_location.h"
#include "config/config.h"
#include <clang/AST/Comment.h>
#include <clang/AST/RawCommentList.h>
#include <clang/Basic/SourceManager.h>
#include <deque>
@@ -31,9 +34,8 @@
namespace clanguml::common::visitor {
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>>;
/**
* @brief Diagram translation unit visitor base class