mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-20 02:47:11 +03:00
phase 1 of addressing cppcheck useStlAlgorithm warnings,
this set only includes fill and copy operations.
This commit is contained in:
@@ -3308,10 +3308,11 @@ void addEodEventProgram(const RoseBuildImpl &build, build_context &bc,
|
||||
|
||||
// Collect all edges leading into EOD event literal vertices.
|
||||
vector<RoseEdge> edge_list;
|
||||
|
||||
|
||||
for (const auto &v : lit_info.vertices) {
|
||||
for (const auto &e : in_edges_range(v, g)) {
|
||||
edge_list.emplace_back(e);
|
||||
}
|
||||
const auto &er = in_edges_range(v, g);
|
||||
std::copy(begin(er), end(er), std::back_inserter(edge_list));
|
||||
}
|
||||
|
||||
// Sort edge list for determinism, prettiness.
|
||||
|
||||
@@ -2432,9 +2432,8 @@ void addPredBlocksAny(map<u32, RoseProgram> &pred_blocks, u32 num_states,
|
||||
RoseProgram sparse_program;
|
||||
|
||||
vector<u32> keys;
|
||||
for (const u32 &key : pred_blocks | map_keys) {
|
||||
keys.emplace_back(key);
|
||||
}
|
||||
const auto &k = pred_blocks | map_keys;
|
||||
std::copy(begin(k), end(k), std::back_inserter(keys));
|
||||
|
||||
const RoseInstruction *end_inst = sparse_program.end_instruction();
|
||||
auto ri = std::make_unique<RoseInstrSparseIterAny>(num_states, keys, end_inst);
|
||||
|
||||
@@ -1976,11 +1976,10 @@ void filterDiamondCandidates(RoseGraph &g, CandidateSet &candidates) {
|
||||
DEBUG_PRINTF("%zu candidates enter\n", candidates.size());
|
||||
|
||||
vector<RoseVertex> dead;
|
||||
for (const auto &v : candidates) {
|
||||
if (hasNoDiamondSiblings(g, v)) {
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
}
|
||||
auto deads = [&g=g](const RoseVertex &v) {
|
||||
return (hasNoDiamondSiblings(g, v));
|
||||
};
|
||||
std::copy_if(begin(candidates), end(candidates), std::back_inserter(dead), deads);
|
||||
|
||||
for (const auto &v : dead) {
|
||||
candidates.erase(v);
|
||||
|
||||
@@ -64,12 +64,11 @@ u32 findMinWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
|
||||
const RoseGraph &g = tbi.g;
|
||||
|
||||
vector<RoseVertex> table_verts;
|
||||
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (tbi.hasLiteralInTable(v, table)) {
|
||||
table_verts.emplace_back(v);
|
||||
}
|
||||
}
|
||||
auto tvs = [&tbi=tbi, &table=table](const RoseVertex &v) {
|
||||
return (tbi.hasLiteralInTable(v, table));
|
||||
};
|
||||
const auto &vr = vertices_range(g);
|
||||
std::copy_if(begin(vr), end(vr), std::back_inserter(table_verts), tvs);
|
||||
|
||||
set<RoseVertex> reachable;
|
||||
find_reachable(g, table_verts, &reachable);
|
||||
@@ -189,13 +188,12 @@ u32 findMaxBAWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
|
||||
table == ROSE_FLOATING ? "floating" : "anchored");
|
||||
|
||||
vector<RoseVertex> table_verts;
|
||||
|
||||
for (auto v : vertices_range(g)) {
|
||||
if ((table == ROSE_FLOATING && tbi.isFloating(v))
|
||||
|| (table == ROSE_ANCHORED && tbi.isAnchored(v))) {
|
||||
table_verts.emplace_back(v);
|
||||
}
|
||||
}
|
||||
auto tvs = [&tbi=tbi, &table=table](const RoseVertex &v) {
|
||||
return ((table == ROSE_FLOATING && tbi.isFloating(v))
|
||||
|| (table == ROSE_ANCHORED && tbi.isAnchored(v)));
|
||||
};
|
||||
const auto &vr = vertices_range(g);
|
||||
std::copy_if(begin(vr), end(vr), std::back_inserter(table_verts), tvs);
|
||||
|
||||
set<RoseVertex> reachable;
|
||||
find_reachable(g, table_verts, &reachable);
|
||||
|
||||
Reference in New Issue
Block a user