mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-30 03:34:25 +03:00
replace push_back by emplace_back where possible
This commit is contained in:
@@ -94,7 +94,7 @@ vector<NFAEdge> getAsserts(const NGHolder &g) {
|
||||
vector<NFAEdge> out;
|
||||
for (const auto &e : edges_range(g)) {
|
||||
if (g[e].assert_flags) {
|
||||
out.push_back(e);
|
||||
out.emplace_back(e);
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
@@ -213,7 +213,7 @@ vector<NFAEdge> findShellEdges(const NGHolder &g,
|
||||
(is_special(v, g) || contains(tail_shell, v))) {
|
||||
DEBUG_PRINTF("edge (%zu,%zu) is a shell edge\n", g[u].index,
|
||||
g[v].index);
|
||||
shell_edges.push_back(e);
|
||||
shell_edges.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
if (head_shell.size() + tail_shell.size() + N_SPECIALS >=
|
||||
num_vertices(*g)) {
|
||||
DEBUG_PRINTF("all in shell component\n");
|
||||
comps.push_back(std::move(g));
|
||||
comps.emplace_back(std::move(g));
|
||||
*shell_comp = true;
|
||||
return;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
// into the tail shell, we aren't going to find more than one component.
|
||||
if (shell_edges.empty() && shellHasOnePath(*g, head_shell, tail_shell)) {
|
||||
DEBUG_PRINTF("single component\n");
|
||||
comps.push_back(std::move(g));
|
||||
comps.emplace_back(std::move(g));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
assert(num > 0);
|
||||
if (num == 1 && shell_edges.empty()) {
|
||||
DEBUG_PRINTF("single component\n");
|
||||
comps.push_back(std::move(g));
|
||||
comps.emplace_back(std::move(g));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
for (const auto &m : split_components) {
|
||||
NFAVertex v = m.first;
|
||||
u32 c = m.second;
|
||||
verts[c].push_back(v);
|
||||
verts[c].emplace_back(v);
|
||||
DEBUG_PRINTF("vertex %zu is in comp %u\n", (*g)[v].index, c);
|
||||
}
|
||||
|
||||
@@ -370,7 +370,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
pruneUseless(*gc);
|
||||
DEBUG_PRINTF("component %zu has %zu vertices\n", comps.size(),
|
||||
num_vertices(*gc));
|
||||
comps.push_back(move(gc));
|
||||
comps.emplace_back(move(gc));
|
||||
}
|
||||
|
||||
// Another component to handle the direct shell-to-shell edges.
|
||||
@@ -386,7 +386,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
pruneUseless(*gc);
|
||||
DEBUG_PRINTF("shell edge component %zu has %zu vertices\n",
|
||||
comps.size(), num_vertices(*gc));
|
||||
comps.push_back(move(gc));
|
||||
comps.emplace_back(move(gc));
|
||||
*shell_comp = true;
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ deque<unique_ptr<NGHolder>> calcComponents(unique_ptr<NGHolder> g,
|
||||
// For trivial cases, we needn't bother running the full
|
||||
// connected_components algorithm.
|
||||
if (!grey.calcComponents || isAlternationOfClasses(*g)) {
|
||||
comps.push_back(std::move(g));
|
||||
comps.emplace_back(std::move(g));
|
||||
return comps;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ void recalcComponents(deque<unique_ptr<NGHolder>> &comps, const Grey &grey) {
|
||||
}
|
||||
|
||||
if (isAlternationOfClasses(*gc)) {
|
||||
out.push_back(std::move(gc));
|
||||
out.emplace_back(std::move(gc));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -493,7 +493,7 @@ bool removeSiblingsOfStartDotStar(NGHolder &g) {
|
||||
continue;
|
||||
}
|
||||
DEBUG_PRINTF("removing %zu->%zu\n", g[u].index, g[v].index);
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ bool optimiseVirtualStarts(NGHolder &g) {
|
||||
|
||||
for (const auto &e : in_edges_range(v, g)) {
|
||||
if (!is_any_start(source(e, g), g)) {
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -148,7 +148,7 @@ public:
|
||||
// unique push
|
||||
void push(unsigned id) {
|
||||
if (ids.insert(id).second) {
|
||||
q.push_back(id);
|
||||
q.emplace_back(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ vector<unique_ptr<VertexInfo>> getVertexInfos(const NGHolder &g) {
|
||||
vertex_map.resize(num_verts);
|
||||
|
||||
for (auto v : vertices_range(g)) {
|
||||
infos.push_back(make_unique<VertexInfo>(v, g));
|
||||
infos.emplace_back(make_unique<VertexInfo>(v, g));
|
||||
vertex_map[g[v].index] = infos.back().get();
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ void equivalence(vector<VertexInfoSet> &classes, WorkQueue &work_queue,
|
||||
classes[cur_class].erase(vi);
|
||||
new_class_vertices.insert(vi);
|
||||
}
|
||||
classes.push_back(move(new_class_vertices));
|
||||
classes.emplace_back(move(new_class_vertices));
|
||||
|
||||
if (contains(tmi->first, cur_class)) {
|
||||
reval_queue.push(new_class);
|
||||
@@ -516,7 +516,7 @@ void mergeClass(vector<unique_ptr<VertexInfo>> &infos, NGHolder &g,
|
||||
g[new_v].reports.clear(); /* populated as we pull in succs */
|
||||
|
||||
// store this vertex in our global vertex list
|
||||
infos.push_back(make_unique<VertexInfo>(new_v, g));
|
||||
infos.emplace_back(make_unique<VertexInfo>(new_v, g));
|
||||
VertexInfo *new_vertex_info = infos.back().get();
|
||||
|
||||
NFAVertex new_v_eod = NGHolder::null_vertex();
|
||||
@@ -525,7 +525,7 @@ void mergeClass(vector<unique_ptr<VertexInfo>> &infos, NGHolder &g,
|
||||
if (require_separate_eod_vertex(cur_class_vertices, g)) {
|
||||
new_v_eod = clone_vertex(g, old_v);
|
||||
g[new_v_eod].reports.clear();
|
||||
infos.push_back(make_unique<VertexInfo>(new_v_eod, g));
|
||||
infos.emplace_back(make_unique<VertexInfo>(new_v_eod, g));
|
||||
new_vertex_info_eod = infos.back().get();
|
||||
}
|
||||
|
||||
|
@@ -68,7 +68,7 @@ void removeLeadingVirtualVerticesFromRoot(NGHolder &g, NFAVertex root) {
|
||||
for (auto v : adjacent_vertices_range(root, g)) {
|
||||
if (g[v].assert_flags & POS_FLAG_VIRTUAL_START) {
|
||||
DEBUG_PRINTF("(?m)^ vertex or leading \\[bB] vertex\n");
|
||||
victims.push_back(v);
|
||||
victims.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -353,7 +353,7 @@ bool anchorPatternWithBoundedRepeat(NGHolder &g, ReportManager &rm) {
|
||||
if (v == g.startDs) {
|
||||
continue;
|
||||
}
|
||||
initials.push_back(v);
|
||||
initials.emplace_back(v);
|
||||
}
|
||||
if (initials.empty()) {
|
||||
DEBUG_PRINTF("no initial vertices\n");
|
||||
@@ -576,13 +576,13 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
if (u == cyclic) {
|
||||
continue;
|
||||
}
|
||||
preds.push_back(u);
|
||||
preds.emplace_back(u);
|
||||
|
||||
// We want to delete the out-edges of each predecessor, but need to
|
||||
// make sure we don't delete the startDs self loop.
|
||||
for (const auto &e : out_edges_range(u, g)) {
|
||||
if (target(e, g) != g.startDs) {
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -601,7 +601,7 @@ bool transformMinLengthToRepeat(NGHolder &g, ReportManager &rm) {
|
||||
add_edge(u, v, g);
|
||||
}
|
||||
preds.clear();
|
||||
preds.push_back(v);
|
||||
preds.emplace_back(v);
|
||||
}
|
||||
assert(!preds.empty());
|
||||
for (auto u : preds) {
|
||||
@@ -732,7 +732,7 @@ void pruneExtUnreachable(NGHolder &g, const ReportManager &rm) {
|
||||
for (const auto &e : edges_range(g)) {
|
||||
if (isEdgePrunable(g, report, depths, e)) {
|
||||
DEBUG_PRINTF("pruning\n");
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,14 +775,14 @@ void pruneVacuousEdges(NGHolder &g, const ReportManager &rm) {
|
||||
// a min_offset.
|
||||
if (u == g.start && is_any_accept(v, g) && has_min_offset(u)) {
|
||||
DEBUG_PRINTF("vacuous edge in graph with min_offset!\n");
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If a min_length is set, vacuous edges can be removed.
|
||||
if (is_any_start(u, g) && is_any_accept(v, g) && has_min_length(u)) {
|
||||
DEBUG_PRINTF("vacuous edge in graph with min_length!\n");
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -825,14 +825,14 @@ void pruneUnmatchable(NGHolder &g, const vector<DepthMinMax> &depths,
|
||||
if (d.max.is_finite() && d.max < report.minLength) {
|
||||
DEBUG_PRINTF("prune, max match length %s < min_length=%llu\n",
|
||||
d.max.str().c_str(), report.minLength);
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (report.maxOffset != MAX_OFFSET && d.min > report.maxOffset) {
|
||||
DEBUG_PRINTF("prune, min match length %s > max_offset=%llu\n",
|
||||
d.min.str().c_str(), report.maxOffset);
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ bool findMask(const NGHolder &g, vector<CharReach> *mask, bool *anchored,
|
||||
return true;
|
||||
}
|
||||
|
||||
mask->push_back(g[v].char_reach);
|
||||
mask->emplace_back(g[v].char_reach);
|
||||
|
||||
if (out_degree(v, g) != 1) {
|
||||
DEBUG_PRINTF("out_degree != 1\n");
|
||||
|
@@ -194,7 +194,7 @@ public:
|
||||
const vector<StateSet> initial() {
|
||||
vector<StateSet> rv = {init};
|
||||
if (start_floating != DEAD_STATE && start_floating != start_anchored) {
|
||||
rv.push_back(initDS);
|
||||
rv.emplace_back(initDS);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@@ -354,7 +354,7 @@ public:
|
||||
|
||||
if (t.any() && t != esets[i]) {
|
||||
esets[i] &= ~t;
|
||||
esets.push_back(t);
|
||||
esets.emplace_back(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,7 +380,7 @@ public:
|
||||
const vector<StateSet> initial() {
|
||||
vector<StateSet> rv(1, as);
|
||||
if (start_floating != DEAD_STATE && start_floating != start_anchored) {
|
||||
rv.push_back(fs);
|
||||
rv.emplace_back(fs);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ void haig_do_preds(const NGHolder &g, const stateset &nfa_states,
|
||||
DEBUG_PRINTF("d vertex %zu\n", g[v].index);
|
||||
vector<u32> &out_map = preds[slot_id];
|
||||
for (auto u : inv_adjacent_vertices_range(v, g)) {
|
||||
out_map.push_back(g[u].index);
|
||||
out_map.emplace_back(g[u].index);
|
||||
}
|
||||
|
||||
sort(out_map.begin(), out_map.end());
|
||||
@@ -536,7 +536,7 @@ bool doHaig(const NGHolder &g, som_type som,
|
||||
|
||||
rdfa->state_som.reserve(rdfa->states.size());
|
||||
for (u32 i = 0; i < rdfa->states.size(); i++) {
|
||||
rdfa->state_som.push_back(dstate_som());
|
||||
rdfa->state_som.emplace_back(dstate_som());
|
||||
const StateSet &source_states = nfa_state_map[i];
|
||||
if (source_states.count() > HAIG_MAX_LIVE_SOM_SLOTS) {
|
||||
DEBUG_PRINTF("too many live states\n");
|
||||
@@ -632,9 +632,9 @@ void haig_merge_do_preds(const vector<const raw_som_dfa *> &dfas,
|
||||
for (vector<u32>::const_iterator jt = it->second.begin();
|
||||
jt != it->second.end(); ++jt) {
|
||||
if (*jt < N_SPECIALS || *jt == CREATE_NEW_SOM) {
|
||||
out.push_back(*jt);
|
||||
out.emplace_back(*jt);
|
||||
} else {
|
||||
out.push_back(*jt + adj);
|
||||
out.emplace_back(*jt + adj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -741,7 +741,7 @@ unique_ptr<raw_som_dfa> attemptToMergeHaig(const vector<const raw_som_dfa *> &df
|
||||
vector<u32> per_dfa_adj;
|
||||
u32 curr_adj = 0;
|
||||
for (const auto &haig : dfas) {
|
||||
per_dfa_adj.push_back(curr_adj);
|
||||
per_dfa_adj.emplace_back(curr_adj);
|
||||
curr_adj += total_slots_used(*haig);
|
||||
if (curr_adj < per_dfa_adj.back()) {
|
||||
/* overflowed our som slot count */
|
||||
@@ -751,7 +751,7 @@ unique_ptr<raw_som_dfa> attemptToMergeHaig(const vector<const raw_som_dfa *> &df
|
||||
|
||||
rdfa->state_som.reserve(rdfa->states.size());
|
||||
for (u32 i = 0; i < rdfa->states.size(); i++) {
|
||||
rdfa->state_som.push_back(dstate_som());
|
||||
rdfa->state_som.emplace_back(dstate_som());
|
||||
const vector<dstate_id_t> &source_nfa_states = nfa_state_map[i];
|
||||
DEBUG_PRINTF("finishing state %u\n", i);
|
||||
|
||||
|
@@ -391,7 +391,7 @@ void reusePredsAsStarts(const NGHolder &g, const map<u32, CharReach> &top_reach,
|
||||
vector<NFAVertex> cand_starts;
|
||||
for (NFAVertex u : unhandled_succ_tops | map_keys) {
|
||||
if (hasSelfLoop(u, g)) {
|
||||
cand_starts.push_back(u);
|
||||
cand_starts.emplace_back(u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -525,7 +525,7 @@ void reverseStateOrdering(unordered_map<NFAVertex, u32> &state_ids) {
|
||||
if (e.second == NO_STATE) {
|
||||
continue;
|
||||
}
|
||||
ordering.push_back(e.first);
|
||||
ordering.emplace_back(e.first);
|
||||
}
|
||||
|
||||
// Sort in reverse order by state ID.
|
||||
|
@@ -148,7 +148,7 @@ void findPaths(const NGHolder &g, NFAVertex v,
|
||||
if (v == g.accept || v == g.acceptEod) {
|
||||
paths->push_back({});
|
||||
if (!generates_callbacks(g) || v == g.acceptEod) {
|
||||
paths->back().push_back(CharReach()); /* red tape options */
|
||||
paths->back().emplace_back(CharReach()); /* red tape options */
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -181,8 +181,8 @@ void findPaths(const NGHolder &g, NFAVertex v,
|
||||
} while (new_depth-- && curr.size() >= MAGIC_TOO_WIDE_NUMBER);
|
||||
|
||||
for (auto &c : curr) {
|
||||
c.push_back(cr);
|
||||
paths->push_back(std::move(c));
|
||||
c.emplace_back(cr);
|
||||
paths->emplace_back(std::move(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ void findBestInternal(vector<vector<CharReach>>::const_iterator pb,
|
||||
DEBUG_PRINTF("worse\n");
|
||||
continue;
|
||||
}
|
||||
priority_path.push_back(move(as));
|
||||
priority_path.emplace_back(move(as));
|
||||
}
|
||||
|
||||
sort(priority_path.begin(), priority_path.end());
|
||||
@@ -422,7 +422,7 @@ void findDoubleBest(vector<vector<CharReach> >::const_iterator pb,
|
||||
DEBUG_PRINTF("worse\n");
|
||||
continue;
|
||||
}
|
||||
priority_path.push_back(move(as));
|
||||
priority_path.emplace_back(move(as));
|
||||
}
|
||||
|
||||
sort(priority_path.begin(), priority_path.end());
|
||||
|
@@ -113,7 +113,7 @@ void dumpGraph(const char *filename, const LitGraph &lg) {
|
||||
fout << "[label=\"SINK\"];";
|
||||
} else {
|
||||
ue2_literal s;
|
||||
s.push_back(lg[v].c);
|
||||
s.emplace_back(lg[v].c);
|
||||
fout << "[label=\"" << dumpString(s) << "\"];";
|
||||
}
|
||||
fout << endl;
|
||||
@@ -558,12 +558,12 @@ void findMinCut(LitGraph &lg, vector<LitEdge> &cutset) {
|
||||
|
||||
if (ucolor != small_color::white && vcolor == small_color::white) {
|
||||
assert(v != lg.sink);
|
||||
white_cut.push_back(e);
|
||||
white_cut.emplace_back(e);
|
||||
white_flow += lg[e].score;
|
||||
}
|
||||
if (ucolor == small_color::black && vcolor != small_color::black) {
|
||||
assert(v != lg.sink);
|
||||
black_cut.push_back(e);
|
||||
black_cut.emplace_back(e);
|
||||
black_flow += lg[e].score;
|
||||
}
|
||||
}
|
||||
@@ -657,7 +657,7 @@ u64a sanitizeAndCompressAndScore(set<ue2_literal> &lits) {
|
||||
continue;
|
||||
dont_explode:
|
||||
make_nocase(&s);
|
||||
replacements.push_back(s);
|
||||
replacements.emplace_back(s);
|
||||
}
|
||||
|
||||
insert(&lits, replacements);
|
||||
|
@@ -102,8 +102,8 @@ bool findPaths(const NGHolder &g, vector<Path> &paths) {
|
||||
assert(read_count[g[u].index]);
|
||||
|
||||
for (const auto &p : built[g[u].index]) {
|
||||
out.push_back(p);
|
||||
out.back().push_back(v);
|
||||
out.emplace_back(p);
|
||||
out.back().emplace_back(v);
|
||||
|
||||
if (out.size() > MAX_PATHS) {
|
||||
// All these paths should eventually end up at a sink, so
|
||||
@@ -182,7 +182,7 @@ struct PathMask {
|
||||
if (is_special(v, g)) {
|
||||
continue;
|
||||
}
|
||||
mask.push_back(g[v].char_reach);
|
||||
mask.emplace_back(g[v].char_reach);
|
||||
}
|
||||
|
||||
// Reports are attached to the second-to-last vertex.
|
||||
@@ -238,7 +238,7 @@ bool handleDecoratedLiterals(RoseBuild &rose, const NGHolder &g,
|
||||
DEBUG_PRINTF("failed validation\n");
|
||||
return false;
|
||||
}
|
||||
masks.push_back(move(pm));
|
||||
masks.emplace_back(move(pm));
|
||||
}
|
||||
|
||||
for (const auto &pm : masks) {
|
||||
|
@@ -116,7 +116,7 @@ void calculateAlphabet(const NGHolder &g, array<u16, ALPHABET_SIZE> &alpha,
|
||||
CharReach t = cr & esets[i];
|
||||
if (t.any() && t != esets[i]) {
|
||||
esets[i] &= ~t;
|
||||
esets.push_back(t);
|
||||
esets.emplace_back(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,7 +401,7 @@ public:
|
||||
const vector<StateSet> initial() {
|
||||
vector<StateSet> rv = {init};
|
||||
if (start_floating != DEAD_STATE && start_floating != start_anchored) {
|
||||
rv.push_back(initDS);
|
||||
rv.emplace_back(initDS);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@@ -112,7 +112,7 @@ void findCandidates(NGHolder &g, const vector<NFAVertex> &ordering,
|
||||
}
|
||||
}
|
||||
DEBUG_PRINTF("vertex %zu is a candidate\n", g[v].index);
|
||||
cand->push_back(v);
|
||||
cand->emplace_back(v);
|
||||
next_cand:;
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ void findCandidates_rev(NGHolder &g, const vector<NFAVertex> &ordering,
|
||||
}
|
||||
}
|
||||
DEBUG_PRINTF("vertex %zu is a candidate\n", g[v].index);
|
||||
cand->push_back(v);
|
||||
cand->emplace_back(v);
|
||||
next_cand:;
|
||||
}
|
||||
}
|
||||
@@ -525,7 +525,7 @@ bool mergeCyclicDotStars(NGHolder &g) {
|
||||
add_edge_if_not_present(g.startDs, t, g);
|
||||
|
||||
// mark this edge for removal
|
||||
deadEdges.push_back(e);
|
||||
deadEdges.emplace_back(e);
|
||||
}
|
||||
// if the number of edges to be removed equals out degree, vertex
|
||||
// needs to be removed; else, only remove the edges
|
||||
@@ -641,7 +641,7 @@ bool pruneUsingSuccessors(NGHolder &g, PrunePathsInfo &info, NFAVertex u,
|
||||
* existing in progress matches. */
|
||||
continue;
|
||||
}
|
||||
u_succs.push_back(v);
|
||||
u_succs.emplace_back(v);
|
||||
}
|
||||
|
||||
stable_sort(u_succs.begin(), u_succs.end(),
|
||||
|
@@ -193,14 +193,14 @@ vector<NFAEdge> findMinCut(NGHolder &h, const vector<u64a> &scores) {
|
||||
DEBUG_PRINTF("found white cut edge %zu->%zu cap %llu\n",
|
||||
h[from].index, h[to].index, ec);
|
||||
observed_white_flow += ec;
|
||||
picked_white.push_back(e);
|
||||
picked_white.emplace_back(e);
|
||||
}
|
||||
if (fromColor == small_color::black && toColor != small_color::black) {
|
||||
assert(ec <= INVALID_EDGE_CAP);
|
||||
DEBUG_PRINTF("found black cut edge %zu->%zu cap %llu\n",
|
||||
h[from].index, h[to].index, ec);
|
||||
observed_black_flow += ec;
|
||||
picked_black.push_back(e);
|
||||
picked_black.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -183,7 +183,7 @@ map<u32, RegionInfo> findRegionInfo(const NGHolder &h,
|
||||
}
|
||||
u32 id = region_map.at(v);
|
||||
RegionInfo &ri = regions.emplace(id, RegionInfo(id)).first->second;
|
||||
ri.vertices.push_back(v);
|
||||
ri.vertices.emplace_back(v);
|
||||
ri.reach |= h[v].char_reach;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ void replaceRegion(NGHolder &g, const RegionInfo &ri,
|
||||
if (i > 0) {
|
||||
add_edge(verts.back(), v, g);
|
||||
}
|
||||
verts.push_back(v);
|
||||
verts.emplace_back(v);
|
||||
}
|
||||
|
||||
if (maxWidth.is_infinite()) {
|
||||
|
@@ -64,7 +64,7 @@ void pruneUnreachable(NGHolder &g) {
|
||||
// accept->acceptEod), so all non-specials are unreachable.
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (!is_special(v, g)) {
|
||||
dead.push_back(v);
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -88,7 +88,7 @@ void pruneUnreachable(NGHolder &g) {
|
||||
continue;
|
||||
}
|
||||
if (!contains(colours, v)) {
|
||||
dead.push_back(v);
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ bool pruneForwardUseless(NGHolder &h, const nfag_t &g,
|
||||
if (!is_special(v, g) && get(colors, v) == small_color::white) {
|
||||
DEBUG_PRINTF("vertex %zu is unreachable from %zu\n",
|
||||
g[v].index, g[s].index);
|
||||
dead.push_back(NFAVertex(v));
|
||||
dead.emplace_back(NFAVertex(v));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ void pruneEmptyVertices(NGHolder &g) {
|
||||
const CharReach &cr = g[v].char_reach;
|
||||
if (cr.none()) {
|
||||
DEBUG_PRINTF("empty: %zu\n", g[v].index);
|
||||
dead.push_back(v);
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ void pruneHighlanderAccepts(NGHolder &g, const ReportManager &rm) {
|
||||
// We can prune any out-edges that aren't accepts
|
||||
for (const auto &e : out_edges_range(u, g)) {
|
||||
if (!is_any_accept(target(e, g), g)) {
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ void pruneHighlanderDominated(NGHolder &g, const ReportManager &rm) {
|
||||
for (const auto &report_id : g[v].reports) {
|
||||
const Report &r = rm.getReport(report_id);
|
||||
if (isSimpleExhaustible(r)) {
|
||||
reporters.push_back(v);
|
||||
reporters.emplace_back(v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -281,7 +281,7 @@ void pruneHighlanderDominated(NGHolder &g, const ReportManager &rm) {
|
||||
for (const auto &report_id : g[v].reports) {
|
||||
const Report &r = rm.getReport(report_id);
|
||||
if (isSimpleExhaustible(r)) {
|
||||
reporters.push_back(v);
|
||||
reporters.emplace_back(v);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -346,7 +346,7 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a,
|
||||
unbounded = true;
|
||||
}
|
||||
|
||||
nodes.push_back(a);
|
||||
nodes.emplace_back(a);
|
||||
DEBUG_PRINTF("vertex %zu has in_degree %zu\n", g[a].index,
|
||||
in_degree(a, g));
|
||||
|
||||
@@ -379,7 +379,7 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a,
|
||||
if (a != g.startDs && edge(g.startDs, a, g).second
|
||||
&& proper_out_degree(a, g) == 1
|
||||
&& g[a].char_reach == cr) {
|
||||
nodes.push_back(a);
|
||||
nodes.emplace_back(a);
|
||||
a = g.startDs;
|
||||
}
|
||||
|
||||
|
@@ -207,7 +207,7 @@ void succPredIntersection(const NFAVertex v, const flat_set<NFAVertex> &predSet,
|
||||
// Break out if we've reduced our intersection to [v]
|
||||
if (best->size() == 1) {
|
||||
assert(*(best->begin()) == v);
|
||||
intersection.push_back(v);
|
||||
intersection.emplace_back(v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ void predSuccIntersection(const NFAVertex v,
|
||||
// Break out if we've reduced our intersection to [v]
|
||||
if (best->size() == 1) {
|
||||
assert(*(best->begin()) == v);
|
||||
intersection.push_back(v);
|
||||
intersection.emplace_back(v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ void checkAndAddExitCandidate(const AcyclicGraph &g,
|
||||
|
||||
if (!open.empty()) {
|
||||
DEBUG_PRINTF("exit %zu\n", g[v].index);
|
||||
exits.push_back(move(v_exit));
|
||||
exits.emplace_back(move(v_exit));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -256,7 +256,7 @@ void removeRegionRedundancy(NGHolder &g, som_type som) {
|
||||
}
|
||||
u32 region = region_map.at(v);
|
||||
if (contains(deadRegions, region)) {
|
||||
dead.push_back(v);
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -320,7 +320,7 @@ void splitSubgraph(const NGHolder &g, const deque<NFAVertex> &verts,
|
||||
}
|
||||
u32 comp_id = rit->second;
|
||||
assert(comp_id < num);
|
||||
rs[comp_id].vertices.push_back(v);
|
||||
rs[comp_id].vertices.emplace_back(v);
|
||||
}
|
||||
|
||||
for (const auto &rsi : rs) {
|
||||
@@ -409,7 +409,7 @@ void checkReachSubgraphs(const NGHolder &g, vector<ReachSubgraph> &rs,
|
||||
continue;
|
||||
}
|
||||
|
||||
verts.push_back(v);
|
||||
verts.emplace_back(v);
|
||||
}
|
||||
|
||||
if (recalc) {
|
||||
@@ -421,7 +421,7 @@ void checkReachSubgraphs(const NGHolder &g, vector<ReachSubgraph> &rs,
|
||||
splitSubgraph(g, verts, minNumVertices, q);
|
||||
} else {
|
||||
DEBUG_PRINTF("subgraph is ok\n");
|
||||
rs_out.push_back(rsi);
|
||||
rs_out.emplace_back(rsi);
|
||||
}
|
||||
q.pop();
|
||||
}
|
||||
@@ -638,7 +638,7 @@ void buildTugTrigger(NGHolder &g, NFAVertex cyclic, NFAVertex v,
|
||||
DEBUG_PRINTF("all preds in subgraph, vertex %zu becomes tug\n",
|
||||
g[v].index);
|
||||
add_edge(cyclic, v, g);
|
||||
tugs.push_back(v);
|
||||
tugs.emplace_back(v);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -650,7 +650,7 @@ void buildTugTrigger(NGHolder &g, NFAVertex cyclic, NFAVertex v,
|
||||
DEBUG_PRINTF("there are other paths, cloned tug %zu from vertex %zu\n",
|
||||
g[t].index, g[v].index);
|
||||
|
||||
tugs.push_back(t);
|
||||
tugs.emplace_back(t);
|
||||
add_edge(cyclic, t, g);
|
||||
|
||||
// New vertex gets all of v's successors, including v itself if it's
|
||||
@@ -738,7 +738,7 @@ void unpeelNearEnd(NGHolder &g, ReachSubgraph &rsi,
|
||||
}
|
||||
|
||||
succs->clear();
|
||||
succs->push_back(d);
|
||||
succs->emplace_back(d);
|
||||
|
||||
rsi.repeatMax -= 1;
|
||||
|
||||
@@ -761,7 +761,7 @@ void getSuccessors(const NGHolder &g, const ReachSubgraph &rsi,
|
||||
if (v == last) { /* ignore self loop */
|
||||
continue;
|
||||
}
|
||||
succs->push_back(v);
|
||||
succs->emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,7 +837,7 @@ void replaceSubgraphWithSpecial(NGHolder &g, ReachSubgraph &rsi,
|
||||
remove_vertices(rsi.vertices, g, false);
|
||||
erase_all(&depths, rsi.vertices);
|
||||
|
||||
repeats->push_back(BoundedRepeatData(rsi.historyType, rsi.repeatMin,
|
||||
repeats->emplace_back(BoundedRepeatData(rsi.historyType, rsi.repeatMin,
|
||||
rsi.repeatMax, rsi.minPeriod, cyclic,
|
||||
pos_trigger, tugs));
|
||||
}
|
||||
@@ -905,7 +905,7 @@ void replaceSubgraphWithLazySpecial(NGHolder &g, ReachSubgraph &rsi,
|
||||
remove_vertices(rsi.vertices, g, false);
|
||||
erase_all(&depths, rsi.vertices);
|
||||
|
||||
repeats->push_back(BoundedRepeatData(rsi.historyType, rsi.repeatMin,
|
||||
repeats->emplace_back(BoundedRepeatData(rsi.historyType, rsi.repeatMin,
|
||||
rsi.repeatMax, rsi.minPeriod, cyclic,
|
||||
pos_trigger, tugs));
|
||||
}
|
||||
@@ -1057,7 +1057,7 @@ void buildReachSubgraphs(const NGHolder &g, vector<ReachSubgraph> &rs,
|
||||
}
|
||||
u32 comp_id = rit->second;
|
||||
assert(comp_id < num);
|
||||
rs[comp_id].vertices.push_back(v);
|
||||
rs[comp_id].vertices.emplace_back(v);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1176,9 +1176,9 @@ void addTriggers(NGHolder &g,
|
||||
goto next_edge;
|
||||
}
|
||||
|
||||
starts_by_top[top].push_back(v);
|
||||
starts_by_top[top].emplace_back(v);
|
||||
}
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
next_edge:;
|
||||
}
|
||||
|
||||
@@ -1519,7 +1519,7 @@ struct StrawWalker {
|
||||
}
|
||||
|
||||
v = next;
|
||||
straw.push_back(v);
|
||||
straw.emplace_back(v);
|
||||
}
|
||||
|
||||
straw.clear();
|
||||
@@ -1615,13 +1615,13 @@ vector<CharReach> getUnionedTrigger(const NGHolder &g, const NFAVertex v) {
|
||||
|
||||
if (contains(curr, g.start)) {
|
||||
DEBUG_PRINTF("start in repeat's immediate preds\n");
|
||||
trigger.push_back(CharReach::dot()); // Trigger could be anything!
|
||||
trigger.emplace_back(CharReach::dot()); // Trigger could be anything!
|
||||
return trigger;
|
||||
}
|
||||
|
||||
for (size_t num_steps = 0; num_steps < MAX_TRIGGER_STEPS; num_steps++) {
|
||||
next.clear();
|
||||
trigger.push_back(CharReach());
|
||||
trigger.emplace_back(CharReach());
|
||||
CharReach &cr = trigger.back();
|
||||
|
||||
for (auto v_c : curr) {
|
||||
@@ -1664,7 +1664,7 @@ vector<vector<CharReach>> getRepeatTriggers(const NGHolder &g,
|
||||
triggers.push_back({}); // empty
|
||||
return triggers;
|
||||
}
|
||||
q.push_back(Path(1, u));
|
||||
q.emplace_back(Path(1, u));
|
||||
}
|
||||
|
||||
while (!q.empty()) {
|
||||
@@ -1673,7 +1673,7 @@ vector<vector<CharReach>> getRepeatTriggers(const NGHolder &g,
|
||||
|
||||
if (path.size() >= max_len) {
|
||||
max_len = min(max_len, path.size());
|
||||
done.push_back(path);
|
||||
done.emplace_back(path);
|
||||
goto next_path;
|
||||
}
|
||||
|
||||
@@ -1682,16 +1682,16 @@ vector<vector<CharReach>> getRepeatTriggers(const NGHolder &g,
|
||||
// Found an accept. There's no point expanding this path any
|
||||
// further, we're done.
|
||||
max_len = min(max_len, path.size());
|
||||
done.push_back(path);
|
||||
done.emplace_back(path);
|
||||
goto next_path;
|
||||
}
|
||||
|
||||
if (path.size() + 1 >= max_len) {
|
||||
done.push_back(path);
|
||||
done.back().push_back(u);
|
||||
done.emplace_back(path);
|
||||
done.back().emplace_back(u);
|
||||
} else {
|
||||
q.push_back(path); // copy
|
||||
q.back().push_back(u);
|
||||
q.emplace_back(path); // copy
|
||||
q.back().emplace_back(u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1703,7 +1703,7 @@ vector<vector<CharReach>> getRepeatTriggers(const NGHolder &g,
|
||||
if (q.size() + done.size() > UNIONED_FALLBACK_THRESHOLD) {
|
||||
DEBUG_PRINTF("search too large, fall back to union trigger\n");
|
||||
triggers.clear();
|
||||
triggers.push_back(getUnionedTrigger(g, sink));
|
||||
triggers.emplace_back(getUnionedTrigger(g, sink));
|
||||
return triggers;
|
||||
}
|
||||
}
|
||||
@@ -1715,7 +1715,7 @@ vector<vector<CharReach>> getRepeatTriggers(const NGHolder &g,
|
||||
for (const auto &path : done) {
|
||||
vector<CharReach> reach_path;
|
||||
for (auto jt = path.rbegin(), jte = path.rend(); jt != jte; ++jt) {
|
||||
reach_path.push_back(g[*jt].char_reach);
|
||||
reach_path.emplace_back(g[*jt].char_reach);
|
||||
}
|
||||
unique_triggers.insert(reach_path);
|
||||
}
|
||||
@@ -1960,7 +1960,7 @@ vector<NFAVertex> makeOwnStraw(NGHolder &g, BoundedRepeatData &rd,
|
||||
if (!own_straw.empty()) {
|
||||
add_edge(own_straw.back(), v2, g);
|
||||
}
|
||||
own_straw.push_back(v2);
|
||||
own_straw.emplace_back(v2);
|
||||
}
|
||||
|
||||
// Wire our straw to start, not startDs.
|
||||
@@ -2536,7 +2536,7 @@ void findRepeats(const NGHolder &h, u32 minRepeatVertices,
|
||||
repeatMax = depth::infinity(); /* will continue to pump out matches */
|
||||
}
|
||||
|
||||
repeats_out->push_back(GraphRepeatInfo());
|
||||
repeats_out->emplace_back(GraphRepeatInfo());
|
||||
GraphRepeatInfo &ri = repeats_out->back();
|
||||
ri.vertices.swap(rsi.vertices);
|
||||
ri.repeatMin = rsi.repeatMin;
|
||||
|
@@ -56,7 +56,7 @@ void wireStartToTops(NGHolder &g, const flat_set<NFAVertex> &tops,
|
||||
assert(!isLeafNode(v, g));
|
||||
|
||||
const NFAEdge &e = add_edge(g.start, v, g);
|
||||
tempEdges.push_back(e);
|
||||
tempEdges.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,10 +109,10 @@ void getStateOrdering(NGHolder &g, const flat_set<NFAVertex> &tops,
|
||||
temp.erase(remove(temp.begin(), temp.end(), g.startDs));
|
||||
temp.erase(remove(temp.begin(), temp.end(), g.start));
|
||||
if (proper_out_degree(g.startDs, g)) {
|
||||
temp.push_back(g.startDs);
|
||||
temp.emplace_back(g.startDs);
|
||||
}
|
||||
if (!startIsRedundant(g)) {
|
||||
temp.push_back(g.start);
|
||||
temp.emplace_back(g.start);
|
||||
}
|
||||
|
||||
// Walk ordering, remove vertices that shouldn't be participating in state
|
||||
@@ -122,7 +122,7 @@ void getStateOrdering(NGHolder &g, const flat_set<NFAVertex> &tops,
|
||||
continue; // accepts don't need states
|
||||
}
|
||||
|
||||
ordering.push_back(v);
|
||||
ordering.emplace_back(v);
|
||||
}
|
||||
|
||||
// Output of topo order was in reverse.
|
||||
@@ -167,7 +167,7 @@ void optimiseTightLoops(const NGHolder &g, vector<NFAVertex> &ordering) {
|
||||
continue;
|
||||
}
|
||||
if (edge(t, v, g).second && find(start, it, t) != ite) {
|
||||
candidates.push_back(make_pair(v, t));
|
||||
candidates.emplace_back(make_pair(v, t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -166,12 +166,12 @@ void buildRegionMapping(const NGHolder &g,
|
||||
}
|
||||
|
||||
if (isRegionEntry(g, v, regions)) {
|
||||
info[region].enters.push_back(v);
|
||||
info[region].enters.emplace_back(v);
|
||||
}
|
||||
if (isRegionExit(g, v, regions)) {
|
||||
info[region].exits.push_back(v);
|
||||
info[region].exits.emplace_back(v);
|
||||
}
|
||||
info[region].full.push_back(v);
|
||||
info[region].full.emplace_back(v);
|
||||
}
|
||||
|
||||
for (auto &m : info) {
|
||||
@@ -410,7 +410,7 @@ makePrefix(const NGHolder &g, const unordered_map<NFAVertex, u32> ®ions,
|
||||
if (p_v == prefix.accept || regions.at(v) < dead_region) {
|
||||
continue;
|
||||
}
|
||||
to_clear.push_back(p_v);
|
||||
to_clear.emplace_back(p_v);
|
||||
}
|
||||
|
||||
for (auto v : to_clear) {
|
||||
@@ -1045,7 +1045,7 @@ void addReporterVertices(const region_info &r, const NGHolder &g,
|
||||
for (auto v : r.exits) {
|
||||
if (edge(v, g.accept, g).second || edge(v, g.acceptEod, g).second) {
|
||||
DEBUG_PRINTF("add reporter %zu\n", g[v].index);
|
||||
reporters.push_back(v);
|
||||
reporters.emplace_back(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1060,7 +1060,7 @@ void addMappedReporterVertices(const region_info &r, const NGHolder &g,
|
||||
DEBUG_PRINTF("adding v=%zu\n", g[v].index);
|
||||
auto it = mapping.find(v);
|
||||
assert(it != mapping.end());
|
||||
reporters.push_back(it->second);
|
||||
reporters.emplace_back(it->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1109,7 +1109,7 @@ void expandGraph(NGHolder &g, unordered_map<NFAVertex, u32> ®ions,
|
||||
if (is_special(v, g) || regions.at(v) < split_region) {
|
||||
continue;
|
||||
}
|
||||
tail_vertices.push_back(v);
|
||||
tail_vertices.emplace_back(v);
|
||||
}
|
||||
|
||||
for (auto enter : enters) {
|
||||
@@ -1166,7 +1166,7 @@ void expandGraph(NGHolder &g, unordered_map<NFAVertex, u32> ®ions,
|
||||
}, g);
|
||||
}
|
||||
|
||||
new_enters.push_back(orig_to_copy[enter]);
|
||||
new_enters.emplace_back(orig_to_copy[enter]);
|
||||
}
|
||||
|
||||
// Remove the original set of tail vertices.
|
||||
@@ -1659,7 +1659,7 @@ void anchorStarts(NGHolder &g) {
|
||||
continue;
|
||||
}
|
||||
add_edge_if_not_present(g.start, v, g[e], g);
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
remove_edges(dead, g);
|
||||
}
|
||||
@@ -1720,7 +1720,7 @@ void clearProperInEdges(NGHolder &g, const NFAVertex sink) {
|
||||
if (source(e, g) == g.accept) {
|
||||
continue;
|
||||
}
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
|
||||
if (dead.empty()) {
|
||||
@@ -2214,7 +2214,7 @@ bool leadingLiterals(const NGHolder &g, set<ue2_literal> *lits,
|
||||
sds_succ.erase(g.startDs);
|
||||
|
||||
map<NFAVertex, vector<ue2_literal> > curr;
|
||||
curr[g.startDs].push_back(ue2_literal());
|
||||
curr[g.startDs].emplace_back(ue2_literal());
|
||||
|
||||
map<NFAVertex, set<NFAVertex> > seen;
|
||||
map<NFAVertex, vector<ue2_literal> > next;
|
||||
@@ -2273,7 +2273,7 @@ bool leadingLiterals(const NGHolder &g, set<ue2_literal> *lits,
|
||||
goto exit;
|
||||
}
|
||||
did_expansion = true;
|
||||
out.push_back(lit);
|
||||
out.emplace_back(lit);
|
||||
out.back().push_back(c, nocase);
|
||||
count++;
|
||||
if (out.back().length() > MAX_MASK2_WIDTH
|
||||
@@ -2469,7 +2469,7 @@ bool doLitHaigSom(NG &ng, NGHolder &g, som_type som) {
|
||||
dumpHolder(*rhs, 91, "lithaig_rhs", ng.cc.grey);
|
||||
|
||||
vector<vector<CharReach> > triggers;
|
||||
triggers.push_back(as_cr_seq(lit));
|
||||
triggers.emplace_back(as_cr_seq(lit));
|
||||
|
||||
assert(rhs->kind == NFA_SUFFIX);
|
||||
shared_ptr<raw_som_dfa> haig
|
||||
@@ -2579,7 +2579,7 @@ bool doHaigLitHaigSom(NG &ng, NGHolder &g,
|
||||
assert(rhs->kind == NFA_SUFFIX);
|
||||
|
||||
vector<vector<CharReach> > triggers;
|
||||
triggers.push_back(as_cr_seq(lit));
|
||||
triggers.emplace_back(as_cr_seq(lit));
|
||||
|
||||
ue2_literal lit2;
|
||||
if (getTrailingLiteral(g, &lit2)
|
||||
@@ -2677,7 +2677,7 @@ bool doMultiLitHaigSom(NG &ng, NGHolder &g, som_type som) {
|
||||
}
|
||||
|
||||
assert(lit.length() <= MAX_MASK2_WIDTH || !mixed_sensitivity(lit));
|
||||
triggers.push_back(as_cr_seq(lit));
|
||||
triggers.emplace_back(as_cr_seq(lit));
|
||||
}
|
||||
|
||||
bool unordered_som_triggers = true; /* TODO: check overlaps to ensure that
|
||||
@@ -2791,7 +2791,7 @@ map<u32, region_info>::const_iterator tryForLaterRevNfaCut(const NGHolder &g,
|
||||
continue;
|
||||
}
|
||||
|
||||
cands.push_back(it);
|
||||
cands.emplace_back(it);
|
||||
}
|
||||
|
||||
while (!cands.empty()) {
|
||||
@@ -3023,7 +3023,7 @@ sombe_rv doSom(NG &ng, NGHolder &g, const ExpressionInfo &expr, u32 comp_id,
|
||||
vector<som_plan> plan;
|
||||
retry:
|
||||
// Note: no-one should ever pay attention to the root plan's parent.
|
||||
plan.push_back(som_plan(prefix, escapes, false, 0));
|
||||
plan.emplace_back(som_plan(prefix, escapes, false, 0));
|
||||
dumpHolder(*plan.back().prefix, 12, "som_prefix", cc.grey);
|
||||
if (!prefix_by_rev) {
|
||||
if (!doSomPlanning(g, stuck, regions, info, picked, plan, cc.grey)) {
|
||||
|
@@ -102,7 +102,7 @@ bool forkVertex(NFAVertex v, NGHolder &g, vector<DepthMinMax> &depths,
|
||||
for (const auto &e : in_edges_range(v, g)) {
|
||||
const DepthMinMax &d = getDepth(source(e, g), g, depths);
|
||||
assert(d.min == d.max);
|
||||
predGroups[d.min].push_back(e);
|
||||
predGroups[d.min].emplace_back(e);
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("forking vertex with %zu pred groups\n", predGroups.size());
|
||||
@@ -121,7 +121,7 @@ bool forkVertex(NFAVertex v, NGHolder &g, vector<DepthMinMax> &depths,
|
||||
NFAVertex clone = add_vertex(g[v], g);
|
||||
depth clone_depth = predDepth + 1;
|
||||
g[clone].index = clone_idx;
|
||||
depths.push_back(DepthMinMax(clone_depth, clone_depth));
|
||||
depths.emplace_back(DepthMinMax(clone_depth, clone_depth));
|
||||
DEBUG_PRINTF("cloned vertex %u with depth %s\n", clone_idx,
|
||||
clone_depth.str().c_str());
|
||||
|
||||
|
@@ -60,10 +60,10 @@ vector<DepthMinMax> getDistancesFromSOM(const NGHolder &g_orig) {
|
||||
vector<NFAVertex> vstarts;
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (is_virtual_start(v, g)) {
|
||||
vstarts.push_back(v);
|
||||
vstarts.emplace_back(v);
|
||||
}
|
||||
}
|
||||
vstarts.push_back(g.startDs);
|
||||
vstarts.emplace_back(g.startDs);
|
||||
|
||||
// wire the successors of every virtual start or startDs to g.start.
|
||||
for (auto v : vstarts) {
|
||||
|
@@ -281,7 +281,7 @@ void findDerivedSquashers(const NGHolder &g, const vector<NFAVertex> &vByIndex,
|
||||
smgb_cache &cache) {
|
||||
deque<NFAVertex> remaining;
|
||||
for (const auto &m : *squash) {
|
||||
remaining.push_back(m.first);
|
||||
remaining.emplace_back(m.first);
|
||||
}
|
||||
|
||||
while (!remaining.empty()) {
|
||||
@@ -313,7 +313,7 @@ void findDerivedSquashers(const NGHolder &g, const vector<NFAVertex> &vByIndex,
|
||||
DEBUG_PRINTF("%zu is an upstream squasher of %zu\n", u_index,
|
||||
g[v].index);
|
||||
(*squash)[u] = u_squash;
|
||||
remaining.push_back(u);
|
||||
remaining.emplace_back(u);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,7 +639,7 @@ vector<NFAVertex> findUnreachable(const NGHolder &g) {
|
||||
vector<NFAVertex> unreach;
|
||||
for (auto v : vertices_range(revg)) {
|
||||
if (!contains(colours, v)) {
|
||||
unreach.push_back(NFAVertex(v));
|
||||
unreach.emplace_back(NFAVertex(v));
|
||||
}
|
||||
}
|
||||
return unreach;
|
||||
|
@@ -92,7 +92,7 @@ struct ranking_info {
|
||||
u32 add_to_tail(NFAVertex v) {
|
||||
u32 rank = size();
|
||||
to_rank[v] = rank;
|
||||
to_vertex.push_back(v);
|
||||
to_vertex.emplace_back(v);
|
||||
return rank;
|
||||
}
|
||||
|
||||
|
@@ -178,7 +178,7 @@ void findSeeds(const NGHolder &h, const bool som, vector<NFAVertex> *seeds) {
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("%zu is a seed\n", h[v].index);
|
||||
seeds->push_back(v);
|
||||
seeds->emplace_back(v);
|
||||
already_seeds.insert(v);
|
||||
}
|
||||
}
|
||||
|
@@ -407,7 +407,7 @@ void appendLiteral(NGHolder &h, const ue2_literal &s) {
|
||||
vector<NFAVertex> tail;
|
||||
assert(in_degree(h.acceptEod, h) == 1);
|
||||
for (auto v : inv_adjacent_vertices_range(h.accept, h)) {
|
||||
tail.push_back(v);
|
||||
tail.emplace_back(v);
|
||||
}
|
||||
assert(!tail.empty());
|
||||
|
||||
@@ -422,7 +422,7 @@ void appendLiteral(NGHolder &h, const ue2_literal &s) {
|
||||
add_edge(u, v, h);
|
||||
}
|
||||
tail.clear();
|
||||
tail.push_back(v);
|
||||
tail.emplace_back(v);
|
||||
}
|
||||
|
||||
for (auto v : tail) {
|
||||
|
@@ -394,7 +394,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored,
|
||||
|
||||
lits->reserve(lit_info.size());
|
||||
for (auto &m : lit_info) {
|
||||
lits->push_back(move(m.second));
|
||||
lits->emplace_back(move(m.second));
|
||||
}
|
||||
DEBUG_PRINTF("%zu candidate literal sets\n", lits->size());
|
||||
}
|
||||
@@ -434,7 +434,7 @@ void getRegionRoseLiterals(const NGHolder &g, bool seeking_anchored,
|
||||
}
|
||||
|
||||
if (isRegionExit(g, v, regions)) {
|
||||
exits[region].push_back(v);
|
||||
exits[region].emplace_back(v);
|
||||
}
|
||||
|
||||
if (isRegionEntry(g, v, regions)) {
|
||||
@@ -531,7 +531,7 @@ void getRegionRoseLiterals(const NGHolder &g, bool seeking_anchored,
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("candidate is a candidate\n");
|
||||
lits->push_back(make_unique<VertLitInfo>(vv, s, anchored));
|
||||
lits->emplace_back(make_unique<VertLitInfo>(vv, s, anchored));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ void getCandidatePivots(const NGHolder &g, set<NFAVertex> *cand,
|
||||
assert(ait != accepts.end());
|
||||
NFAVertex curr = *ait;
|
||||
while (curr && !is_special(curr, g)) {
|
||||
dom_trace.push_back(curr);
|
||||
dom_trace.emplace_back(curr);
|
||||
curr = dominators[curr];
|
||||
}
|
||||
reverse(dom_trace.begin(), dom_trace.end());
|
||||
@@ -600,7 +600,7 @@ void getCandidatePivots(const NGHolder &g, set<NFAVertex> *cand,
|
||||
curr = *ait;
|
||||
vector<NFAVertex> dom_trace2;
|
||||
while (curr && !is_special(curr, g)) {
|
||||
dom_trace2.push_back(curr);
|
||||
dom_trace2.emplace_back(curr);
|
||||
curr = dominators[curr];
|
||||
}
|
||||
reverse(dom_trace2.begin(), dom_trace2.end());
|
||||
@@ -1095,7 +1095,7 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
|
||||
for (const RoseInEdge &e : ee) {
|
||||
RoseInVertex src = source(e, vg);
|
||||
RoseInVertex dest = target(e, vg);
|
||||
images[src].push_back(dest);
|
||||
images[src].emplace_back(dest);
|
||||
remove_edge(e, vg);
|
||||
}
|
||||
|
||||
@@ -1149,7 +1149,7 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
|
||||
add_edge(v, dest, RoseInEdgeProps(rhs, 0U), vg);
|
||||
}
|
||||
}
|
||||
verts_by_image[image].push_back(v);
|
||||
verts_by_image[image].emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1598,7 +1598,7 @@ void removeRedundantLiteralsFromPrefixes(RoseInGraph &g,
|
||||
|
||||
if (delay == lit.length() && edge(h->start, h->accept, *h).second
|
||||
&& num_vertices(*h) == N_SPECIALS) {
|
||||
to_anchor.push_back(e);
|
||||
to_anchor.emplace_back(e);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1775,7 +1775,7 @@ void removeRedundantLiteralsFromInfixes(RoseInGraph &g,
|
||||
}
|
||||
|
||||
NGHolder *h = g[e].graph.get();
|
||||
infixes[h].push_back(e);
|
||||
infixes[h].emplace_back(e);
|
||||
}
|
||||
|
||||
for (const auto &m : infixes) {
|
||||
@@ -2110,7 +2110,7 @@ void findBetterPrefixes(RoseInGraph &vg, const CompileContext &cc) {
|
||||
assert(vg[target(e, vg)].type == RIV_LITERAL);
|
||||
if (vg[e].graph) {
|
||||
NGHolder *h = vg[e].graph.get();
|
||||
prefixes[h].push_back(e);
|
||||
prefixes[h].emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2174,7 +2174,7 @@ void extractStrongLiterals(RoseInGraph &vg, const CompileContext &cc) {
|
||||
|
||||
if (vg[ve].graph) {
|
||||
NGHolder *h = vg[ve].graph.get();
|
||||
edges_by_graph[h].push_back(ve);
|
||||
edges_by_graph[h].emplace_back(ve);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2262,7 +2262,7 @@ void improveWeakInfixes(RoseInGraph &vg, const CompileContext &cc) {
|
||||
for (const RoseInEdge &ve : edges_range(vg)) {
|
||||
NGHolder *h = vg[ve].graph.get();
|
||||
if (contains(weak, h)) {
|
||||
weak_edges[h].push_back(ve);
|
||||
weak_edges[h].emplace_back(ve);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2366,7 +2366,7 @@ bool replaceSuffixWithInfix(const NGHolder &h, RoseInGraph &vg,
|
||||
|
||||
VertLitInfo &vli = by_reports[make_pair(false, h[v].reports)];
|
||||
insert(&vli.lit, ss);
|
||||
vli.vv.push_back(v);
|
||||
vli.vv.emplace_back(v);
|
||||
seen.insert(v);
|
||||
}
|
||||
|
||||
@@ -2384,7 +2384,7 @@ bool replaceSuffixWithInfix(const NGHolder &h, RoseInGraph &vg,
|
||||
|
||||
VertLitInfo &vli = by_reports[make_pair(true, h[v].reports)];
|
||||
insert(&vli.lit, ss);
|
||||
vli.vv.push_back(v);
|
||||
vli.vv.emplace_back(v);
|
||||
}
|
||||
|
||||
assert(!by_reports.empty());
|
||||
@@ -2435,7 +2435,7 @@ void avoidSuffixes(RoseInGraph &vg, const CompileContext &cc) {
|
||||
assert(vg[e].graph); /* non suffix paths should be wired to other
|
||||
accepts */
|
||||
const NGHolder *h = vg[e].graph.get();
|
||||
suffixes[h].push_back(e);
|
||||
suffixes[h].emplace_back(e);
|
||||
}
|
||||
|
||||
/* look at suffixes and try to split */
|
||||
@@ -2530,7 +2530,7 @@ void lookForDoubleCut(RoseInGraph &vg, const CompileContext &cc) {
|
||||
for (const RoseInEdge &ve : edges_range(vg)) {
|
||||
if (vg[ve].graph && vg[source(ve, vg)].type == RIV_LITERAL) {
|
||||
const NGHolder *h = vg[ve].graph.get();
|
||||
right_edges[h].push_back(ve);
|
||||
right_edges[h].emplace_back(ve);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2671,7 +2671,7 @@ void decomposeLiteralChains(RoseInGraph &vg, const CompileContext &cc) {
|
||||
for (const RoseInEdge &ve : edges_range(vg)) {
|
||||
if (vg[ve].graph && vg[source(ve, vg)].type == RIV_LITERAL) {
|
||||
const NGHolder *h = vg[ve].graph.get();
|
||||
right_edges[h].push_back(ve);
|
||||
right_edges[h].emplace_back(ve);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2721,7 +2721,7 @@ void lookForCleanEarlySplits(RoseInGraph &vg, const CompileContext &cc) {
|
||||
for (const RoseInEdge &e : out_edges_range(v, vg)) {
|
||||
if (vg[e].graph) {
|
||||
NGHolder *h = vg[e].graph.get();
|
||||
rightfixes[h].push_back(e);
|
||||
rightfixes[h].emplace_back(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2757,7 +2757,7 @@ void rehomeEodSuffixes(RoseInGraph &vg) {
|
||||
continue;
|
||||
}
|
||||
|
||||
acc_edges.push_back(e);
|
||||
acc_edges.emplace_back(e);
|
||||
}
|
||||
|
||||
for (const RoseInEdge &e : acc_edges) {
|
||||
@@ -2797,7 +2797,7 @@ vector<vector<CharReach>> getDfaTriggers(RoseInGraph &vg,
|
||||
for (const auto &e : edges) {
|
||||
RoseInVertex s = source(e, vg);
|
||||
if (vg[s].type == RIV_LITERAL) {
|
||||
triggers.push_back(as_cr_seq(vg[s].s));
|
||||
triggers.emplace_back(as_cr_seq(vg[s].s));
|
||||
}
|
||||
ENSURE_AT_LEAST(&max_offset, vg[s].max_offset);
|
||||
LIMIT_TO_AT_MOST(&min_offset, vg[s].min_offset);
|
||||
@@ -2911,7 +2911,7 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
|
||||
for (const RoseInEdge &ve : edges_range(vg)) {
|
||||
if (vg[ve].graph && !vg[ve].dfa) {
|
||||
auto &h = vg[ve].graph;
|
||||
edges_by_graph[h].push_back(ve);
|
||||
edges_by_graph[h].emplace_back(ve);
|
||||
}
|
||||
}
|
||||
for (auto &m : edges_by_graph) {
|
||||
|
Reference in New Issue
Block a user