mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-19 02:30:35 +03:00
replace push_back by emplace_back where possible
This commit is contained in:
@@ -301,7 +301,7 @@ void createVertices(RoseBuildImpl *tbi,
|
||||
}
|
||||
|
||||
DEBUG_PRINTF(" adding new vertex index=%zu\n", tbi->g[w].index);
|
||||
vertex_map[iv].push_back(w);
|
||||
vertex_map[iv].emplace_back(w);
|
||||
} else {
|
||||
w = created[key];
|
||||
}
|
||||
@@ -612,7 +612,7 @@ void doRoseLiteralVertex(RoseBuildImpl *tbi, bool use_eod_table,
|
||||
RoseVertex v = tryForAnchoredVertex(tbi, iv_info, ep);
|
||||
if (v != RoseGraph::null_vertex()) {
|
||||
DEBUG_PRINTF("add anchored literal vertex\n");
|
||||
vertex_map[iv].push_back(v);
|
||||
vertex_map[iv].emplace_back(v);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -656,7 +656,7 @@ unique_ptr<NGHolder> makeRoseEodPrefix(const NGHolder &h, RoseBuildImpl &build,
|
||||
continue;
|
||||
}
|
||||
add_edge_if_not_present(u, g.accept, g);
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
|
||||
if (!contains(remap, g[u].reports)) {
|
||||
remap[g[u].reports] = build.getNewNfaReport();
|
||||
@@ -967,11 +967,11 @@ void populateRoseGraph(RoseBuildImpl *tbi, RoseBuildData &bd) {
|
||||
|
||||
if (ig[iv].type == RIV_START) {
|
||||
DEBUG_PRINTF("is root\n");
|
||||
vertex_map[iv].push_back(tbi->root);
|
||||
vertex_map[iv].emplace_back(tbi->root);
|
||||
continue;
|
||||
} else if (ig[iv].type == RIV_ANCHORED_START) {
|
||||
DEBUG_PRINTF("is anchored root\n");
|
||||
vertex_map[iv].push_back(tbi->anchored_root);
|
||||
vertex_map[iv].emplace_back(tbi->anchored_root);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1544,7 +1544,7 @@ bool RoseBuildImpl::addRose(const RoseInGraph &ig, bool prefilter) {
|
||||
NGHolder *h = in[e].graph.get();
|
||||
|
||||
assert(isCorrectlyTopped(*h));
|
||||
graphs[h].push_back(e);
|
||||
graphs[h].emplace_back(e);
|
||||
}
|
||||
|
||||
vector<RoseInEdge> graph_edges;
|
||||
@@ -1624,7 +1624,7 @@ bool roseCheckRose(const RoseInGraph &ig, bool prefilter,
|
||||
continue;
|
||||
}
|
||||
|
||||
graphs.push_back(ig[e].graph.get());
|
||||
graphs.emplace_back(ig[e].graph.get());
|
||||
}
|
||||
|
||||
for (const auto &g : graphs) {
|
||||
@@ -1781,9 +1781,9 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h) {
|
||||
}
|
||||
|
||||
if (rdfa) {
|
||||
outfixes.push_back(OutfixInfo(move(rdfa)));
|
||||
outfixes.emplace_back(OutfixInfo(move(rdfa)));
|
||||
} else {
|
||||
outfixes.push_back(OutfixInfo(cloneHolder(h)));
|
||||
outfixes.emplace_back(OutfixInfo(cloneHolder(h)));
|
||||
}
|
||||
|
||||
populateOutfixInfo(outfixes.back(), h, *this);
|
||||
@@ -1794,7 +1794,7 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h) {
|
||||
bool RoseBuildImpl::addOutfix(const NGHolder &h, const raw_som_dfa &haig) {
|
||||
DEBUG_PRINTF("haig with %zu states\n", haig.states.size());
|
||||
|
||||
outfixes.push_back(OutfixInfo(ue2::make_unique<raw_som_dfa>(haig)));
|
||||
outfixes.emplace_back(OutfixInfo(ue2::make_unique<raw_som_dfa>(haig)));
|
||||
populateOutfixInfo(outfixes.back(), h, *this);
|
||||
|
||||
return true; /* failure is not yet an option */
|
||||
@@ -1807,7 +1807,7 @@ bool RoseBuildImpl::addOutfix(const raw_puff &rp) {
|
||||
|
||||
auto *mpv = mpv_outfix->mpv();
|
||||
assert(mpv);
|
||||
mpv->puffettes.push_back(rp);
|
||||
mpv->puffettes.emplace_back(rp);
|
||||
|
||||
mpv_outfix->maxBAWidth = ROSE_BOUND_INF; /* not ba */
|
||||
mpv_outfix->minWidth = min(mpv_outfix->minWidth, depth(rp.repeats));
|
||||
@@ -1832,7 +1832,7 @@ bool RoseBuildImpl::addChainTail(const raw_puff &rp, u32 *queue_out,
|
||||
|
||||
auto *mpv = mpv_outfix->mpv();
|
||||
assert(mpv);
|
||||
mpv->triggered_puffettes.push_back(rp);
|
||||
mpv->triggered_puffettes.emplace_back(rp);
|
||||
|
||||
mpv_outfix->maxBAWidth = ROSE_BOUND_INF; /* not ba */
|
||||
mpv_outfix->minWidth = min(mpv_outfix->minWidth, depth(rp.repeats));
|
||||
|
||||
@@ -185,7 +185,7 @@ bool expandFmlCandidates(const CharReach &cr, vector<ue2_literal> &curr,
|
||||
return false;
|
||||
}
|
||||
|
||||
curr.push_back(lit);
|
||||
curr.emplace_back(lit);
|
||||
curr.back().push_back(c, nocase);
|
||||
}
|
||||
}
|
||||
@@ -335,8 +335,8 @@ void buildLiteralMask(const vector<CharReach> &mask, vector<u8> &msk,
|
||||
auto it = ite - min(size_t{HWLM_MASKLEN}, mask.size() - delay);
|
||||
|
||||
for (; it != ite; ++it) {
|
||||
msk.push_back(0);
|
||||
cmp.push_back(0);
|
||||
msk.emplace_back(0);
|
||||
cmp.emplace_back(0);
|
||||
make_and_cmp_mask(*it, &msk.back(), &cmp.back());
|
||||
}
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ void mergeAnchoredDfas(vector<unique_ptr<raw_dfa>> &dfas,
|
||||
for (auto &rdfa : dfas) {
|
||||
u32 start_size = mcclellanStartReachSize(rdfa.get());
|
||||
if (start_size <= MAX_SMALL_START_REACH) {
|
||||
small_starts.push_back(move(rdfa));
|
||||
small_starts.emplace_back(move(rdfa));
|
||||
} else {
|
||||
big_starts.push_back(move(rdfa));
|
||||
big_starts.emplace_back(move(rdfa));
|
||||
}
|
||||
}
|
||||
dfas.clear();
|
||||
@@ -159,10 +159,10 @@ void mergeAnchoredDfas(vector<unique_ptr<raw_dfa>> &dfas,
|
||||
|
||||
// Rehome our groups into one vector.
|
||||
for (auto &rdfa : small_starts) {
|
||||
dfas.push_back(move(rdfa));
|
||||
dfas.emplace_back(move(rdfa));
|
||||
}
|
||||
for (auto &rdfa : big_starts) {
|
||||
dfas.push_back(move(rdfa));
|
||||
dfas.emplace_back(move(rdfa));
|
||||
}
|
||||
|
||||
// Final test: if we've built two DFAs here that are small enough, we can
|
||||
@@ -300,7 +300,7 @@ public:
|
||||
explicit Automaton_Holder(const NGHolder &g_in) : g(g_in) {
|
||||
for (auto v : vertices_range(g)) {
|
||||
vertexToIndex[v] = indexToVertex.size();
|
||||
indexToVertex.push_back(v);
|
||||
indexToVertex.emplace_back(v);
|
||||
}
|
||||
|
||||
assert(indexToVertex.size() <= ANCHORED_NFA_STATE_LIMIT);
|
||||
@@ -331,7 +331,7 @@ private:
|
||||
|
||||
if (t.any() && t != esets[i]) {
|
||||
esets[i] &= ~t;
|
||||
esets.push_back(t);
|
||||
esets.emplace_back(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ NFAVertex extractLiteral(const NGHolder &h, ue2_literal *lit) {
|
||||
if (cr.count() > 1 && !cr.isCaselessChar()) {
|
||||
break;
|
||||
}
|
||||
lit_verts.push_back(v);
|
||||
lit_verts.emplace_back(v);
|
||||
}
|
||||
|
||||
if (lit_verts.empty()) {
|
||||
@@ -686,7 +686,7 @@ int finalise_out(RoseBuildImpl &build, const NGHolder &h,
|
||||
if (check_dupe(*out_dfa, build.anchored_nfas[hash], remap)) {
|
||||
return ANCHORED_REMAP;
|
||||
}
|
||||
build.anchored_nfas[hash].push_back(move(out_dfa));
|
||||
build.anchored_nfas[hash].emplace_back(move(out_dfa));
|
||||
return ANCHORED_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -768,7 +768,7 @@ void buildSimpleDfas(const RoseBuildImpl &build, const vector<u32> &frag_map,
|
||||
rdfa->start_floating = DEAD_STATE;
|
||||
rdfa->alpha_size = autom.alphasize;
|
||||
rdfa->alpha_remap = autom.alpha;
|
||||
anchored_dfas->push_back(move(rdfa));
|
||||
anchored_dfas->emplace_back(move(rdfa));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,7 +785,7 @@ vector<unique_ptr<raw_dfa>> getAnchoredDfas(RoseBuildImpl &build,
|
||||
// DFAs that already exist as raw_dfas.
|
||||
for (auto &anch_dfas : build.anchored_nfas) {
|
||||
for (auto &rdfa : anch_dfas.second) {
|
||||
dfas.push_back(move(rdfa));
|
||||
dfas.emplace_back(move(rdfa));
|
||||
}
|
||||
}
|
||||
build.anchored_nfas.clear();
|
||||
@@ -823,7 +823,7 @@ size_t buildNfas(vector<raw_dfa> &anchored_dfas,
|
||||
|
||||
for (auto &rdfa : anchored_dfas) {
|
||||
u32 removed_dots = remove_leading_dots(rdfa);
|
||||
start_offset->push_back(removed_dots);
|
||||
start_offset->emplace_back(removed_dots);
|
||||
|
||||
minimize_hopcroft(rdfa, cc.grey);
|
||||
|
||||
@@ -835,7 +835,7 @@ size_t buildNfas(vector<raw_dfa> &anchored_dfas,
|
||||
|
||||
assert(nfa->length);
|
||||
total_size += ROUNDUP_CL(sizeof(anchored_matcher_info) + nfa->length);
|
||||
nfas->push_back(move(nfa));
|
||||
nfas->emplace_back(move(nfa));
|
||||
}
|
||||
|
||||
// We no longer need to keep the raw_dfa structures around.
|
||||
@@ -862,7 +862,7 @@ vector<raw_dfa> buildAnchoredDfas(RoseBuildImpl &build,
|
||||
dfas.reserve(anch_dfas.size());
|
||||
for (auto &rdfa : anch_dfas) {
|
||||
assert(rdfa);
|
||||
dfas.push_back(move(*rdfa));
|
||||
dfas.emplace_back(move(*rdfa));
|
||||
}
|
||||
return dfas;
|
||||
}
|
||||
|
||||
@@ -750,7 +750,7 @@ static
|
||||
vector<CharReach> as_cr_seq(const rose_literal_id &lit) {
|
||||
vector<CharReach> rv = as_cr_seq(lit.s);
|
||||
for (u32 i = 0; i < lit.delay; i++) {
|
||||
rv.push_back(CharReach::dot());
|
||||
rv.emplace_back(CharReach::dot());
|
||||
}
|
||||
|
||||
/* TODO: take into account cmp/msk */
|
||||
@@ -776,7 +776,7 @@ void findTriggerSequences(const RoseBuildImpl &tbi,
|
||||
|
||||
for (u32 id : lit_ids) {
|
||||
const rose_literal_id &lit = tbi.literals.at(id);
|
||||
(*trigger_lits)[top].push_back(as_cr_seq(lit));
|
||||
(*trigger_lits)[top].emplace_back(as_cr_seq(lit));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -914,7 +914,7 @@ void appendTailToHolder(NGHolder &h, const vector<CharReach> &tail) {
|
||||
|
||||
map<flat_set<ReportID>, vector<NFAVertex> > reporters;
|
||||
for (auto v : inv_adjacent_vertices_range(h.accept, h)) {
|
||||
reporters[h[v].reports].push_back(v);
|
||||
reporters[h[v].reports].emplace_back(v);
|
||||
}
|
||||
|
||||
for (const auto &e : reporters) {
|
||||
@@ -1425,10 +1425,10 @@ void buildExclusiveInfixes(RoseBuildImpl &build, build_context &bc,
|
||||
ExclusiveSubengine engine;
|
||||
engine.nfa = move(n);
|
||||
engine.vertices = verts;
|
||||
info.subengines.push_back(move(engine));
|
||||
info.subengines.emplace_back(move(engine));
|
||||
}
|
||||
info.queue = qif.get_queue();
|
||||
exclusive_info.push_back(move(info));
|
||||
exclusive_info.emplace_back(move(info));
|
||||
}
|
||||
updateExclusiveInfixProperties(build, exclusive_info, bc.leftfix_info,
|
||||
no_retrigger_queues);
|
||||
@@ -1462,7 +1462,7 @@ void findExclusiveInfixes(RoseBuildImpl &build, build_context &bc,
|
||||
// NFA already built.
|
||||
u32 id = leftfixes[leftfix];
|
||||
if (contains(vertex_map, id)) {
|
||||
vertex_map[id].push_back(v);
|
||||
vertex_map[id].emplace_back(v);
|
||||
}
|
||||
DEBUG_PRINTF("sharing leftfix, id=%u\n", id);
|
||||
continue;
|
||||
@@ -1474,7 +1474,7 @@ void findExclusiveInfixes(RoseBuildImpl &build, build_context &bc,
|
||||
|
||||
if (leftfix.graph() || leftfix.castle()) {
|
||||
leftfixes.emplace(leftfix, role_id);
|
||||
vertex_map[role_id].push_back(v);
|
||||
vertex_map[role_id].emplace_back(v);
|
||||
|
||||
map<u32, vector<vector<CharReach>>> triggers;
|
||||
findTriggerSequences(build, infixTriggers.at(leftfix), &triggers);
|
||||
@@ -1545,7 +1545,7 @@ bool buildLeftfixes(RoseBuildImpl &tbi, build_context &bc,
|
||||
}
|
||||
}
|
||||
|
||||
succs[leftfix].push_back(v);
|
||||
succs[leftfix].emplace_back(v);
|
||||
}
|
||||
|
||||
rose_group initial_groups = tbi.getInitialGroups();
|
||||
@@ -1867,13 +1867,13 @@ void buildExclusiveSuffixes(RoseBuildImpl &build, build_context &bc,
|
||||
ExclusiveSubengine engine;
|
||||
engine.nfa = move(n);
|
||||
engine.vertices = verts;
|
||||
info.subengines.push_back(move(engine));
|
||||
info.subengines.emplace_back(move(engine));
|
||||
|
||||
const auto &reports = all_reports(s);
|
||||
info.reports.insert(reports.begin(), reports.end());
|
||||
}
|
||||
info.queue = qif.get_queue();
|
||||
exclusive_info.push_back(move(info));
|
||||
exclusive_info.emplace_back(move(info));
|
||||
}
|
||||
updateExclusiveSuffixProperties(build, exclusive_info,
|
||||
no_retrigger_queues);
|
||||
@@ -1904,7 +1904,7 @@ void findExclusiveSuffixes(RoseBuildImpl &tbi, build_context &bc,
|
||||
if (contains(suffixes, s)) {
|
||||
u32 id = suffixes[s];
|
||||
if (!tbi.isInETable(v)) {
|
||||
vertex_map[id].push_back(v);
|
||||
vertex_map[id].emplace_back(v);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -1918,7 +1918,7 @@ void findExclusiveSuffixes(RoseBuildImpl &tbi, build_context &bc,
|
||||
DEBUG_PRINTF("assigning %p to id %u\n", s.graph(), role_id);
|
||||
suffixes.emplace(s, role_id);
|
||||
|
||||
vertex_map[role_id].push_back(v);
|
||||
vertex_map[role_id].emplace_back(v);
|
||||
const set<PredTopPair> &s_triggers = suffixTriggers.at(s);
|
||||
map<u32, vector<vector<CharReach>>> triggers;
|
||||
findTriggerSequences(tbi, s_triggers, &triggers);
|
||||
@@ -2191,7 +2191,7 @@ u32 buildLastByteIter(const RoseGraph &g, build_context &bc) {
|
||||
// Eager EOD reporters won't have state indices.
|
||||
auto it = bc.roleStateIndices.find(v);
|
||||
if (it != end(bc.roleStateIndices)) {
|
||||
lb_roles.push_back(it->second);
|
||||
lb_roles.emplace_back(it->second);
|
||||
DEBUG_PRINTF("last byte %u\n", it->second);
|
||||
}
|
||||
}
|
||||
@@ -2264,7 +2264,7 @@ vector<u32> buildSuffixEkeyLists(const RoseBuildImpl &build, build_context &bc,
|
||||
u32 qi = e.first;
|
||||
auto &ekeys = e.second;
|
||||
assert(!ekeys.empty());
|
||||
ekeys.push_back(INVALID_EKEY); /* terminator */
|
||||
ekeys.emplace_back(INVALID_EKEY); /* terminator */
|
||||
out[qi] = bc.engine_blob.add_range(ekeys);
|
||||
}
|
||||
|
||||
@@ -2279,7 +2279,7 @@ u32 buildEodNfaIterator(build_context &bc, const u32 activeQueueCount) {
|
||||
const auto &eng_info = bc.engine_info_by_queue.at(qi);
|
||||
if (eng_info.accepts_eod) {
|
||||
DEBUG_PRINTF("nfa qi=%u accepts eod\n", qi);
|
||||
keys.push_back(qi);
|
||||
keys.emplace_back(qi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2354,7 +2354,7 @@ void addSomRevNfas(build_context &bc, RoseEngine &proto,
|
||||
u32 offset = bc.engine_blob.add(*nfa, nfa->length);
|
||||
DEBUG_PRINTF("wrote SOM rev NFA %zu (len %u) to offset %u\n",
|
||||
nfa_offsets.size(), nfa->length, offset);
|
||||
nfa_offsets.push_back(offset);
|
||||
nfa_offsets.emplace_back(offset);
|
||||
/* note: som rev nfas don't need a queue assigned as only run in block
|
||||
* mode reverse */
|
||||
}
|
||||
@@ -2428,7 +2428,7 @@ u32 writeActiveLeftIter(RoseEngineBlob &engine_blob,
|
||||
for (size_t i = 0; i < leftInfoTable.size(); i++) {
|
||||
if (!leftInfoTable[i].transient) {
|
||||
DEBUG_PRINTF("leftfix %zu is active\n", i);
|
||||
keys.push_back(verify_u32(i));
|
||||
keys.emplace_back(verify_u32(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2753,7 +2753,7 @@ RoseProgram makeFragmentProgram(const RoseBuildImpl &build, build_context &bc,
|
||||
for (const auto &lit_id : lit_ids) {
|
||||
auto prog = makeLiteralProgram(build, bc, prog_build, lit_id,
|
||||
lit_edge_map, false);
|
||||
blocks.push_back(move(prog));
|
||||
blocks.emplace_back(move(prog));
|
||||
}
|
||||
|
||||
return assembleProgramBlocks(move(blocks));
|
||||
@@ -2857,7 +2857,7 @@ vector<LitFragment> groupByFragment(const RoseBuildImpl &build) {
|
||||
DEBUG_PRINTF("fragment candidate: lit_id=%u %s\n", lit_id,
|
||||
dumpString(lit.s).c_str());
|
||||
auto &fi = frag_info[getFragment(lit)];
|
||||
fi.lit_ids.push_back(lit_id);
|
||||
fi.lit_ids.emplace_back(lit_id);
|
||||
fi.groups |= groups;
|
||||
}
|
||||
|
||||
@@ -2919,7 +2919,7 @@ void findInclusionGroups(vector<LitFragment> &fragments,
|
||||
u32 id = j;
|
||||
if (contains(includedIdMap, id) ||
|
||||
contains(includedDelayIdMap, id)) {
|
||||
candidates.push_back(j);
|
||||
candidates.emplace_back(j);
|
||||
DEBUG_PRINTF("find candidate\n");
|
||||
}
|
||||
}
|
||||
@@ -3101,7 +3101,7 @@ pair<u32, u32> writeDelayPrograms(const RoseBuildImpl &build,
|
||||
delay_id, offset);
|
||||
} else {
|
||||
delay_id = verify_u32(programs.size());
|
||||
programs.push_back(offset);
|
||||
programs.emplace_back(offset);
|
||||
cache.emplace(offset, delay_id);
|
||||
DEBUG_PRINTF("assigned new delay_id %u for offset %u\n",
|
||||
delay_id, offset);
|
||||
@@ -3162,7 +3162,7 @@ pair<u32, u32> writeAnchoredPrograms(const RoseBuildImpl &build,
|
||||
offset);
|
||||
} else {
|
||||
anch_id = verify_u32(programs.size());
|
||||
programs.push_back(offset);
|
||||
programs.emplace_back(offset);
|
||||
cache.emplace(offset, anch_id);
|
||||
DEBUG_PRINTF("assigned new anch_id %u for offset %u\n", anch_id,
|
||||
offset);
|
||||
@@ -3212,7 +3212,7 @@ pair<u32, u32> buildReportPrograms(const RoseBuildImpl &build,
|
||||
for (ReportID id : reports) {
|
||||
auto program = makeReportProgram(build, bc.needs_mpv_catchup, id);
|
||||
u32 offset = writeProgram(bc, move(program));
|
||||
programs.push_back(offset);
|
||||
programs.emplace_back(offset);
|
||||
build.rm.setProgramOffset(id, offset);
|
||||
DEBUG_PRINTF("program for report %u @ %u (%zu instructions)\n", id,
|
||||
programs.back(), program.size());
|
||||
@@ -3278,7 +3278,7 @@ void addEodAnchorProgram(const RoseBuildImpl &build, const build_context &bc,
|
||||
g[u].index);
|
||||
continue;
|
||||
}
|
||||
edge_list.push_back(e);
|
||||
edge_list.emplace_back(e);
|
||||
}
|
||||
|
||||
const bool multiple_preds = edge_list.size() > 1;
|
||||
@@ -3311,7 +3311,7 @@ void addEodEventProgram(const RoseBuildImpl &build, build_context &bc,
|
||||
vector<RoseEdge> edge_list;
|
||||
for (const auto &v : lit_info.vertices) {
|
||||
for (const auto &e : in_edges_range(v, g)) {
|
||||
edge_list.push_back(e);
|
||||
edge_list.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3478,7 +3478,7 @@ u32 writeEagerQueueIter(const set<u32> &eager, u32 leftfixBeginQueue,
|
||||
vector<u32> vec;
|
||||
for (u32 q : eager) {
|
||||
assert(q >= leftfixBeginQueue);
|
||||
vec.push_back(q - leftfixBeginQueue);
|
||||
vec.emplace_back(q - leftfixBeginQueue);
|
||||
}
|
||||
|
||||
auto iter = mmbBuildSparseIterator(vec, queue_count - leftfixBeginQueue);
|
||||
|
||||
@@ -130,7 +130,7 @@ vector<rose_literal_id> literals_for_vertex(const RoseBuildImpl &tbi,
|
||||
vector<rose_literal_id> rv;
|
||||
|
||||
for (const u32 id : tbi.g[v].literals) {
|
||||
rv.push_back(tbi.literals.at(id));
|
||||
rv.emplace_back(tbi.literals.at(id));
|
||||
}
|
||||
|
||||
return rv;
|
||||
@@ -227,7 +227,7 @@ void makeCastles(RoseBuildImpl &tbi) {
|
||||
if (g[v].left && !tbi.isRootSuccessor(v)) {
|
||||
makeCastle(g[v].left, left_cache);
|
||||
if (g[v].left.castle) {
|
||||
rev[g[v].left.castle.get()].push_back(v);
|
||||
rev[g[v].left.castle.get()].emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,11 +253,11 @@ bool unmakeCastles(RoseBuildImpl &tbi) {
|
||||
for (auto v : vertices_range(g)) {
|
||||
const LeftEngInfo &left = g[v].left;
|
||||
if (left.castle && left.castle->repeats.size() > 1) {
|
||||
left_castles[left].push_back(v);
|
||||
left_castles[left].emplace_back(v);
|
||||
}
|
||||
const RoseSuffixInfo &suffix = g[v].suffix;
|
||||
if (suffix.castle && suffix.castle->repeats.size() > 1) {
|
||||
suffix_castles[suffix].push_back(v);
|
||||
suffix_castles[suffix].emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,10 +303,10 @@ void remapCastleTops(RoseBuildImpl &tbi) {
|
||||
RoseGraph &g = tbi.g;
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (g[v].left.castle) {
|
||||
rose_castles[g[v].left.castle.get()].push_back(v);
|
||||
rose_castles[g[v].left.castle.get()].emplace_back(v);
|
||||
}
|
||||
if (g[v].suffix.castle) {
|
||||
suffix_castles[g[v].suffix.castle.get()].push_back(v);
|
||||
suffix_castles[g[v].suffix.castle.get()].emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,7 +194,7 @@ void RoseBuildImpl::handleMixedSensitivity(void) {
|
||||
limited_explosion(lit.s) && literal_info[id].delayed_ids.empty()) {
|
||||
DEBUG_PRINTF("need to explode existing string '%s'\n",
|
||||
dumpString(lit.s).c_str());
|
||||
explode.push_back(id);
|
||||
explode.emplace_back(id);
|
||||
} else {
|
||||
literal_info[id].requires_benefits = true;
|
||||
}
|
||||
@@ -734,9 +734,9 @@ void stealEodVertices(RoseBuildImpl &tbi) {
|
||||
|
||||
if (lit.table == ROSE_EOD_ANCHORED) {
|
||||
if (suitableForAnchored(tbi, lit, info)) {
|
||||
eodLiteralsForAnchored.push_back(i);
|
||||
eodLiteralsForAnchored.emplace_back(i);
|
||||
} else {
|
||||
eodLiteralsForFloating.push_back(i);
|
||||
eodLiteralsForFloating.emplace_back(i);
|
||||
}
|
||||
} else if (lit.table == ROSE_FLOATING) {
|
||||
numFloatingLiterals++;
|
||||
@@ -863,7 +863,7 @@ map<left_id, vector<RoseVertex>> findLeftSucc(const RoseBuildImpl &build) {
|
||||
for (auto v : vertices_range(build.g)) {
|
||||
if (build.g[v].left) {
|
||||
const LeftEngInfo &lei = build.g[v].left;
|
||||
leftfixes[lei].push_back(v);
|
||||
leftfixes[lei].emplace_back(v);
|
||||
}
|
||||
}
|
||||
return leftfixes;
|
||||
@@ -1046,7 +1046,7 @@ void packInfixTops(NGHolder &h, RoseGraph &g,
|
||||
h[e].tops = std::move(updated_tops);
|
||||
if (h[e].tops.empty()) {
|
||||
DEBUG_PRINTF("edge (start,%zu) has only unused tops\n", h[v].index);
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1481,7 +1481,7 @@ bool extractSEPLiterals(const raw_dfa &rdfa,
|
||||
if (!stateIsSEPLiteral(next, i, rdfa)) {
|
||||
return false;
|
||||
}
|
||||
lits[rdfa.states[next].reports].push_back(i);
|
||||
lits[rdfa.states[next].reports].emplace_back(i);
|
||||
}
|
||||
|
||||
// Map from symbols back to character reachability.
|
||||
@@ -1577,7 +1577,7 @@ void addAnchoredSmallBlockLiterals(RoseBuildImpl &tbi) {
|
||||
dumpString(sai.literal).c_str(), sai.min_bound);
|
||||
}
|
||||
|
||||
anchored_lits.push_back(make_pair(sai, lit_ids));
|
||||
anchored_lits.emplace_back(make_pair(sai, lit_ids));
|
||||
if (sai.literal.length() == 1) {
|
||||
oneByteLiterals++;
|
||||
}
|
||||
@@ -1588,7 +1588,7 @@ void addAnchoredSmallBlockLiterals(RoseBuildImpl &tbi) {
|
||||
map<ue2_literal, flat_set<ReportID>> sep_literals;
|
||||
for (OutfixInfo &oi : tbi.outfixes) {
|
||||
if (extractSEPLiterals(oi, tbi.rm, sep_literals)) {
|
||||
sep_outfixes.push_back(&oi);
|
||||
sep_outfixes.emplace_back(&oi);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1782,7 +1782,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
|
||||
|
||||
/* transfer mpv outfix to main queue */
|
||||
if (mpv_outfix) {
|
||||
outfixes.push_back(move(*mpv_outfix));
|
||||
outfixes.emplace_back(move(*mpv_outfix));
|
||||
mpv_outfix = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -413,7 +413,7 @@ bool handleStartPrefixCliche(const NGHolder &h, RoseGraph &g, RoseVertex v,
|
||||
} else {
|
||||
RoseEdge e_new = add_edge(ar, v, g);
|
||||
setEdgeBounds(g, e_new, bound_min, bound_max);
|
||||
to_delete->push_back(e_old);
|
||||
to_delete->emplace_back(e_old);
|
||||
}
|
||||
|
||||
g[v].left.reset(); /* clear the prefix info */
|
||||
@@ -605,7 +605,7 @@ bool handleMixedPrefixCliche(const NGHolder &h, RoseGraph &g, RoseVertex v,
|
||||
} else {
|
||||
RoseEdge e_new = add_edge(ar, v, g);
|
||||
setEdgeBounds(g, e_new, ri.repeatMin + width, ri.repeatMax + width);
|
||||
to_delete->push_back(e_old);
|
||||
to_delete->emplace_back(e_old);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -177,7 +177,7 @@ static
|
||||
vector<CharReach> makePath(const rose_literal_id &lit) {
|
||||
vector<CharReach> path(begin(lit.s), end(lit.s));
|
||||
for (u32 i = 0; i < lit.delay; i++) {
|
||||
path.push_back(CharReach::dot());
|
||||
path.emplace_back(CharReach::dot());
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ vector<u32> sparseIterValues(const mmbit_sparse_iter *it, u32 num_bits) {
|
||||
u32 idx = 0;
|
||||
u32 i = mmbit_sparse_iter_begin(b, num_bits, &idx, it, s);
|
||||
while (i != MMB_INVALID) {
|
||||
keys.push_back(i);
|
||||
keys.emplace_back(i);
|
||||
i = mmbit_sparse_iter_next(b, num_bits, i, &idx, it, s);
|
||||
}
|
||||
|
||||
@@ -1575,10 +1575,10 @@ void dumpRoseLitPrograms(const vector<LitFragment> &fragments,
|
||||
vector<u32> programs;
|
||||
for (const auto &frag : fragments) {
|
||||
if (frag.lit_program_offset) {
|
||||
programs.push_back(frag.lit_program_offset);
|
||||
programs.emplace_back(frag.lit_program_offset);
|
||||
}
|
||||
if (frag.delay_program_offset) {
|
||||
programs.push_back(frag.delay_program_offset);
|
||||
programs.emplace_back(frag.delay_program_offset);
|
||||
}
|
||||
}
|
||||
sort_and_unique(programs);
|
||||
|
||||
@@ -72,15 +72,15 @@ vector<RoleChunk<role_id>> divideIntoChunks(const RoseBuildImpl &build,
|
||||
for (const auto &roleInfo : roleInfoSet) {
|
||||
if (cnt == chunkSize) {
|
||||
cnt -= chunkSize;
|
||||
chunks.push_back(roleChunk);
|
||||
chunks.emplace_back(roleChunk);
|
||||
roleChunk.roles.clear();
|
||||
}
|
||||
roleChunk.roles.push_back(roleInfo);
|
||||
roleChunk.roles.emplace_back(roleInfo);
|
||||
cnt++;
|
||||
}
|
||||
|
||||
if (cnt > 1) {
|
||||
chunks.push_back(roleChunk);
|
||||
chunks.emplace_back(roleChunk);
|
||||
}
|
||||
|
||||
return chunks;
|
||||
@@ -106,14 +106,14 @@ bool addPrefixLiterals(NGHolder &h, unordered_set<u32> &tailId,
|
||||
NFAVertex u = add_vertex(h);
|
||||
h[u].char_reach = c;
|
||||
if (!i++) {
|
||||
heads.push_back(u);
|
||||
heads.emplace_back(u);
|
||||
last = u;
|
||||
continue;
|
||||
}
|
||||
add_edge(last, u, h);
|
||||
last = u;
|
||||
}
|
||||
tails.push_back(last);
|
||||
tails.emplace_back(last);
|
||||
tailId.insert(h[last].index);
|
||||
}
|
||||
|
||||
@@ -309,7 +309,7 @@ void findCliques(const map<u32, set<u32>> &exclusiveGroups,
|
||||
for (const auto &i : clique) {
|
||||
DEBUG_PRINTF("cliq:%zu\n", i.size());
|
||||
if (i.size() > 1) {
|
||||
exclusive_roles.push_back(i);
|
||||
exclusive_roles.emplace_back(i);
|
||||
}
|
||||
}
|
||||
DEBUG_PRINTF("Clique graph size:%zu\n", exclusive_roles.size());
|
||||
@@ -359,7 +359,7 @@ bool setTriggerLiterals(RoleInfo<role_id> &roleInfo,
|
||||
for (const auto &c : lit) {
|
||||
roleInfo.prefix_cr |= c;
|
||||
}
|
||||
roleInfo.literals.push_back(lit);
|
||||
roleInfo.literals.emplace_back(lit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ void assignGroupsToLiterals(RoseBuildImpl &build) {
|
||||
/* long literals will either be stuck in a mega group or spread around
|
||||
* depending on availability */
|
||||
if (superStrong(lit)) {
|
||||
long_lits.push_back(id);
|
||||
long_lits.emplace_back(id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ public:
|
||||
return {it->second, false};
|
||||
}
|
||||
u32 id = verify_u32(lits.size());
|
||||
lits.push_back(lit);
|
||||
lits.emplace_back(lit);
|
||||
lits_index.emplace(lit, id);
|
||||
return {id, true};
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ u32 findMaxLiteralMatches(const NGHolder &h, const set<ue2_literal> &lits) {
|
||||
}
|
||||
|
||||
contractVertex(g, v, all_edges);
|
||||
dead.push_back(v);
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
|
||||
remove_vertices(dead, g);
|
||||
|
||||
@@ -131,8 +131,8 @@ void RoseInstrCheckLookaround::write(void *dest, RoseEngineBlob &blob,
|
||||
vector<s8> look_offsets;
|
||||
vector<CharReach> reaches;
|
||||
for (const auto &le : look) {
|
||||
look_offsets.push_back(le.offset);
|
||||
reaches.push_back(le.reach);
|
||||
look_offsets.emplace_back(le.offset);
|
||||
reaches.emplace_back(le.reach);
|
||||
}
|
||||
inst->look_index = blob.lookaround_cache.get_offset_of(look_offsets, blob);
|
||||
inst->reach_index = blob.lookaround_cache.get_offset_of(reaches, blob);
|
||||
@@ -486,9 +486,9 @@ void RoseInstrSparseIterBegin::write(void *dest, RoseEngineBlob &blob,
|
||||
vector<u32> keys;
|
||||
vector<u32> jump_offsets;
|
||||
for (const auto &jump : jump_table) {
|
||||
keys.push_back(jump.first);
|
||||
keys.emplace_back(jump.first);
|
||||
assert(contains(offset_map, jump.second));
|
||||
jump_offsets.push_back(offset_map.at(jump.second));
|
||||
jump_offsets.emplace_back(offset_map.at(jump.second));
|
||||
}
|
||||
|
||||
auto iter = mmbBuildSparseIterator(keys, num_keys);
|
||||
@@ -589,11 +589,11 @@ void RoseInstrMultipathLookaround::write(void *dest, RoseEngineBlob &blob,
|
||||
bool done_offset = false;
|
||||
|
||||
for (const auto &le : vle) {
|
||||
reaches.back().push_back(le.reach);
|
||||
reaches.back().emplace_back(le.reach);
|
||||
|
||||
/* empty reaches don't have valid offsets */
|
||||
if (!done_offset && le.reach.any()) {
|
||||
look_offsets.push_back(le.offset);
|
||||
look_offsets.emplace_back(le.offset);
|
||||
done_offset = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ void filterLits(const vector<AccelString> &lits, hwlm_group_t expected_groups,
|
||||
DEBUG_PRINTF("lit: '%s', nocase=%d, groups=0x%llx\n",
|
||||
escapeString(lit.s).c_str(), lit.nocase ? 1 : 0,
|
||||
lit.groups);
|
||||
filtered_lits->push_back(&lit);
|
||||
filtered_lits->emplace_back(&lit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -279,13 +279,13 @@ void findForwardReach(const RoseGraph &g, const RoseVertex v,
|
||||
DEBUG_PRINTF("successor %zu has no leftfix\n", g[t].index);
|
||||
return;
|
||||
}
|
||||
rose_look.push_back(map<s32, CharReach>());
|
||||
rose_look.emplace_back(map<s32, CharReach>());
|
||||
getRoseForwardReach(g[t].left, g[e].rose_top, rose_look.back());
|
||||
}
|
||||
|
||||
if (g[v].suffix) {
|
||||
DEBUG_PRINTF("suffix engine\n");
|
||||
rose_look.push_back(map<s32, CharReach>());
|
||||
rose_look.emplace_back(map<s32, CharReach>());
|
||||
getSuffixForwardReach(g[v].suffix, g[v].suffix.top, rose_look.back());
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ void normalise(map<s32, CharReach> &look) {
|
||||
vector<s32> dead;
|
||||
for (const auto &m : look) {
|
||||
if (m.second.all()) {
|
||||
dead.push_back(m.first);
|
||||
dead.emplace_back(m.first);
|
||||
}
|
||||
}
|
||||
erase_all(&look, dead);
|
||||
@@ -569,7 +569,7 @@ void normaliseLeftfix(map<s32, CharReach> &look) {
|
||||
vector<s32> dead;
|
||||
for (const auto &m : look) {
|
||||
if (m.second.all() && m.first != earliest) {
|
||||
dead.push_back(m.first);
|
||||
dead.emplace_back(m.first);
|
||||
}
|
||||
}
|
||||
erase_all(&look, dead);
|
||||
@@ -617,7 +617,7 @@ void transToLookaround(const vector<map<s32, CharReach>> &looks,
|
||||
s8 offset = verify_s8(m.first);
|
||||
lookaround.emplace_back(offset, m.second);
|
||||
}
|
||||
lookarounds.push_back(lookaround);
|
||||
lookarounds.emplace_back(lookaround);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,7 +711,7 @@ bool getTransientPrefixReach(const NGHolder &g, ReportID report, u32 lag,
|
||||
return true;
|
||||
}
|
||||
if (contains(g[v].reports, report)) {
|
||||
curr.push_back(v);
|
||||
curr.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -765,8 +765,8 @@ bool getTransientPrefixReach(const NGHolder &g, ReportID report, u32 lag,
|
||||
looks[idx][0 - i] = g[u].char_reach;
|
||||
total_len++;
|
||||
} else {
|
||||
curr.push_back(u);
|
||||
looks.push_back(looks[idx]);
|
||||
curr.emplace_back(u);
|
||||
looks.emplace_back(looks[idx]);
|
||||
(looks.back())[0 - i] = g[u].char_reach;
|
||||
total_len += looks.back().size();
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ void findMoreLiteralMasks(RoseBuildImpl &build) {
|
||||
continue;
|
||||
}
|
||||
|
||||
candidates.push_back(id);
|
||||
candidates.emplace_back(id);
|
||||
}
|
||||
|
||||
for (const u32 &id : candidates) {
|
||||
@@ -827,7 +827,7 @@ MatcherProto makeMatcherProto(const RoseBuildImpl &build,
|
||||
}
|
||||
}
|
||||
|
||||
used_lit_ids.push_back(id);
|
||||
used_lit_ids.emplace_back(id);
|
||||
}
|
||||
|
||||
if (used_lit_ids.empty()) {
|
||||
|
||||
@@ -239,7 +239,7 @@ bool dedupeLeftfixes(RoseBuildImpl &tbi) {
|
||||
continue;
|
||||
}
|
||||
|
||||
roses[RoseGroup(tbi, v)].push_back(v);
|
||||
roses[RoseGroup(tbi, v)].emplace_back(v);
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("collected %zu rose groups\n", roses.size());
|
||||
@@ -338,7 +338,7 @@ void dedupeSuffixes(RoseBuildImpl &tbi) {
|
||||
|
||||
set<RoseVertex> &verts = suffix_map[s];
|
||||
if (verts.empty()) {
|
||||
part[make_pair(suffix_size_key(s), all_reports(s))].push_back(s);
|
||||
part[make_pair(suffix_size_key(s), all_reports(s))].emplace_back(s);
|
||||
}
|
||||
verts.insert(v);
|
||||
}
|
||||
@@ -393,17 +393,17 @@ public:
|
||||
void insert(const EngineRef &h, RoseVertex v) {
|
||||
typename BouquetMap::iterator f = bouquet.find(h);
|
||||
if (f == bouquet.end()) {
|
||||
ordering.push_back(h);
|
||||
bouquet[h].push_back(v);
|
||||
ordering.emplace_back(h);
|
||||
bouquet[h].emplace_back(v);
|
||||
} else {
|
||||
f->second.push_back(v);
|
||||
f->second.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
void insert(const EngineRef &h, const deque<RoseVertex> &verts) {
|
||||
typename BouquetMap::iterator f = bouquet.find(h);
|
||||
if (f == bouquet.end()) {
|
||||
ordering.push_back(h);
|
||||
ordering.emplace_back(h);
|
||||
bouquet.insert(make_pair(h, verts));
|
||||
} else {
|
||||
f->second.insert(f->second.end(), verts.begin(), verts.end());
|
||||
@@ -472,14 +472,14 @@ static void chunkBouquets(const Bouquet<EngineRef> &in,
|
||||
deque<Bouquet<EngineRef>> &out,
|
||||
const size_t chunk_size) {
|
||||
if (in.size() <= chunk_size) {
|
||||
out.push_back(in);
|
||||
out.emplace_back(in);
|
||||
return;
|
||||
}
|
||||
|
||||
out.push_back(Bouquet<EngineRef>());
|
||||
out.emplace_back(Bouquet<EngineRef>());
|
||||
for (const auto &engine : in) {
|
||||
if (out.back().size() >= chunk_size) {
|
||||
out.push_back(Bouquet<EngineRef>());
|
||||
out.emplace_back(Bouquet<EngineRef>());
|
||||
}
|
||||
out.back().insert(engine, in.vertices(engine));
|
||||
}
|
||||
@@ -820,7 +820,7 @@ bool checkPredDelays(const RoseBuildImpl &build, const VertexCont &v1,
|
||||
vector<const rose_literal_id *> pred_rose_lits;
|
||||
pred_rose_lits.reserve(pred_lits.size());
|
||||
for (const auto &p : pred_lits) {
|
||||
pred_rose_lits.push_back(&build.literals.at(p));
|
||||
pred_rose_lits.emplace_back(&build.literals.at(p));
|
||||
}
|
||||
|
||||
for (auto v : v2) {
|
||||
@@ -1322,18 +1322,18 @@ template <typename T>
|
||||
static
|
||||
void chunk(vector<T> in, vector<vector<T>> *out, size_t chunk_size) {
|
||||
if (in.size() <= chunk_size) {
|
||||
out->push_back(std::move(in));
|
||||
out->emplace_back(std::move(in));
|
||||
return;
|
||||
}
|
||||
|
||||
out->push_back(vector<T>());
|
||||
out->emplace_back(vector<T>());
|
||||
out->back().reserve(chunk_size);
|
||||
for (const auto &t : in) {
|
||||
if (out->back().size() >= chunk_size) {
|
||||
out->push_back(vector<T>());
|
||||
out->emplace_back(vector<T>());
|
||||
out->back().reserve(chunk_size);
|
||||
}
|
||||
out->back().push_back(std::move(t));
|
||||
out->back().emplace_back(std::move(t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1346,7 +1346,7 @@ insertion_ordered_map<left_id, vector<RoseVertex>> get_eng_verts(RoseGraph &g) {
|
||||
continue;
|
||||
}
|
||||
assert(contains(all_reports(left), left.leftfix_report));
|
||||
eng_verts[left].push_back(v);
|
||||
eng_verts[left].emplace_back(v);
|
||||
}
|
||||
|
||||
return eng_verts;
|
||||
@@ -1438,7 +1438,7 @@ void mergeLeftfixesVariableLag(RoseBuildImpl &build) {
|
||||
assert(!parents.empty());
|
||||
|
||||
#ifndef _WIN32
|
||||
engine_groups[MergeKey(left, parents)].push_back(left);
|
||||
engine_groups[MergeKey(left, parents)].emplace_back(left);
|
||||
#else
|
||||
// On windows, when passing MergeKey object into map 'engine_groups',
|
||||
// it will not be copied, but will be freed along with
|
||||
@@ -1448,7 +1448,7 @@ void mergeLeftfixesVariableLag(RoseBuildImpl &build) {
|
||||
// will cause is_block_type_valid() assertion error in MergeKey
|
||||
// destructor.
|
||||
MergeKey *mk = new MergeKey(left, parents);
|
||||
engine_groups[*mk].push_back(left);
|
||||
engine_groups[*mk].emplace_back(left);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1611,7 +1611,7 @@ void dedupeLeftfixesVariableLag(RoseBuildImpl &build) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
engine_groups[DedupeLeftKey(build, move(preds), left)].push_back(left);
|
||||
engine_groups[DedupeLeftKey(build, move(preds), left)].emplace_back(left);
|
||||
}
|
||||
|
||||
/* We don't bother chunking as we expect deduping to be successful if the
|
||||
@@ -1871,7 +1871,7 @@ void mergeNfaLeftfixes(RoseBuildImpl &tbi, LeftfixBouquet &roses) {
|
||||
}
|
||||
roses.insert(r1, verts2);
|
||||
|
||||
merged.push_back(r2);
|
||||
merged.emplace_back(r2);
|
||||
|
||||
if (num_vertices(*winner) >= small_merge_max_vertices(tbi.cc)) {
|
||||
DEBUG_PRINTF("h1 now has %zu vertices, proceeding to next\n",
|
||||
@@ -2050,12 +2050,12 @@ void mergeCastleLeftfixes(RoseBuildImpl &build) {
|
||||
continue;
|
||||
}
|
||||
|
||||
eng_verts[g[v].left].push_back(v);
|
||||
eng_verts[g[v].left].emplace_back(v);
|
||||
}
|
||||
|
||||
map<CharReach, vector<left_id>> by_reach;
|
||||
for (const auto &left : eng_verts | map_keys) {
|
||||
by_reach[left.castle()->reach()].push_back(left);
|
||||
by_reach[left.castle()->reach()].emplace_back(left);
|
||||
}
|
||||
|
||||
vector<vector<left_id>> chunks;
|
||||
@@ -2151,7 +2151,7 @@ void mergeSuffixes(RoseBuildImpl &tbi, SuffixBouquet &suffixes,
|
||||
g[v].suffix.graph = winner;
|
||||
}
|
||||
suffixes.insert(s1, verts2);
|
||||
merged.push_back(s2);
|
||||
merged.emplace_back(s2);
|
||||
|
||||
if (num_vertices(*s1.graph()) >= small_merge_max_vertices(tbi.cc)) {
|
||||
DEBUG_PRINTF("h1 now has %zu vertices, proceeding to next\n",
|
||||
@@ -2324,7 +2324,7 @@ map<NGHolder *, NGHolder *> chunkedNfaMerge(RoseBuildImpl &build,
|
||||
|
||||
vector<NGHolder *> batch;
|
||||
for (auto it = begin(nfas), ite = end(nfas); it != ite; ++it) {
|
||||
batch.push_back(*it);
|
||||
batch.emplace_back(*it);
|
||||
assert((*it)->kind == NFA_OUTFIX);
|
||||
if (batch.size() == MERGE_GROUP_SIZE_MAX || next(it) == ite) {
|
||||
auto batch_merged = mergeNfaCluster(batch, &build.rm, build.cc);
|
||||
@@ -2463,7 +2463,7 @@ void chunkedDfaMerge(vector<RawDfa *> &dfas,
|
||||
vector<RawDfa *> out_dfas;
|
||||
vector<RawDfa *> chunk;
|
||||
for (auto it = begin(dfas), ite = end(dfas); it != ite; ++it) {
|
||||
chunk.push_back(*it);
|
||||
chunk.emplace_back(*it);
|
||||
if (chunk.size() >= DFA_CHUNK_SIZE_MAX || next(it) == ite) {
|
||||
pairwiseDfaMerge(chunk, dfa_mapping, outfixes, merge_func);
|
||||
out_dfas.insert(end(out_dfas), begin(chunk), end(chunk));
|
||||
@@ -2542,7 +2542,7 @@ void mergeOutfixCombo(RoseBuildImpl &tbi, const ReportManager &rm,
|
||||
|
||||
if (outfix.rdfa()) {
|
||||
auto *rdfa = outfix.rdfa();
|
||||
dfas.push_back(rdfa);
|
||||
dfas.emplace_back(rdfa);
|
||||
dfa_mapping[rdfa] = it - tbi.outfixes.begin();
|
||||
continue;
|
||||
}
|
||||
@@ -2557,7 +2557,7 @@ void mergeOutfixCombo(RoseBuildImpl &tbi, const ReportManager &rm,
|
||||
if (rdfa) {
|
||||
// Transform this outfix into a DFA and add it to the merge set.
|
||||
dfa_mapping[rdfa.get()] = it - tbi.outfixes.begin();
|
||||
dfas.push_back(rdfa.get());
|
||||
dfas.emplace_back(rdfa.get());
|
||||
outfix.proto = move(rdfa);
|
||||
new_dfas++;
|
||||
}
|
||||
@@ -2615,11 +2615,11 @@ void mergeOutfixes(RoseBuildImpl &tbi) {
|
||||
|
||||
for (auto &outfix : tbi.outfixes) {
|
||||
if (outfix.rdfa()) {
|
||||
dfas.push_back(outfix.rdfa());
|
||||
dfas.emplace_back(outfix.rdfa());
|
||||
} else if (outfix.holder()) {
|
||||
nfas.push_back(outfix.holder());
|
||||
nfas.emplace_back(outfix.holder());
|
||||
} else if (outfix.haig()) {
|
||||
som_dfas.push_back(outfix.haig());
|
||||
som_dfas.emplace_back(outfix.haig());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2805,9 +2805,9 @@ void mergeCastleSuffixes(RoseBuildImpl &build) {
|
||||
}
|
||||
|
||||
if (!contains(eng_verts, c)) {
|
||||
by_reach[c->reach()].push_back(c);
|
||||
by_reach[c->reach()].emplace_back(c);
|
||||
}
|
||||
eng_verts[c].push_back(v);
|
||||
eng_verts[c].emplace_back(v);
|
||||
}
|
||||
|
||||
for (auto &chunk : by_reach | map_values) {
|
||||
|
||||
@@ -375,7 +375,7 @@ u32 RoseBuildImpl::getLiteralId(const ue2_literal &s, u32 delay,
|
||||
bool inserted = m.second;
|
||||
|
||||
if (inserted) {
|
||||
literal_info.push_back(rose_literal_info());
|
||||
literal_info.emplace_back(rose_literal_info());
|
||||
assert(literal_info.size() == id + 1);
|
||||
|
||||
if (delay) {
|
||||
@@ -465,7 +465,7 @@ u32 RoseBuildImpl::getLiteralId(const ue2_literal &s, const vector<u8> &msk,
|
||||
bool inserted = m.second;
|
||||
|
||||
if (inserted) {
|
||||
literal_info.push_back(rose_literal_info());
|
||||
literal_info.emplace_back(rose_literal_info());
|
||||
assert(literal_info.size() == id + 1);
|
||||
|
||||
if (delay) {
|
||||
@@ -488,7 +488,7 @@ u32 RoseBuildImpl::getNewLiteralId() {
|
||||
assert(m.second);
|
||||
u32 id = m.first;
|
||||
|
||||
literal_info.push_back(rose_literal_info());
|
||||
literal_info.emplace_back(rose_literal_info());
|
||||
assert(literal_info.size() == id + 1);
|
||||
|
||||
literal_info[id].undelayed_id = id;
|
||||
|
||||
@@ -95,7 +95,7 @@ OffsetMap makeOffsetMap(const RoseProgram &program, u32 *total_len) {
|
||||
}
|
||||
|
||||
RoseProgram::RoseProgram() {
|
||||
prog.push_back(make_unique<RoseInstrEnd>());
|
||||
prog.emplace_back(make_unique<RoseInstrEnd>());
|
||||
}
|
||||
|
||||
RoseProgram::~RoseProgram() = default;
|
||||
@@ -1142,7 +1142,7 @@ void getAllBuckets(const vector<LookEntry> &look,
|
||||
}
|
||||
for (const auto &it : lo2hi) {
|
||||
u32 hi_lo = (it.second << 16) | it.first;
|
||||
buckets[hi_lo].push_back(entry.offset);
|
||||
buckets[hi_lo].emplace_back(entry.offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2195,7 +2195,7 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
|
||||
continue;
|
||||
}
|
||||
|
||||
blocks.push_back(move(block));
|
||||
blocks.emplace_back(move(block));
|
||||
seen.emplace(blocks.back());
|
||||
}
|
||||
|
||||
@@ -2322,7 +2322,7 @@ RoseProgram makeDelayRebuildProgram(const RoseBuildImpl &build,
|
||||
makePushDelayedInstructions(build.literals, prog_build,
|
||||
build.literal_info.at(lit_id).delayed_ids,
|
||||
prog);
|
||||
blocks.push_back(move(prog));
|
||||
blocks.emplace_back(move(prog));
|
||||
}
|
||||
|
||||
return assembleProgramBlocks(move(blocks));
|
||||
@@ -2424,7 +2424,7 @@ void addPredBlocksAny(map<u32, RoseProgram> &pred_blocks, u32 num_states,
|
||||
|
||||
vector<u32> keys;
|
||||
for (const u32 &key : pred_blocks | map_keys) {
|
||||
keys.push_back(key);
|
||||
keys.emplace_back(key);
|
||||
}
|
||||
|
||||
const RoseInstruction *end_inst = sparse_program.end_instruction();
|
||||
|
||||
@@ -846,7 +846,7 @@ void pruneUnusedTops(NGHolder &h, const RoseGraph &g,
|
||||
h[e].tops = std::move(pruned_tops);
|
||||
if (h[e].tops.empty()) {
|
||||
DEBUG_PRINTF("edge (start,%zu) has only unused tops\n", h[v].index);
|
||||
dead.push_back(e);
|
||||
dead.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,7 +1457,7 @@ void splitAndFilterBuckets(vector<vector<RoseVertex>> &buckets,
|
||||
out.emplace_back();
|
||||
}
|
||||
auto out_bucket = p.first->second;
|
||||
out[out_bucket].push_back(v);
|
||||
out[out_bucket].emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1511,7 +1511,7 @@ void splitByNeighbour(const RoseGraph &g, vector<vector<RoseVertex>> &buckets,
|
||||
for (RoseVertex v : adjacent_vertices_range(u, g)) {
|
||||
auto it = inv.find(v);
|
||||
if (it != end(inv)) {
|
||||
neighbours_by_bucket[it->second].push_back(v);
|
||||
neighbours_by_bucket[it->second].emplace_back(v);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1519,7 +1519,7 @@ void splitByNeighbour(const RoseGraph &g, vector<vector<RoseVertex>> &buckets,
|
||||
for (RoseVertex v : inv_adjacent_vertices_range(u, g)) {
|
||||
auto it = inv.find(v);
|
||||
if (it != end(inv)) {
|
||||
neighbours_by_bucket[it->second].push_back(v);
|
||||
neighbours_by_bucket[it->second].emplace_back(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1540,14 +1540,14 @@ void splitByNeighbour(const RoseGraph &g, vector<vector<RoseVertex>> &buckets,
|
||||
if (contains(picked, v)) {
|
||||
inv[v] = new_key;
|
||||
} else {
|
||||
leftovers.push_back(v);
|
||||
leftovers.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
assert(!leftovers.empty());
|
||||
assert(e.second.size() + leftovers.size()
|
||||
== buckets[old_key].size());
|
||||
extras.push_back(e.second);
|
||||
extras.emplace_back(e.second);
|
||||
buckets[old_key].swap(leftovers);
|
||||
}
|
||||
insert(&buckets, buckets.end(), extras);
|
||||
@@ -1650,7 +1650,7 @@ void diamondMergePass(CandidateSet &candidates, RoseBuildImpl &build,
|
||||
}
|
||||
|
||||
mergeVerticesDiamond(a, b, build, rai);
|
||||
dead->push_back(a);
|
||||
dead->emplace_back(a);
|
||||
candidates.erase(a);
|
||||
break; // next a
|
||||
}
|
||||
@@ -1758,7 +1758,7 @@ void leftMergePass(CandidateSet &candidates, RoseBuildImpl &build,
|
||||
RoseVertex b = *jt;
|
||||
if (attemptRoseMerge(build, true, a, b, false, rai)) {
|
||||
mergeVerticesLeft(a, b, build, rai);
|
||||
dead->push_back(a);
|
||||
dead->emplace_back(a);
|
||||
candidates.erase(ait);
|
||||
break; // consider next a
|
||||
}
|
||||
@@ -1918,7 +1918,7 @@ void rightMergePass(CandidateSet &candidates, RoseBuildImpl &build,
|
||||
RoseVertex b = *jt;
|
||||
if (attemptRoseMerge(build, false, a, b, !mergeRoses, rai)) {
|
||||
mergeVerticesRight(a, b, build, rai);
|
||||
dead->push_back(a);
|
||||
dead->emplace_back(a);
|
||||
candidates.erase(a);
|
||||
break; // consider next a
|
||||
}
|
||||
@@ -1978,7 +1978,7 @@ void filterDiamondCandidates(RoseGraph &g, CandidateSet &candidates) {
|
||||
vector<RoseVertex> dead;
|
||||
for (const auto &v : candidates) {
|
||||
if (hasNoDiamondSiblings(g, v)) {
|
||||
dead.push_back(v);
|
||||
dead.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2145,13 +2145,13 @@ void mergeDupeLeaves(RoseBuildImpl &build) {
|
||||
if (g[et].minBound <= g[e].minBound
|
||||
&& g[et].maxBound >= g[e].maxBound) {
|
||||
DEBUG_PRINTF("remove more constrained edge\n");
|
||||
deadEdges.push_back(e);
|
||||
deadEdges.emplace_back(e);
|
||||
}
|
||||
} else {
|
||||
DEBUG_PRINTF("rehome edge: add %zu->%zu\n", g[u].index,
|
||||
g[t].index);
|
||||
add_edge(u, t, g[e], g);
|
||||
deadEdges.push_back(e);
|
||||
deadEdges.emplace_back(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2159,7 +2159,7 @@ void mergeDupeLeaves(RoseBuildImpl &build) {
|
||||
for (auto &e : deadEdges) {
|
||||
remove_edge(e, g);
|
||||
}
|
||||
changed.push_back(v);
|
||||
changed.emplace_back(v);
|
||||
g[t].min_offset = min(g[t].min_offset, g[v].min_offset);
|
||||
g[t].max_offset = max(g[t].max_offset, g[v].max_offset);
|
||||
}
|
||||
@@ -2212,7 +2212,7 @@ void mergeCluster(RoseGraph &g, const ReportManager &rm,
|
||||
NGHolder *h = g[v].suffix.graph.get();
|
||||
assert(!g[v].suffix.haig); /* should not be here if haig */
|
||||
rev[h] = v;
|
||||
cluster.push_back(h);
|
||||
cluster.emplace_back(h);
|
||||
}
|
||||
it = it2;
|
||||
|
||||
@@ -2230,7 +2230,7 @@ void mergeCluster(RoseGraph &g, const ReportManager &rm,
|
||||
ENSURE_AT_LEAST(&g[winner].max_offset, g[victim].max_offset);
|
||||
insert(&g[winner].reports, g[victim].reports);
|
||||
|
||||
dead.push_back(victim);
|
||||
dead.emplace_back(victim);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2263,7 +2263,7 @@ void findUncalcLeavesCandidates(RoseBuildImpl &build,
|
||||
continue;
|
||||
}
|
||||
|
||||
suffix_vertices.push_back(v);
|
||||
suffix_vertices.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2289,9 +2289,9 @@ void findUncalcLeavesCandidates(RoseBuildImpl &build,
|
||||
vector<RoseVertex> &vec = clusters[key];
|
||||
if (vec.empty()) {
|
||||
|
||||
ordered.push_back(key);
|
||||
ordered.emplace_back(key);
|
||||
}
|
||||
vec.push_back(v);
|
||||
vec.emplace_back(v);
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("find loop done\n");
|
||||
|
||||
@@ -67,7 +67,7 @@ u32 findMinWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
|
||||
|
||||
for (auto v : vertices_range(g)) {
|
||||
if (tbi.hasLiteralInTable(v, table)) {
|
||||
table_verts.push_back(v);
|
||||
table_verts.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ u32 findMaxBAWidth(const RoseBuildImpl &tbi, enum rose_literal_table table) {
|
||||
for (auto v : vertices_range(g)) {
|
||||
if ((table == ROSE_FLOATING && tbi.isFloating(v))
|
||||
|| (table == ROSE_ANCHORED && tbi.isAnchored(v))) {
|
||||
table_verts.push_back(v);
|
||||
table_verts.emplace_back(v);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user