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 0e0c9f8c63
commit 0f4369bf22
40 changed files with 171 additions and 170 deletions

View File

@@ -190,7 +190,7 @@ void findPaths(const NGHolder &g, NFAVertex v,
namespace {
struct SAccelScheme {
SAccelScheme(CharReach cr_in, u32 offset_in)
: cr(std::move(cr_in)), offset(offset_in) {
: cr(cr_in), offset(offset_in) {
assert(offset <= MAX_ACCEL_DEPTH);
}
@@ -254,7 +254,7 @@ void findBestInternal(vector<vector<CharReach>>::const_iterator pb,
DEBUG_PRINTF("worse\n");
continue;
}
priority_path.emplace_back(std::move(as));
priority_path.emplace_back(as);
}
sort(priority_path.begin(), priority_path.end());
@@ -300,7 +300,7 @@ SAccelScheme findBest(const vector<vector<CharReach>> &paths,
namespace {
struct DAccelScheme {
DAccelScheme(CharReach cr_in, u32 offset_in)
: double_cr(std::move(cr_in)), double_offset(offset_in) {
: double_cr(cr_in), double_offset(offset_in) {
assert(double_offset <= MAX_ACCEL_DEPTH);
}
@@ -570,7 +570,7 @@ AccelScheme findBestAccelScheme(vector<vector<CharReach>> paths,
DAccelScheme da = findBestDoubleAccelScheme(paths, terminating);
if (da.double_byte.size() <= DOUBLE_SHUFTI_LIMIT) {
rv.double_byte = std::move(da.double_byte);
rv.double_cr = std::move(da.double_cr);
rv.double_cr = da.double_cr;
rv.double_offset = da.double_offset;
}
}

View File

@@ -68,7 +68,7 @@ namespace {
struct LitGraphVertexProps {
LitGraphVertexProps() = default;
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(std::move(c_in)) {}
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(c_in) {}
ue2_literal::elem c; // string element (char + bool)
size_t index = 0; // managed by ue2_graph
};

View File

@@ -380,7 +380,7 @@ public:
u32 vert_id = graph[v].index;
squash.set(vert_id);
squash_mask[vert_id]
= Automaton_Traits::copy_states(std::move(sq.second),
= Automaton_Traits::copy_states(sq.second,
numStates);
}