Applied performance-unnecessary-value-param clang-tidy fixes

This commit is contained in:
Bartek Kryza
2022-12-20 23:15:59 +01:00
parent 6b883c4562
commit 177c68158a
13 changed files with 23 additions and 16 deletions

View File

@@ -17,11 +17,14 @@ Checks: >-
-hicpp-no-array-decay,
-google-readability-todo,
-google-default-arguments,
-google-explicit-constructor,
-hicpp-signed-bitwise,
-hicpp-explicit-conversions,
-llvmlibc-*,
-llvm-header-guard,
-llvm-namespace-comment,
-misc-no-recursion,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-mpi*,
-objc*,

View File

@@ -68,7 +68,7 @@ void class_::add_parent(class_parent &&parent)
bases_.emplace_back(std::move(parent));
}
void class_::add_template(template_parameter tmplt)
void class_::add_template(template_parameter &&tmplt)
{
templates_.emplace_back(std::move(tmplt));
}

View File

@@ -56,7 +56,7 @@ public:
void add_member(class_member &&member);
void add_method(class_method &&method);
void add_parent(class_parent &&parent);
void add_template(template_parameter tmplt);
void add_template(template_parameter &&tmplt);
const std::vector<class_member> &members() const;
const std::vector<class_method> &methods() const;

View File

@@ -180,7 +180,8 @@ bool template_parameter::find_nested_relationships(
std::vector<std::pair<int64_t, common::model::relationship_t>>
&nested_relationships,
common::model::relationship_t hint,
std::function<bool(const std::string &full_name)> should_include) const
const std::function<bool(const std::string &full_name)> &should_include)
const
{
bool added_aggregation_relationship{false};

View File

@@ -97,7 +97,8 @@ public:
std::vector<std::pair<int64_t, common::model::relationship_t>>
&nested_relationships,
common::model::relationship_t hint,
std::function<bool(const std::string &full_name)> should_include) const;
const std::function<bool(const std::string &full_name)> &should_include)
const;
private:
/// Represents the type of non-type template parameters

View File

@@ -19,7 +19,7 @@
namespace clanguml::common::generators::plantuml {
std::string to_plantuml(relationship_t r, std::string style)
std::string to_plantuml(relationship_t r, const std::string &style)
{
switch (r) {
case relationship_t::kOwnership:

View File

@@ -37,7 +37,7 @@ using clanguml::common::model::element;
using clanguml::common::model::message_t;
using clanguml::common::model::relationship_t;
std::string to_plantuml(relationship_t r, std::string style);
std::string to_plantuml(relationship_t r, const std::string &style);
std::string to_plantuml(access_t scope);
std::string to_plantuml(message_t r);

View File

@@ -354,7 +354,7 @@ tvl::value_t context_filter::match(const diagram &d, const element &e) const
}
paths_filter::paths_filter(filter_t type, const std::filesystem::path &root,
std::vector<std::filesystem::path> p)
const std::vector<std::filesystem::path> &p)
: filter_visitor{type}
, root_{root}
{
@@ -420,7 +420,7 @@ void diagram_filter::add_exclusive_filter(std::unique_ptr<filter_visitor> fv)
}
bool diagram_filter::should_include(
namespace_ ns, const std::string &name) const
const namespace_ &ns, const std::string &name) const
{
if (should_include(ns)) {
element e{namespace_{}};

View File

@@ -314,7 +314,7 @@ private:
struct paths_filter : public filter_visitor {
paths_filter(filter_t type, const std::filesystem::path &root,
std::vector<std::filesystem::path> p);
const std::vector<std::filesystem::path> &p);
virtual ~paths_filter() = default;
@@ -334,7 +334,7 @@ public:
void add_exclusive_filter(std::unique_ptr<filter_visitor> fv);
bool should_include(namespace_ ns, const std::string &name) const;
bool should_include(const namespace_ &ns, const std::string &name) const;
template <typename T> bool should_include(const T &e) const
{

View File

@@ -41,7 +41,8 @@ std::pair<common::model::namespace_, std::string> split_ns(
std::vector<class_diagram::model::template_parameter>
parse_unexposed_template_params(const std::string &params,
std::function<std::string(const std::string &)> ns_resolve, int depth)
const std::function<std::string(const std::string &)> &ns_resolve,
int depth)
{
using class_diagram::model::template_parameter;

View File

@@ -29,6 +29,7 @@ std::pair<common::model::namespace_, std::string> split_ns(
std::vector<class_diagram::model::template_parameter>
parse_unexposed_template_params(const std::string &params,
std::function<std::string(const std::string &)> ns_resolve, int depth = 0);
const std::function<std::string(const std::string &)> &ns_resolve,
int depth = 0);
} // namespace clanguml::cx::util

View File

@@ -51,7 +51,7 @@ std::shared_ptr<decorator> decorator::from_string(std::string_view c)
return {};
}
bool decorator::applies_to_diagram(std::string name)
bool decorator::applies_to_diagram(const std::string &name)
{
return diagrams.empty() ||
(std::find(diagrams.begin(), diagrams.end(), name) != diagrams.end());
@@ -174,7 +174,7 @@ std::shared_ptr<decorator> association::from_string(std::string_view c)
}
std::vector<std::shared_ptr<decorator>> parse(
std::string documentation_block, std::string clanguml_tag)
std::string documentation_block, const std::string &clanguml_tag)
{
std::vector<std::shared_ptr<decorator>> res;
const std::string begin_tag{"@" + clanguml_tag};

View File

@@ -40,7 +40,7 @@ struct decorator {
static std::shared_ptr<decorator> from_string(std::string_view c);
bool applies_to_diagram(std::string name);
bool applies_to_diagram(const std::string &name);
protected:
decorator_toks tokenize(const std::string &label, std::string_view c);
@@ -97,7 +97,7 @@ struct association : public relationship {
};
std::vector<std::shared_ptr<decorator>> parse(
std::string documentation_block, std::string clanguml_tag = "uml");
std::string documentation_block, const std::string &clanguml_tag = "uml");
} // namespace decorators
} // namespace clanguml