mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-15 17:02:14 +03:00
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:
@@ -308,7 +308,7 @@ void do_confirm_fdr(u64a *conf, u8 offset, hwlmcb_rv_t *control,
|
||||
/* ptr is currently referring to a location in the zone's buffer, we also
|
||||
* need a pointer in the original, main buffer for the final string compare.
|
||||
*/
|
||||
const u8 *ptr_main = (const u8 *)((uintptr_t)ptr + z->zone_pointer_adjust);
|
||||
const u8 *ptr_main = (const u8 *)((uintptr_t)ptr + z->zone_pointer_adjust); //NOLINT (performance-no-int-to-ptr)
|
||||
|
||||
const u8 *confLoc = ptr;
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ void dump_var_mapping(const GoughGraph &g, const string &base,
|
||||
vector<u32> used_id;
|
||||
for (const GoughSSAVar *var : used) {
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
used_id.emplace_back(var->slot);
|
||||
used_id.emplace_back(var->slot); //NOLINT (performance-inefficient-vector-operation)
|
||||
}
|
||||
for (const u32 &id : used_id) {
|
||||
fprintf(f, " %u", id);
|
||||
@@ -169,7 +169,7 @@ void dump_var_mapping(const GoughGraph &g, const string &base,
|
||||
vector<u32> used_id;
|
||||
for (const GoughSSAVar *var : used) {
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
used_id.emplace_back(var->slot);
|
||||
used_id.emplace_back(var->slot); //NOLINT (performance-inefficient-vector-operation)
|
||||
}
|
||||
for (const u32 &id : used_id) {
|
||||
fprintf(f, " %u", id);
|
||||
|
||||
@@ -628,7 +628,7 @@ void fillAccelInfo(build_info &bi) {
|
||||
vector<NFAVertex> astates;
|
||||
for (const auto &m : accel_map) {
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
astates.emplace_back(m.first);
|
||||
astates.emplace_back(m.first); //NOLINT (performance-inefficient-vector-operation)
|
||||
}
|
||||
|
||||
NFAStateSet useful(num_states);
|
||||
@@ -1071,7 +1071,7 @@ void buildAcceptsList(const build_info &args, ReportListCache &reports_cache,
|
||||
a.reports = addReports(h[v].reports, reports, reports_cache);
|
||||
}
|
||||
a.squash = addSquashMask(args, v, squash);
|
||||
accepts.emplace_back(std::move(a));
|
||||
accepts.emplace_back(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ char SHENG32_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
|
||||
if (unlikely(ACCEPT_FUNC32(tmp))) {
|
||||
DEBUG_PRINTF("Accept state %u reached\n", tmp & SHENG32_STATE_MASK);
|
||||
u64a match_offset = base_offset + (cur_buf - buf) + 1;
|
||||
u64a match_offset = base_offset + (cur_buf - buf) + 1; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
if (STOP_AT_MATCH) {
|
||||
DEBUG_PRINTF("Stopping at match @ %lli\n",
|
||||
@@ -222,7 +222,7 @@ char SHENG64_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
|
||||
if (unlikely(ACCEPT_FUNC64(tmp))) {
|
||||
DEBUG_PRINTF("Accept state %u reached\n", tmp & SHENG64_STATE_MASK);
|
||||
u64a match_offset = base_offset + (cur_buf - buf) + 1;
|
||||
u64a match_offset = base_offset + (cur_buf - buf) + 1; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
if (STOP_AT_MATCH) {
|
||||
DEBUG_PRINTF("Stopping at match @ %lli\n",
|
||||
|
||||
@@ -392,7 +392,7 @@ char SHENG32_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
|
||||
if (unlikely(INTERESTING_FUNC32(a1, a2, a3, a4))) {
|
||||
if (ACCEPT_FUNC32(a1)) {
|
||||
u64a match_offset = base_offset + b1 - buf;
|
||||
u64a match_offset = base_offset + b1 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a1 & SHENG32_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
@@ -417,7 +417,7 @@ char SHENG32_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
}
|
||||
}
|
||||
if (ACCEPT_FUNC32(a2)) {
|
||||
u64a match_offset = base_offset + b2 - buf;
|
||||
u64a match_offset = base_offset + b2 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a2 & SHENG32_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
@@ -442,7 +442,7 @@ char SHENG32_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
}
|
||||
}
|
||||
if (ACCEPT_FUNC32(a3)) {
|
||||
u64a match_offset = base_offset + b3 - buf;
|
||||
u64a match_offset = base_offset + b3 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a3 & SHENG32_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
@@ -467,7 +467,7 @@ char SHENG32_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
}
|
||||
}
|
||||
if (ACCEPT_FUNC32(a4)) {
|
||||
u64a match_offset = base_offset + b4 - buf;
|
||||
u64a match_offset = base_offset + b4 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a4 & SHENG32_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
@@ -642,7 +642,7 @@ char SHENG64_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
|
||||
if (unlikely(INTERESTING_FUNC64(a1, a2, a3, a4))) {
|
||||
if (ACCEPT_FUNC64(a1)) {
|
||||
u64a match_offset = base_offset + b1 - buf;
|
||||
u64a match_offset = base_offset + b1 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a1 & SHENG64_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
@@ -667,7 +667,7 @@ char SHENG64_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
}
|
||||
}
|
||||
if (ACCEPT_FUNC64(a2)) {
|
||||
u64a match_offset = base_offset + b2 - buf;
|
||||
u64a match_offset = base_offset + b2 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a2 & SHENG64_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
@@ -692,7 +692,7 @@ char SHENG64_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
}
|
||||
}
|
||||
if (ACCEPT_FUNC64(a3)) {
|
||||
u64a match_offset = base_offset + b3 - buf;
|
||||
u64a match_offset = base_offset + b3 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a3 & SHENG64_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
@@ -717,7 +717,7 @@ char SHENG64_IMPL(u8 *state, NfaCallback cb, void *ctxt,
|
||||
}
|
||||
}
|
||||
if (ACCEPT_FUNC64(a4)) {
|
||||
u64a match_offset = base_offset + b4 - buf;
|
||||
u64a match_offset = base_offset + b4 - buf; //NOLINT (clang-analyzer-deadcode.DeadStores)
|
||||
DEBUG_PRINTF("Accept state %u reached\n",
|
||||
a4 & SHENG64_STATE_MASK);
|
||||
DEBUG_PRINTF("Match @ %llu\n", match_offset);
|
||||
|
||||
@@ -104,9 +104,9 @@ const u8 *scanBlock(svuint8_t shuf_mask_lo_highclear, svuint8_t shuf_mask_lo_hig
|
||||
}
|
||||
uint64_t index;
|
||||
if (forward) {
|
||||
index = first_non_zero(vector_size_int_8, result_mask);
|
||||
index = first_non_zero(vector_size_int_8, result_mask); //NOLINT (clang-analyzer-core.CallAndMessage)
|
||||
} else {
|
||||
index = last_non_zero(vector_size_int_8, result_mask);
|
||||
index = last_non_zero(vector_size_int_8, result_mask); //NOLINT (clang-analyzer-core.CallAndMessage)
|
||||
}
|
||||
|
||||
if (index < vector_size_int_8) {
|
||||
@@ -311,7 +311,7 @@ const u8 *truffleExecReal(const m128 &shuf_mask_lo_highclear, m128 shuf_mask_lo_
|
||||
SuperVector<S> chars = SuperVector<S>::Zeroes();
|
||||
const u8* end_buf;
|
||||
if (buf_end - buf < S) {
|
||||
memcpy(&chars.u, buf, buf_end - buf);
|
||||
memcpy(&chars.u, buf, buf_end - buf); //NOLINT (clang-analyzer-core.NonNullParamChecker)
|
||||
end_buf = buf;
|
||||
} else {
|
||||
chars = SuperVector<S>::loadu(buf_end - S);
|
||||
|
||||
@@ -379,7 +379,7 @@ const u8 *vermicelliDoubleExec(char c1, char c2, bool nocase, const u8 *buf,
|
||||
}
|
||||
/* check for partial match at end */
|
||||
u8 mask = nocase ? CASE_CLEAR : 0xff;
|
||||
if ((buf_end[-1] & mask) == (u8)c1) {
|
||||
if ((buf_end[-1] & mask) == (u8)c1) { //NOLINT (clang-analyzer-core.NullDereference)
|
||||
DEBUG_PRINTF("partial!!!\n");
|
||||
return buf_end - 1;
|
||||
}
|
||||
@@ -486,7 +486,7 @@ const u8 *vermicelliDoubleMasked16Exec(const m128 mask, char c1, char m1,
|
||||
}
|
||||
}
|
||||
/* check for partial match at end */
|
||||
if ((buf_end[-1] & m1) == (u8)c1) {
|
||||
if ((buf_end[-1] & m1) == (u8)c1) { //NOLINT (clang-analyzer-core.NullDereference)
|
||||
DEBUG_PRINTF("partial!!!\n");
|
||||
return buf_end - 1;
|
||||
}
|
||||
@@ -523,7 +523,7 @@ const u8 *dvermSearchAlignedMasked(m128 chars1, m128 chars2,
|
||||
m128 v2 = eq128(chars2, and128(data, mask2));
|
||||
u32 z = movemask128(and128(v1, rshiftbyte_m128(v2, 1)));
|
||||
|
||||
if ((buf[15] & m1) == c1 && (buf[16] & m2) == c2) {
|
||||
if ((buf[15] & m1) == c1 && (buf[16] & m2) == c2) { //NOLINT (clang-analyzer-core.NullDereference)
|
||||
z |= (1 << 15);
|
||||
}
|
||||
if (unlikely(z)) {
|
||||
@@ -579,7 +579,7 @@ const u8 *vermicelliDoubleMaskedExec(char c1, char c2, char m1, char m2,
|
||||
}
|
||||
|
||||
/* check for partial match at end */
|
||||
if ((buf_end[-1] & m1) == (u8)c1) {
|
||||
if ((buf_end[-1] & m1) == (u8)c1) { //NOLINT (clang-analyzer-core.NullDereference)
|
||||
DEBUG_PRINTF("partial!!!\n");
|
||||
return buf_end - 1;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class ParseError : public CompileError {
|
||||
public:
|
||||
// Note: 'why' should describe why the error occurred and end with a
|
||||
// full stop, but no line break.
|
||||
explicit ParseError(std::string why) : CompileError(std::move(why)) {}
|
||||
explicit ParseError(const std::string& why) : CompileError(why) {}
|
||||
|
||||
~ParseError() override;
|
||||
};
|
||||
|
||||
@@ -788,7 +788,7 @@ int roseCheckMask32(const struct core_info *ci, const u8 *and_mask,
|
||||
DEBUG_PRINTF("h_len %d c_len %d\n", h_len, c_len);
|
||||
// we use valid_data_mask to blind bytes before history/in the future.
|
||||
u32 valid_data_mask;
|
||||
valid_data_mask = (~0u) << (h_shift + c_shift) >> (c_shift);
|
||||
valid_data_mask = (~0u) << (h_shift + c_shift) >> (c_shift); //NOLINT (clang-analyzer-core.UndefinedBinaryOperatorResult)
|
||||
|
||||
m256 and_mask_m256 = loadu256(and_mask);
|
||||
m256 cmp_mask_m256 = loadu256(cmp_mask);
|
||||
|
||||
@@ -1954,7 +1954,7 @@ bool buildSuffixes(const RoseBuildImpl &tbi, build_context &bc,
|
||||
vector<pair<u32, suffix_id>> ordered;
|
||||
for (const auto &e : bc.suffixes) {
|
||||
// cppcheck-suppress useStlAlgorithm
|
||||
ordered.emplace_back(e.second, e.first);
|
||||
ordered.emplace_back(e.second, e.first); //NOLINT (performance-inefficient-vector-operation)
|
||||
}
|
||||
sort(begin(ordered), end(ordered));
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ public:
|
||||
|
||||
RoseInstrCheckSingleLookaround(s8 offset_in, CharReach reach_in,
|
||||
const RoseInstruction *target_in)
|
||||
: offset(offset_in), reach(std::move(reach_in)), target(target_in) {}
|
||||
: offset(offset_in), reach(reach_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckSingleLookaround &ri) const {
|
||||
return offset == ri.offset && reach == ri.reach && target == ri.target;
|
||||
@@ -495,7 +495,7 @@ public:
|
||||
RoseInstrCheckMask32(std::array<u8, 32> and_mask_in,
|
||||
std::array<u8, 32> cmp_mask_in, u32 neg_mask_in,
|
||||
s32 offset_in, const RoseInstruction *target_in)
|
||||
: and_mask(std::move(and_mask_in)), cmp_mask(std::move(cmp_mask_in)),
|
||||
: and_mask(and_mask_in), cmp_mask(cmp_mask_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckMask32 &ri) const {
|
||||
@@ -533,7 +533,7 @@ public:
|
||||
RoseInstrCheckMask64(std::array<u8, 64> and_mask_in,
|
||||
std::array<u8, 64> cmp_mask_in, u64a neg_mask_in,
|
||||
s32 offset_in, const RoseInstruction *target_in)
|
||||
: and_mask(std::move(and_mask_in)), cmp_mask(std::move(cmp_mask_in)),
|
||||
: and_mask(and_mask_in), cmp_mask(cmp_mask_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
bool operator==(const RoseInstrCheckMask64 &ri) const {
|
||||
return and_mask == ri.and_mask && cmp_mask == ri.cmp_mask &&
|
||||
@@ -608,8 +608,8 @@ public:
|
||||
std::array<u8, 16> bucket_select_mask_in,
|
||||
u32 neg_mask_in, s32 offset_in,
|
||||
const RoseInstruction *target_in)
|
||||
: nib_mask(std::move(nib_mask_in)),
|
||||
bucket_select_mask(std::move(bucket_select_mask_in)),
|
||||
: nib_mask(nib_mask_in),
|
||||
bucket_select_mask(bucket_select_mask_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckShufti16x8 &ri) const {
|
||||
@@ -652,8 +652,8 @@ public:
|
||||
std::array<u8, 32> bucket_select_mask_in,
|
||||
u32 neg_mask_in, s32 offset_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask(std::move(hi_mask_in)), lo_mask(std::move(lo_mask_in)),
|
||||
bucket_select_mask(std::move(bucket_select_mask_in)),
|
||||
: hi_mask(hi_mask_in), lo_mask(lo_mask_in),
|
||||
bucket_select_mask(bucket_select_mask_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckShufti32x8 &ri) const {
|
||||
@@ -697,8 +697,8 @@ public:
|
||||
std::array<u8, 32> bucket_select_mask_in,
|
||||
u32 neg_mask_in, s32 offset_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask(std::move(hi_mask_in)), lo_mask(std::move(lo_mask_in)),
|
||||
bucket_select_mask(std::move(bucket_select_mask_in)),
|
||||
: hi_mask(hi_mask_in), lo_mask(lo_mask_in),
|
||||
bucket_select_mask(bucket_select_mask_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckShufti16x16 &ri) const {
|
||||
@@ -744,9 +744,9 @@ public:
|
||||
std::array<u8, 32> bucket_select_mask_lo_in,
|
||||
u32 neg_mask_in, s32 offset_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask(std::move(hi_mask_in)), lo_mask(std::move(lo_mask_in)),
|
||||
bucket_select_mask_hi(std::move(bucket_select_mask_hi_in)),
|
||||
bucket_select_mask_lo(std::move(bucket_select_mask_lo_in)),
|
||||
: hi_mask(hi_mask_in), lo_mask(lo_mask_in),
|
||||
bucket_select_mask_hi(bucket_select_mask_hi_in),
|
||||
bucket_select_mask_lo(bucket_select_mask_lo_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckShufti32x16 &ri) const {
|
||||
@@ -792,8 +792,8 @@ public:
|
||||
std::array<u8, 64> bucket_select_mask_in,
|
||||
u64a neg_mask_in, s32 offset_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask(std::move(hi_mask_in)), lo_mask(std::move(lo_mask_in)),
|
||||
bucket_select_mask(std::move(bucket_select_mask_in)),
|
||||
: hi_mask(hi_mask_in), lo_mask(lo_mask_in),
|
||||
bucket_select_mask(bucket_select_mask_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckShufti64x8 &ri) const {
|
||||
@@ -843,10 +843,10 @@ public:
|
||||
std::array<u8, 64> bucket_select_mask_lo_in,
|
||||
u64a neg_mask_in, s32 offset_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask_1(std::move(hi_mask_1_in)), hi_mask_2(std::move(hi_mask_2_in)),
|
||||
lo_mask_1(std::move(lo_mask_1_in)), lo_mask_2(std::move(lo_mask_2_in)),
|
||||
bucket_select_mask_hi(std::move(bucket_select_mask_hi_in)),
|
||||
bucket_select_mask_lo(std::move(bucket_select_mask_lo_in)),
|
||||
: hi_mask_1(hi_mask_1_in), hi_mask_2(hi_mask_2_in),
|
||||
lo_mask_1(lo_mask_1_in), lo_mask_2(lo_mask_2_in),
|
||||
bucket_select_mask_hi(bucket_select_mask_hi_in),
|
||||
bucket_select_mask_lo(bucket_select_mask_lo_in),
|
||||
neg_mask(neg_mask_in), offset(offset_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrCheckShufti64x16 &ri) const {
|
||||
@@ -1978,7 +1978,7 @@ public:
|
||||
std::array<u8, 16> start_mask_in,
|
||||
const RoseInstruction *target_in)
|
||||
: multi_look(std::move(ml)), last_start(last_start_in),
|
||||
start_mask(std::move(start_mask_in)), target(target_in) {}
|
||||
start_mask(start_mask_in), target(target_in) {}
|
||||
|
||||
bool operator==(const RoseInstrMultipathLookaround &ri) const {
|
||||
return multi_look == ri.multi_look && last_start == ri.last_start
|
||||
@@ -2023,9 +2023,9 @@ public:
|
||||
u16 neg_mask_in, s32 base_offset_in,
|
||||
s32 last_start_in,
|
||||
const RoseInstruction *target_in)
|
||||
: nib_mask(std::move(nib_mask_in)),
|
||||
bucket_select_mask(std::move(bucket_select_mask_in)),
|
||||
data_select_mask(std::move(data_select_mask_in)),
|
||||
: nib_mask(nib_mask_in),
|
||||
bucket_select_mask(bucket_select_mask_in),
|
||||
data_select_mask(data_select_mask_in),
|
||||
hi_bits_mask(hi_bits_mask_in), lo_bits_mask(lo_bits_mask_in),
|
||||
neg_mask(neg_mask_in), base_offset(base_offset_in),
|
||||
last_start(last_start_in), target(target_in) {}
|
||||
@@ -2086,9 +2086,9 @@ public:
|
||||
u32 neg_mask_in, s32 base_offset_in,
|
||||
s32 last_start_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask(std::move(hi_mask_in)), lo_mask(std::move(lo_mask_in)),
|
||||
bucket_select_mask(std::move(bucket_select_mask_in)),
|
||||
data_select_mask(std::move(data_select_mask_in)),
|
||||
: hi_mask(hi_mask_in), lo_mask(lo_mask_in),
|
||||
bucket_select_mask(bucket_select_mask_in),
|
||||
data_select_mask(data_select_mask_in),
|
||||
hi_bits_mask(hi_bits_mask_in), lo_bits_mask(lo_bits_mask_in),
|
||||
neg_mask(neg_mask_in), base_offset(base_offset_in),
|
||||
last_start(last_start_in), target(target_in) {}
|
||||
@@ -2151,10 +2151,10 @@ public:
|
||||
u32 neg_mask_in, s32 base_offset_in,
|
||||
s32 last_start_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask(std::move(hi_mask_in)), lo_mask(std::move(lo_mask_in)),
|
||||
bucket_select_mask_hi(std::move(bucket_select_mask_hi_in)),
|
||||
bucket_select_mask_lo(std::move(bucket_select_mask_lo_in)),
|
||||
data_select_mask(std::move(data_select_mask_in)),
|
||||
: hi_mask(hi_mask_in), lo_mask(lo_mask_in),
|
||||
bucket_select_mask_hi(bucket_select_mask_hi_in),
|
||||
bucket_select_mask_lo(bucket_select_mask_lo_in),
|
||||
data_select_mask(data_select_mask_in),
|
||||
hi_bits_mask(hi_bits_mask_in), lo_bits_mask(lo_bits_mask_in),
|
||||
neg_mask(neg_mask_in), base_offset(base_offset_in),
|
||||
last_start(last_start_in), target(target_in) {}
|
||||
@@ -2217,9 +2217,9 @@ public:
|
||||
u64a neg_mask_in, s32 base_offset_in,
|
||||
s32 last_start_in,
|
||||
const RoseInstruction *target_in)
|
||||
: hi_mask(std::move(hi_mask_in)), lo_mask(std::move(lo_mask_in)),
|
||||
bucket_select_mask(std::move(bucket_select_mask_in)),
|
||||
data_select_mask(std::move(data_select_mask_in)),
|
||||
: hi_mask(hi_mask_in), lo_mask(lo_mask_in),
|
||||
bucket_select_mask(bucket_select_mask_in),
|
||||
data_select_mask(data_select_mask_in),
|
||||
hi_bits_mask(hi_bits_mask_in), lo_bits_mask(lo_bits_mask_in),
|
||||
neg_mask(neg_mask_in), base_offset(base_offset_in),
|
||||
last_start(last_start_in), target(target_in) {}
|
||||
|
||||
@@ -466,7 +466,7 @@ void findFloodReach(const RoseBuildImpl &tbi, const RoseVertex v,
|
||||
namespace {
|
||||
struct LookProto {
|
||||
LookProto(s32 offset_in, CharReach reach_in)
|
||||
: offset(offset_in), reach(std::move(reach_in)) {}
|
||||
: offset(offset_in), reach(reach_in) {}
|
||||
s32 offset;
|
||||
CharReach reach;
|
||||
};
|
||||
|
||||
@@ -739,7 +739,7 @@ void addFragmentLiteral(const RoseBuildImpl &build, MatcherProto &mp,
|
||||
|
||||
const auto &groups = f.groups;
|
||||
|
||||
mp.lits.emplace_back(std::move(s_final), nocase, noruns, f.fragment_id,
|
||||
mp.lits.emplace_back(s_final, nocase, noruns, f.fragment_id,
|
||||
groups, msk, lcmp);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,11 +52,11 @@ static constexpr u32 INVALID_FRAG_ID = ~0U;
|
||||
struct LitFragment {
|
||||
LitFragment(u32 fragment_id_in, ue2_literal s_in,
|
||||
rose_group groups_in, u32 lit_id)
|
||||
: fragment_id(fragment_id_in), s(s_in), groups(groups_in),
|
||||
: fragment_id(fragment_id_in), s(std::move(s_in)), groups(groups_in),
|
||||
lit_ids({lit_id}) {}
|
||||
LitFragment(u32 fragment_id_in, ue2_literal s_in,
|
||||
rose_group groups_in, std::vector<u32> lit_ids_in)
|
||||
: fragment_id(fragment_id_in), s(s_in), groups(groups_in),
|
||||
: fragment_id(fragment_id_in), s(std::move(s_in)), groups(groups_in),
|
||||
lit_ids(std::move(lit_ids_in)) {}
|
||||
u32 fragment_id;
|
||||
|
||||
|
||||
@@ -100,8 +100,8 @@ RoseProgram::RoseProgram() {
|
||||
|
||||
RoseProgram::~RoseProgram() = default;
|
||||
|
||||
RoseProgram::RoseProgram(RoseProgram &&) = default;
|
||||
RoseProgram &RoseProgram::operator=(RoseProgram &&) = default;
|
||||
RoseProgram::RoseProgram(RoseProgram &&) noexcept = default;
|
||||
RoseProgram &RoseProgram::operator=(RoseProgram &&) noexcept = default;
|
||||
|
||||
bool RoseProgram::empty() const {
|
||||
assert(!prog.empty());
|
||||
|
||||
@@ -57,9 +57,9 @@ public:
|
||||
RoseProgram();
|
||||
~RoseProgram();
|
||||
RoseProgram(const RoseProgram &) = delete;
|
||||
RoseProgram(RoseProgram &&);
|
||||
RoseProgram(RoseProgram &&) noexcept;
|
||||
RoseProgram &operator=(const RoseProgram &) = delete;
|
||||
RoseProgram &operator=(RoseProgram &&);
|
||||
RoseProgram &operator=(RoseProgram &&) noexcept;
|
||||
|
||||
bool empty() const;
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ struct RoseInEdgeProps {
|
||||
/* haig rosefixes (prefix/infix) require their corresponding holders */
|
||||
RoseInEdgeProps(std::shared_ptr<NGHolder> g, std::shared_ptr<raw_som_dfa> h,
|
||||
u32 lag)
|
||||
: minBound(0), maxBound(ROSE_BOUND_INF), graph(g), haig(h),
|
||||
: minBound(0), maxBound(ROSE_BOUND_INF), graph(std::move(g)), haig(std::move(h)),
|
||||
graph_lag(lag) {
|
||||
assert(graph);
|
||||
assert(haig);
|
||||
@@ -151,12 +151,12 @@ struct RoseInEdgeProps {
|
||||
|
||||
/* haig suffixes do not require their corresponding holders */
|
||||
explicit RoseInEdgeProps(std::shared_ptr<raw_som_dfa> h)
|
||||
: minBound(0), maxBound(ROSE_BOUND_INF), haig(h), graph_lag(0) {
|
||||
: minBound(0), maxBound(ROSE_BOUND_INF), haig(std::move(h)), graph_lag(0) {
|
||||
assert(haig);
|
||||
}
|
||||
|
||||
RoseInEdgeProps(std::shared_ptr<NGHolder> g, u32 lag)
|
||||
: minBound(0), maxBound(ROSE_BOUND_INF), graph(g), graph_lag(lag) {
|
||||
: minBound(0), maxBound(ROSE_BOUND_INF), graph(std::move(g)), graph_lag(lag) {
|
||||
assert(graph);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ struct InitialResetEntry {
|
||||
std::shared_ptr<const NGHolder> body_in,
|
||||
const std::unordered_map<NFAVertex, u32> &body_regions_in,
|
||||
u32 sent_region_in, u32 first_bad_region_in)
|
||||
: sent(sent_in), body(body_in), body_regions(body_regions_in),
|
||||
: sent(sent_in), body(std::move(body_in)), body_regions(body_regions_in),
|
||||
sent_region(sent_region_in), first_bad_region(first_bad_region_in) {}
|
||||
|
||||
std::shared_ptr<const NGHolder> sent;
|
||||
|
||||
@@ -112,8 +112,8 @@ typedef u32 ReportID;
|
||||
|
||||
// Align ptr to next N-byte boundary
|
||||
#if defined(HAVE_TYPEOF)
|
||||
#define ROUNDUP_PTR(ptr, n) (__typeof__(ptr))(ROUNDUP_N((uintptr_t)(ptr), (n)))
|
||||
#define ROUNDDOWN_PTR(ptr, n) (__typeof__(ptr))(ROUNDDOWN_N((uintptr_t)(ptr), (n)))
|
||||
#define ROUNDUP_PTR(ptr, n) (__typeof__(ptr))(ROUNDUP_N((uintptr_t)(ptr), (n))) //NOLINT (performance-no-int-to-ptr)
|
||||
#define ROUNDDOWN_PTR(ptr, n) (__typeof__(ptr))(ROUNDDOWN_N((uintptr_t)(ptr), (n))) //NOLINT (performance-no-int-to-ptr)
|
||||
#else
|
||||
#define ROUNDUP_PTR(ptr, n) (void*)(ROUNDUP_N((uintptr_t)(ptr), (n)))
|
||||
#define ROUNDDOWN_PTR(ptr, n) (void*)(ROUNDDOWN_N((uintptr_t)(ptr), (n)))
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user