Bug fix/clang-tidy-performance (#300)

Various clang-tidy-performance fixes:
* noexcept
* performance-noexcept-swap
* performance
* performance-move-const-arg
* performance-unnecessary-value-param
* performance-inefficient-vector-operation
* performance-no-int-to-ptr
* add performance
* performance-inefficient-string-concatenation
* clang-analyzer-deadcode.DeadStores
* performance-inefficient-vector-operation
* clang-analyzer-core.NullDereference
* clang-analyzer-core.UndefinedBinaryOperatorResult
* clang-analyzer-core.CallAndMessage

---------

Co-authored-by: gtsoul-tech <gtsoulkanakis@gmail.com>
This commit is contained in:
gtsoul-tech
2024-06-20 14:57:19 +03:00
committed by GitHub
parent e7e65b1aae
commit 30dd577126
40 changed files with 171 additions and 170 deletions

View File

@@ -95,7 +95,7 @@ public:
return p;
}
void swap(bytecode_ptr &other) {
void swap(bytecode_ptr &other) noexcept {
using std::swap;
swap(ptr, other.ptr);
swap(bytes, other.bytes);

View File

@@ -131,7 +131,7 @@ public:
data().clear();
}
void swap(flat_base &a) {
void swap(flat_base &a) noexcept {
using std::swap;
swap(comp(), a.comp());
swap(data(), a.data());
@@ -215,9 +215,9 @@ public:
}
flat_set(const flat_set &) = default;
flat_set(flat_set &&) = default;
flat_set(flat_set &&) noexcept = default;
flat_set &operator=(const flat_set &) = default;
flat_set &operator=(flat_set &&) = default;
flat_set &operator=(flat_set &&) noexcept = default;
// Iterators.
@@ -353,7 +353,7 @@ public:
}
// Free swap function for ADL.
friend void swap(flat_set &a, flat_set &b) {
friend void swap(flat_set &a, flat_set &b) noexcept {
a.swap(b);
}
};
@@ -445,9 +445,9 @@ public:
}
flat_map(const flat_map &) = default;
flat_map(flat_map &&) = default;
flat_map(flat_map &&) noexcept = default;
flat_map &operator=(const flat_map &) = default;
flat_map &operator=(flat_map &&) = default;
flat_map &operator=(flat_map &&) noexcept = default;
// Iterators.
@@ -637,7 +637,7 @@ public:
}
// Free swap function for ADL.
friend void swap(flat_map &a, flat_map &b) {
friend void swap(flat_map &a, flat_map &b) noexcept {
a.swap(b);
}
};

View File

@@ -178,7 +178,7 @@ public:
return data < a.data;
}
void swap(element_store &a) {
void swap(element_store &a) noexcept {
using std::swap;
swap(data, a.data);
swap(map, a.map);
@@ -278,11 +278,11 @@ public:
return store < a.store;
}
void swap(insertion_ordered_map &a) {
void swap(insertion_ordered_map &a) noexcept {
store.swap(a.store);
}
friend void swap(insertion_ordered_map &a, insertion_ordered_map &b) {
friend void swap(insertion_ordered_map &a, insertion_ordered_map &b) noexcept {
a.swap(b);
}
};
@@ -355,11 +355,11 @@ public:
return store < a.store;
}
void swap(insertion_ordered_set &a) {
void swap(insertion_ordered_set &a) noexcept {
store.swap(a.store);
}
friend void swap(insertion_ordered_set &a, insertion_ordered_set &b) {
friend void swap(insertion_ordered_set &a, insertion_ordered_set &b) noexcept {
a.swap(b);
}
};

View File

@@ -1003,7 +1003,7 @@ public:
ue2_graph() = default;
ue2_graph(ue2_graph &&old)
ue2_graph(ue2_graph &&old) noexcept
: next_vertex_index(old.next_vertex_index),
next_edge_index(old.next_edge_index),
graph_edge_count(old.graph_edge_count),
@@ -1012,7 +1012,7 @@ public:
swap(vertices_list, old.vertices_list);
}
ue2_graph &operator=(ue2_graph &&old) {
ue2_graph &operator=(ue2_graph &&old) noexcept {
next_vertex_index = old.next_vertex_index;
next_edge_index = old.next_edge_index;
graph_edge_count = old.graph_edge_count;

View File

@@ -147,7 +147,7 @@ public:
ue2_literal(const ue2_literal &) = default;
ue2_literal(ue2_literal &&) = default;
ue2_literal &operator=(const ue2_literal &) = default;
ue2_literal &operator=(ue2_literal &&) = default;
ue2_literal &operator=(ue2_literal &&) noexcept = default;
template<typename InputIt>
ue2_literal(InputIt b, InputIt e) {
@@ -204,7 +204,7 @@ public:
const std::string &get_string() const { return s; }
void swap(ue2_literal &other) {
void swap(ue2_literal &other) noexcept {
s.swap(other.s);
nocase.swap(other.nocase);
}

View File

@@ -130,7 +130,7 @@ public:
return INVALID_UNICODE;
}
void swap(CodePointSet &other) { impl.swap(other.impl); }
void swap(CodePointSet &other) noexcept { impl.swap(other.impl); }
private:
implT impl;