use STL make_unique, remove wrapper header, breaks C++17 compilation

This commit is contained in:
Konstantinos Margaritis
2021-07-23 11:54:53 +03:00
parent f5f37f3f40
commit e35b88f2c8
62 changed files with 210 additions and 316 deletions

View File

@@ -56,7 +56,6 @@
#include "util/dump_charclass.h"
#include "util/graph_range.h"
#include "util/insertion_ordered.h"
#include "util/make_unique.h"
#include "util/noncopyable.h"
#include "util/order_check.h"
#include "util/report_manager.h"
@@ -1794,7 +1793,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.emplace_back(OutfixInfo(ue2::make_unique<raw_som_dfa>(haig)));
outfixes.emplace_back(OutfixInfo(std::make_unique<raw_som_dfa>(haig)));
populateOutfixInfo(outfixes.back(), h, *this);
return true; /* failure is not yet an option */
@@ -1802,7 +1801,7 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h, const raw_som_dfa &haig) {
bool RoseBuildImpl::addOutfix(const raw_puff &rp) {
if (!mpv_outfix) {
mpv_outfix = make_unique<OutfixInfo>(MpvProto());
mpv_outfix = std::make_unique<OutfixInfo>(MpvProto());
}
auto *mpv = mpv_outfix->mpv();
@@ -1827,7 +1826,7 @@ bool RoseBuildImpl::addOutfix(const raw_puff &rp) {
bool RoseBuildImpl::addChainTail(const raw_puff &rp, u32 *queue_out,
u32 *event_out) {
if (!mpv_outfix) {
mpv_outfix = make_unique<OutfixInfo>(MpvProto());
mpv_outfix = std::make_unique<OutfixInfo>(MpvProto());
}
auto *mpv = mpv_outfix->mpv();

View File

@@ -48,7 +48,6 @@
#include "util/container.h"
#include "util/dump_charclass.h"
#include "util/graph.h"
#include "util/make_unique.h"
#include "util/ue2string.h"
#include "util/verify_types.h"
@@ -300,7 +299,7 @@ unique_ptr<NGHolder> buildMaskLhs(bool anchored, u32 prefix_len,
DEBUG_PRINTF("build %slhs len %u/%zu\n", anchored ? "anc " : "", prefix_len,
mask.size());
unique_ptr<NGHolder> lhs = ue2::make_unique<NGHolder>(NFA_PREFIX);
unique_ptr<NGHolder> lhs = std::make_unique<NGHolder>(NFA_PREFIX);
assert(prefix_len);
assert(mask.size() >= prefix_len);
@@ -568,7 +567,7 @@ unique_ptr<NGHolder> buildMaskRhs(const flat_set<ReportID> &reports,
assert(suffix_len);
assert(mask.size() > suffix_len);
unique_ptr<NGHolder> rhs = ue2::make_unique<NGHolder>(NFA_SUFFIX);
unique_ptr<NGHolder> rhs = std::make_unique<NGHolder>(NFA_SUFFIX);
NGHolder &h = *rhs;
NFAVertex succ = h.accept;
@@ -751,7 +750,7 @@ static
unique_ptr<NGHolder> makeAnchoredGraph(const vector<CharReach> &mask,
const flat_set<ReportID> &reports,
bool eod) {
auto gp = ue2::make_unique<NGHolder>();
auto gp = std::make_unique<NGHolder>();
NGHolder &g = *gp;
NFAVertex u = g.start;

View File

@@ -51,7 +51,6 @@
#include "util/determinise.h"
#include "util/flat_containers.h"
#include "util/graph_range.h"
#include "util/make_unique.h"
#include "util/order_check.h"
#include "util/ue2string.h"
#include "util/unordered.h"
@@ -699,7 +698,7 @@ int addAutomaton(RoseBuildImpl &build, const NGHolder &h, ReportID *remap) {
Automaton_Holder autom(h);
auto out_dfa = ue2::make_unique<raw_dfa>(NFA_OUTFIX_RAW);
auto out_dfa = std::make_unique<raw_dfa>(NFA_OUTFIX_RAW);
if (determinise(autom, out_dfa->states, MAX_DFA_STATES)) {
return finalise_out(build, h, autom, move(out_dfa), remap);
}
@@ -761,7 +760,7 @@ void buildSimpleDfas(const RoseBuildImpl &build, const vector<u32> &frag_map,
}
auto h = populate_holder(simple.first, exit_ids);
Automaton_Holder autom(*h);
auto rdfa = ue2::make_unique<raw_dfa>(NFA_OUTFIX_RAW);
auto rdfa = std::make_unique<raw_dfa>(NFA_OUTFIX_RAW);
UNUSED bool rv = determinise(autom, rdfa->states, MAX_DFA_STATES);
assert(rv);
rdfa->start_anchored = INIT_STATE;

View File

@@ -87,7 +87,6 @@
#include "util/fatbit_build.h"
#include "util/graph_range.h"
#include "util/insertion_ordered.h"
#include "util/make_unique.h"
#include "util/multibit_build.h"
#include "util/noncopyable.h"
#include "util/order_check.h"
@@ -1203,7 +1202,7 @@ static
unique_ptr<TamaInfo> constructTamaInfo(const RoseGraph &g,
const vector<ExclusiveSubengine> &subengines,
const bool is_suffix) {
unique_ptr<TamaInfo> tamaInfo = ue2::make_unique<TamaInfo>();
unique_ptr<TamaInfo> tamaInfo = std::make_unique<TamaInfo>();
for (const auto &sub : subengines) {
const auto &rose_vertices = sub.vertices;
NFA *nfa = sub.nfa.get();

View File

@@ -49,7 +49,6 @@
#include "util/compile_context.h"
#include "util/depth.h"
#include "util/graph_range.h"
#include "util/make_unique.h"
#include "util/order_check.h"
#include "util/ue2string.h"
@@ -95,7 +94,7 @@ unique_ptr<NGHolder> makeFloodProneSuffix(const ue2_literal &s, size_t len,
assert(len < s.length());
assert(!reports.empty());
unique_ptr<NGHolder> h = ue2::make_unique<NGHolder>(NFA_SUFFIX);
unique_ptr<NGHolder> h = std::make_unique<NGHolder>(NFA_SUFFIX);
NFAVertex u = h->start;
for (auto it = s.begin() + s.length() - len; it != s.end(); ++it) {
@@ -114,7 +113,7 @@ unique_ptr<NGHolder> makeFloodProneSuffix(const ue2_literal &s, size_t len,
static
unique_ptr<NGHolder> makeRosePrefix(const ue2_literal &s) {
unique_ptr<NGHolder> h = ue2::make_unique<NGHolder>(NFA_PREFIX);
unique_ptr<NGHolder> h = std::make_unique<NGHolder>(NFA_PREFIX);
NFAVertex u = h->startDs;
for (const auto &c : s) {

View File

@@ -32,7 +32,6 @@
#include "smallwrite/smallwrite_build.h"
#include "util/compile_context.h"
#include "util/boundary_reports.h"
#include "util/make_unique.h"
#include "util/report_manager.h"
using namespace std;
@@ -100,7 +99,7 @@ private:
};
unique_ptr<RoseDedupeAux> RoseBuildImpl::generateDedupeAux() const {
return ue2::make_unique<RoseDedupeAuxImpl>(*this);
return std::make_unique<RoseDedupeAuxImpl>(*this);
}
RoseDedupeAux::~RoseDedupeAux() = default;

View File

@@ -39,7 +39,6 @@
#include "util/container.h"
#include "util/flat_containers.h"
#include "util/graph.h"
#include "util/make_unique.h"
using namespace std;
@@ -280,7 +279,7 @@ void findCliques(const map<u32, set<u32>> &exclusiveGroups,
}
// Construct the exclusivity graph
map<u32, CliqueVertex> vertex_map;
unique_ptr<CliqueGraph> cg = make_unique<CliqueGraph>();
unique_ptr<CliqueGraph> cg = std::make_unique<CliqueGraph>();
// Add vertices representing infixes/suffixes
for (const auto &e : exclusiveGroups) {

View File

@@ -46,7 +46,6 @@
#include "util/compile_context.h"
#include "util/compile_error.h"
#include "util/dump_charclass.h"
#include "util/make_unique.h"
#include "util/report.h"
#include "util/report_manager.h"
#include "util/verify_types.h"
@@ -937,7 +936,7 @@ buildFloatingMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto.");
}
return ue2::make_unique<LitProto>(move(proto), mp.accel_lits);
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
}
unique_ptr<LitProto>
@@ -965,7 +964,7 @@ buildDelayRebuildMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto.");
}
return ue2::make_unique<LitProto>(move(proto), mp.accel_lits);
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
}
unique_ptr<LitProto>
@@ -1022,7 +1021,7 @@ buildSmallBlockMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto.");
}
return ue2::make_unique<LitProto>(move(proto), mp.accel_lits);
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
}
unique_ptr<LitProto>
@@ -1047,7 +1046,7 @@ buildEodAnchoredMatcherProto(const RoseBuildImpl &build,
throw CompileError("Unable to generate literal matcher proto.");
}
return ue2::make_unique<LitProto>(move(proto), mp.accel_lits);
return std::make_unique<LitProto>(move(proto), mp.accel_lits);
}
} // namespace ue2

View File

@@ -50,7 +50,6 @@
#include "util/container.h"
#include "util/graph.h"
#include "util/graph_range.h"
#include "util/make_unique.h"
#include "util/order_check.h"
#include "util/report_manager.h"
#include "util/ue2string.h"
@@ -234,7 +233,7 @@ unique_ptr<RoseBuild> makeRoseBuilder(ReportManager &rm,
SmallWriteBuild &smwr,
const CompileContext &cc,
const BoundaryReports &boundary) {
return ue2::make_unique<RoseBuildImpl>(rm, ssm, smwr, cc, boundary);
return std::make_unique<RoseBuildImpl>(rm, ssm, smwr, cc, boundary);
}
bool roseIsPureLiteral(const RoseEngine *t) {

View File

@@ -95,7 +95,7 @@ OffsetMap makeOffsetMap(const RoseProgram &program, u32 *total_len) {
}
RoseProgram::RoseProgram() {
prog.emplace_back(make_unique<RoseInstrEnd>());
prog.emplace_back(std::make_unique<RoseInstrEnd>());
}
RoseProgram::~RoseProgram() = default;
@@ -297,28 +297,28 @@ void addEnginesEodProgram(u32 eodNfaIterOffset, RoseProgram &program) {
}
RoseProgram block;
block.add_before_end(make_unique<RoseInstrEnginesEod>(eodNfaIterOffset));
block.add_before_end(std::make_unique<RoseInstrEnginesEod>(eodNfaIterOffset));
program.add_block(move(block));
}
void addSuffixesEodProgram(RoseProgram &program) {
RoseProgram block;
block.add_before_end(make_unique<RoseInstrSuffixesEod>());
block.add_before_end(std::make_unique<RoseInstrSuffixesEod>());
program.add_block(move(block));
}
void addMatcherEodProgram(RoseProgram &program) {
RoseProgram block;
block.add_before_end(make_unique<RoseInstrMatcherEod>());
block.add_before_end(std::make_unique<RoseInstrMatcherEod>());
program.add_block(move(block));
}
void addFlushCombinationProgram(RoseProgram &program) {
program.add_before_end(make_unique<RoseInstrFlushCombination>());
program.add_before_end(std::make_unique<RoseInstrFlushCombination>());
}
void addLastFlushCombinationProgram(RoseProgram &program) {
program.add_before_end(make_unique<RoseInstrLastFlushCombination>());
program.add_before_end(std::make_unique<RoseInstrLastFlushCombination>());
}
static
@@ -342,11 +342,11 @@ void makeRoleCheckLeftfix(const RoseBuildImpl &build,
unique_ptr<RoseInstruction> ri;
if (is_prefix) {
ri = make_unique<RoseInstrCheckPrefix>(lni.queue, build.g[v].left.lag,
ri = std::make_unique<RoseInstrCheckPrefix>(lni.queue, build.g[v].left.lag,
build.g[v].left.leftfix_report,
end_inst);
} else {
ri = make_unique<RoseInstrCheckInfix>(lni.queue, build.g[v].left.lag,
ri = std::make_unique<RoseInstrCheckInfix>(lni.queue, build.g[v].left.lag,
build.g[v].left.leftfix_report,
end_inst);
}
@@ -384,7 +384,7 @@ void makeAnchoredLiteralDelay(const RoseBuildImpl &build,
u32 anch_id = prog_build.anchored_programs.at(lit_id);
const auto *end_inst = program.end_instruction();
auto ri = make_unique<RoseInstrAnchoredDelay>(groups, anch_id, end_inst);
auto ri = std::make_unique<RoseInstrAnchoredDelay>(groups, anch_id, end_inst);
program.add_before_end(move(ri));
}
@@ -393,7 +393,7 @@ void makeDedupe(const ReportManager &rm, const Report &report,
RoseProgram &program) {
const auto *end_inst = program.end_instruction();
auto ri =
make_unique<RoseInstrDedupe>(report.quashSom, rm.getDkey(report),
std::make_unique<RoseInstrDedupe>(report.quashSom, rm.getDkey(report),
report.offsetAdjust, end_inst);
program.add_before_end(move(ri));
}
@@ -402,7 +402,7 @@ static
void makeDedupeSom(const ReportManager &rm, const Report &report,
RoseProgram &program) {
const auto *end_inst = program.end_instruction();
auto ri = make_unique<RoseInstrDedupeSom>(report.quashSom,
auto ri = std::make_unique<RoseInstrDedupeSom>(report.quashSom,
rm.getDkey(report),
report.offsetAdjust, end_inst);
program.add_before_end(move(ri));
@@ -428,7 +428,7 @@ void makeCatchup(const ReportManager &rm, bool needs_catchup,
return;
}
program.add_before_end(make_unique<RoseInstrCatchUp>());
program.add_before_end(std::make_unique<RoseInstrCatchUp>());
}
static
@@ -511,12 +511,12 @@ void addLogicalSetRequired(const Report &report, ReportManager &rm,
return;
}
// set matching status of current lkey
auto risl = make_unique<RoseInstrSetLogical>(report.lkey,
auto risl = std::make_unique<RoseInstrSetLogical>(report.lkey,
report.offsetAdjust);
program.add_before_end(move(risl));
// set current lkey's corresponding ckeys active, pending to check
for (auto ckey : rm.getRelateCKeys(report.lkey)) {
auto risc = make_unique<RoseInstrSetCombination>(ckey);
auto risc = std::make_unique<RoseInstrSetCombination>(ckey);
program.add_before_end(move(risc));
}
}
@@ -532,7 +532,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
// Handle min/max offset checks.
if (report.minOffset > 0 || report.maxOffset < MAX_OFFSET) {
auto ri = make_unique<RoseInstrCheckBounds>(report.minOffset,
auto ri = std::make_unique<RoseInstrCheckBounds>(report.minOffset,
report.maxOffset, end_inst);
report_block.add_before_end(move(ri));
}
@@ -540,7 +540,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
// If this report has an exhaustion key, we can check it in the program
// rather than waiting until we're in the callback adaptor.
if (report.ekey != INVALID_EKEY) {
auto ri = make_unique<RoseInstrCheckExhausted>(report.ekey, end_inst);
auto ri = std::make_unique<RoseInstrCheckExhausted>(report.ekey, end_inst);
report_block.add_before_end(move(ri));
}
@@ -548,7 +548,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
// calculated.
if (isExternalSomReport(report) &&
report.type != EXTERNAL_CALLBACK_SOM_PASS) {
auto ri = make_unique<RoseInstrSomFromReport>();
auto ri = std::make_unique<RoseInstrSomFromReport>();
writeSomOperation(report, &ri->som);
report_block.add_before_end(move(ri));
}
@@ -556,13 +556,13 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
// Min length constraint.
if (report.minLength > 0) {
assert(build.hasSom);
auto ri = make_unique<RoseInstrCheckMinLength>(
auto ri = std::make_unique<RoseInstrCheckMinLength>(
report.offsetAdjust, report.minLength, end_inst);
report_block.add_before_end(move(ri));
}
if (report.quashSom) {
report_block.add_before_end(make_unique<RoseInstrSomZero>());
report_block.add_before_end(std::make_unique<RoseInstrSomZero>());
}
switch (report.type) {
@@ -578,7 +578,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
if (needs_dedupe) {
if (!report.quiet) {
report_block.add_before_end(
make_unique<RoseInstrDedupeAndReport>(
std::make_unique<RoseInstrDedupeAndReport>(
report.quashSom, build.rm.getDkey(report),
report.onmatch, report.offsetAdjust, end_inst));
} else {
@@ -587,7 +587,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
} else {
if (!report.quiet) {
report_block.add_before_end(
make_unique<RoseInstrReport>(
std::make_unique<RoseInstrReport>(
report.onmatch, report.offsetAdjust));
}
}
@@ -597,28 +597,28 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
}
if (!report.quiet) {
report_block.add_before_end(
make_unique<RoseInstrReportExhaust>(
std::make_unique<RoseInstrReportExhaust>(
report.onmatch, report.offsetAdjust, report.ekey));
} else {
report_block.add_before_end(
make_unique<RoseInstrSetExhaust>(report.ekey));
std::make_unique<RoseInstrSetExhaust>(report.ekey));
}
}
} else { // has_som
makeDedupeSom(build.rm, report, report_block);
if (report.ekey == INVALID_EKEY) {
if (!report.quiet) {
report_block.add_before_end(make_unique<RoseInstrReportSom>(
report_block.add_before_end(std::make_unique<RoseInstrReportSom>(
report.onmatch, report.offsetAdjust));
}
} else {
if (!report.quiet) {
report_block.add_before_end(
make_unique<RoseInstrReportSomExhaust>(
std::make_unique<RoseInstrReportSomExhaust>(
report.onmatch, report.offsetAdjust, report.ekey));
} else {
report_block.add_before_end(
make_unique<RoseInstrSetExhaust>(report.ekey));
std::make_unique<RoseInstrSetExhaust>(report.ekey));
}
}
}
@@ -639,17 +639,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
addFlushCombinationProgram(report_block);
}
if (has_som) {
auto ri = make_unique<RoseInstrReportSomAware>();
auto ri = std::make_unique<RoseInstrReportSomAware>();
writeSomOperation(report, &ri->som);
report_block.add_before_end(move(ri));
} else {
auto ri = make_unique<RoseInstrReportSomInt>();
auto ri = std::make_unique<RoseInstrReportSomInt>();
writeSomOperation(report, &ri->som);
report_block.add_before_end(move(ri));
}
break;
case INTERNAL_ROSE_CHAIN: {
report_block.add_before_end(make_unique<RoseInstrReportChain>(
report_block.add_before_end(std::make_unique<RoseInstrReportChain>(
report.onmatch, report.topSquashDistance));
break;
}
@@ -663,17 +663,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
makeDedupeSom(build.rm, report, report_block);
if (report.ekey == INVALID_EKEY) {
if (!report.quiet) {
report_block.add_before_end(make_unique<RoseInstrReportSom>(
report_block.add_before_end(std::make_unique<RoseInstrReportSom>(
report.onmatch, report.offsetAdjust));
}
} else {
if (!report.quiet) {
report_block.add_before_end(
make_unique<RoseInstrReportSomExhaust>(
std::make_unique<RoseInstrReportSomExhaust>(
report.onmatch, report.offsetAdjust, report.ekey));
} else {
report_block.add_before_end(
make_unique<RoseInstrSetExhaust>(report.ekey));
std::make_unique<RoseInstrSetExhaust>(report.ekey));
}
}
addLogicalSetRequired(report, build.rm, report_block);
@@ -685,17 +685,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id,
makeDedupeSom(build.rm, report, report_block);
if (report.ekey == INVALID_EKEY) {
if (!report.quiet) {
report_block.add_before_end(make_unique<RoseInstrReportSom>(
report_block.add_before_end(std::make_unique<RoseInstrReportSom>(
report.onmatch, report.offsetAdjust));
}
} else {
if (!report.quiet) {
report_block.add_before_end(
make_unique<RoseInstrReportSomExhaust>(
std::make_unique<RoseInstrReportSomExhaust>(
report.onmatch, report.offsetAdjust, report.ekey));
} else {
report_block.add_before_end(
make_unique<RoseInstrSetExhaust>(report.ekey));
std::make_unique<RoseInstrSetExhaust>(report.ekey));
}
}
addLogicalSetRequired(report, build.rm, report_block);
@@ -722,11 +722,11 @@ void makeRoleReports(const RoseBuildImpl &build,
assert(contains(leftfix_info, v));
const left_build_info &lni = leftfix_info.at(v);
program.add_before_end(
make_unique<RoseInstrSomLeftfix>(lni.queue, g[v].left.lag));
std::make_unique<RoseInstrSomLeftfix>(lni.queue, g[v].left.lag));
report_som = true;
} else if (g[v].som_adjust) {
program.add_before_end(
make_unique<RoseInstrSomAdjust>(g[v].som_adjust));
std::make_unique<RoseInstrSomAdjust>(g[v].som_adjust));
report_som = true;
}
@@ -748,7 +748,7 @@ void makeRoleSetState(const unordered_map<RoseVertex, u32> &roleStateIndices,
if (it == end(roleStateIndices)) {
return;
}
program.add_before_end(make_unique<RoseInstrSetState>(it->second));
program.add_before_end(std::make_unique<RoseInstrSetState>(it->second));
}
static
@@ -772,7 +772,7 @@ void makePushDelayedInstructions(const RoseLiteralMap &literals,
});
for (const auto &ri : delay_instructions) {
program.add_before_end(make_unique<RoseInstrPushDelayed>(ri));
program.add_before_end(std::make_unique<RoseInstrPushDelayed>(ri));
}
}
@@ -801,10 +801,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit,
const auto *end_inst = program.end_instruction();
unique_ptr<RoseInstruction> ri;
if (lit.s.any_nocase()) {
ri = make_unique<RoseInstrCheckMedLitNocase>(lit.s.get_string(),
ri = std::make_unique<RoseInstrCheckMedLitNocase>(lit.s.get_string(),
end_inst);
} else {
ri = make_unique<RoseInstrCheckMedLit>(lit.s.get_string(),
ri = std::make_unique<RoseInstrCheckMedLit>(lit.s.get_string(),
end_inst);
}
program.add_before_end(move(ri));
@@ -820,10 +820,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit,
const auto *end_inst = program.end_instruction();
unique_ptr<RoseInstruction> ri;
if (lit.s.any_nocase()) {
ri = make_unique<RoseInstrCheckLongLitNocase>(lit.s.get_string(),
ri = std::make_unique<RoseInstrCheckLongLitNocase>(lit.s.get_string(),
end_inst);
} else {
ri = make_unique<RoseInstrCheckLongLit>(lit.s.get_string(), end_inst);
ri = std::make_unique<RoseInstrCheckLongLit>(lit.s.get_string(), end_inst);
}
program.add_before_end(move(ri));
}
@@ -840,7 +840,7 @@ void makeRoleCheckNotHandled(ProgramBuild &prog_build, RoseVertex v,
}
const auto *end_inst = program.end_instruction();
auto ri = make_unique<RoseInstrCheckNotHandled>(handled_key, end_inst);
auto ri = std::make_unique<RoseInstrCheckNotHandled>(handled_key, end_inst);
program.add_before_end(move(ri));
}
@@ -889,7 +889,7 @@ void makeRoleCheckBounds(const RoseBuildImpl &build, RoseVertex v,
const auto *end_inst = program.end_instruction();
program.add_before_end(
make_unique<RoseInstrCheckBounds>(min_bound, max_bound, end_inst));
std::make_unique<RoseInstrCheckBounds>(min_bound, max_bound, end_inst));
}
static
@@ -924,7 +924,7 @@ void makeRoleGroups(const RoseGraph &g, ProgramBuild &prog_build,
return;
}
program.add_before_end(make_unique<RoseInstrSetGroups>(groups));
program.add_before_end(std::make_unique<RoseInstrSetGroups>(groups));
}
static
@@ -968,7 +968,7 @@ bool makeRoleByte(const vector<LookEntry> &look, RoseProgram &program) {
s32 checkbyte_offset = verify_s32(entry.offset);
DEBUG_PRINTF("CHECK BYTE offset=%d\n", checkbyte_offset);
const auto *end_inst = program.end_instruction();
auto ri = make_unique<RoseInstrCheckByte>(andmask_u8, cmpmask_u8, flip,
auto ri = std::make_unique<RoseInstrCheckByte>(andmask_u8, cmpmask_u8, flip,
checkbyte_offset, end_inst);
program.add_before_end(move(ri));
return true;
@@ -1000,7 +1000,7 @@ bool makeRoleMask(const vector<LookEntry> &look, RoseProgram &program) {
DEBUG_PRINTF("CHECK MASK and_mask=%llx cmp_mask=%llx\n",
and_mask, cmp_mask);
const auto *end_inst = program.end_instruction();
auto ri = make_unique<RoseInstrCheckMask>(and_mask, cmp_mask, neg_mask,
auto ri = std::make_unique<RoseInstrCheckMask>(and_mask, cmp_mask, neg_mask,
base_offset, end_inst);
program.add_before_end(move(ri));
return true;
@@ -1055,7 +1055,7 @@ bool makeRoleMask32(const vector<LookEntry> &look,
DEBUG_PRINTF("base_offset %d\n", base_offset);
const auto *end_inst = program.end_instruction();
auto ri = make_unique<RoseInstrCheckMask32>(and_mask, cmp_mask, neg_mask,
auto ri = std::make_unique<RoseInstrCheckMask32>(and_mask, cmp_mask, neg_mask,
base_offset, end_inst);
program.add_before_end(move(ri));
return true;
@@ -1098,7 +1098,7 @@ bool makeRoleMask64(const vector<LookEntry> &look,
DEBUG_PRINTF("base_offset %d\n", base_offset);
const auto *end_inst = program.end_instruction();
auto ri = make_unique<RoseInstrCheckMask64>(and_mask, cmp_mask, neg_mask,
auto ri = std::make_unique<RoseInstrCheckMask64>(and_mask, cmp_mask, neg_mask,
base_offset, end_inst);
program.add_before_end(move(ri));
return true;
@@ -1235,7 +1235,7 @@ makeCheckShufti16x8(u32 offset_range, u8 bucket_idx,
copy(hi_mask.begin(), hi_mask.begin() + 16, nib_mask.begin() + 16);
copy(bucket_select_mask.begin(), bucket_select_mask.begin() + 16,
bucket_select_mask_16.begin());
return make_unique<RoseInstrCheckShufti16x8>
return std::make_unique<RoseInstrCheckShufti16x8>
(nib_mask, bucket_select_mask_16,
neg_mask & 0xffff, base_offset, end_inst);
}
@@ -1255,7 +1255,7 @@ makeCheckShufti32x8(u32 offset_range, u8 bucket_idx,
array<u8, 16> lo_mask_16;
copy(hi_mask.begin(), hi_mask.begin() + 16, hi_mask_16.begin());
copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_16.begin());
return make_unique<RoseInstrCheckShufti32x8>
return std::make_unique<RoseInstrCheckShufti32x8>
(hi_mask_16, lo_mask_16, bucket_select_mask,
neg_mask, base_offset, end_inst);
}
@@ -1277,7 +1277,7 @@ makeCheckShufti16x16(u32 offset_range, u8 bucket_idx,
bucket_select_mask_32.begin());
copy(bucket_select_mask_hi.begin(), bucket_select_mask_hi.begin() + 16,
bucket_select_mask_32.begin() + 16);
return make_unique<RoseInstrCheckShufti16x16>
return std::make_unique<RoseInstrCheckShufti16x16>
(hi_mask, lo_mask, bucket_select_mask_32,
neg_mask & 0xffff, base_offset, end_inst);
}
@@ -1294,7 +1294,7 @@ makeCheckShufti32x16(u32 offset_range, u8 bucket_idx,
return nullptr;
}
return make_unique<RoseInstrCheckShufti32x16>
return std::make_unique<RoseInstrCheckShufti32x16>
(hi_mask, lo_mask, bucket_select_mask_hi,
bucket_select_mask_lo, neg_mask, base_offset, end_inst);
}
@@ -1321,7 +1321,7 @@ makeCheckShufti64x8(u32 offset_range, u8 bucket_idx,
copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 32);
copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 48);
return make_unique<RoseInstrCheckShufti64x8>
return std::make_unique<RoseInstrCheckShufti64x8>
(hi_mask_64, lo_mask_64, bucket_select_mask,
neg_mask, base_offset, end_inst);
}
@@ -1361,7 +1361,7 @@ makeCheckShufti64x16(u32 offset_range, u8 bucket_idx,
copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 32);
copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 48);
return make_unique<RoseInstrCheckShufti64x16>
return std::make_unique<RoseInstrCheckShufti64x16>
(hi_mask_1, hi_mask_2, lo_mask_1, lo_mask_2, bucket_select_mask_hi,
bucket_select_mask_lo, neg_mask, base_offset, end_inst);
}
@@ -1486,7 +1486,7 @@ void makeLookaroundInstruction(const vector<LookEntry> &look,
if (look.size() == 1) {
s8 offset = look.begin()->offset;
const CharReach &reach = look.begin()->reach;
auto ri = make_unique<RoseInstrCheckSingleLookaround>(offset, reach,
auto ri = std::make_unique<RoseInstrCheckSingleLookaround>(offset, reach,
program.end_instruction());
program.add_before_end(move(ri));
return;
@@ -1508,7 +1508,7 @@ void makeLookaroundInstruction(const vector<LookEntry> &look,
return;
}
auto ri = make_unique<RoseInstrCheckLookaround>(look,
auto ri = std::make_unique<RoseInstrCheckLookaround>(look,
program.end_instruction());
program.add_before_end(move(ri));
}
@@ -1584,7 +1584,7 @@ void makeCheckLitEarlyInstruction(const RoseBuildImpl &build, u32 lit_id,
DEBUG_PRINTF("adding lit early check, min_offset=%u\n", min_offset);
const auto *end = prog.end_instruction();
prog.add_before_end(make_unique<RoseInstrCheckLitEarly>(min_offset, end));
prog.add_before_end(std::make_unique<RoseInstrCheckLitEarly>(min_offset, end));
}
static
@@ -1595,7 +1595,7 @@ void makeGroupCheckInstruction(const RoseBuildImpl &build, u32 lit_id,
if (!info.group_mask) {
return;
}
prog.add_before_end(make_unique<RoseInstrCheckGroups>(info.group_mask));
prog.add_before_end(std::make_unique<RoseInstrCheckGroups>(info.group_mask));
}
static
@@ -1762,7 +1762,7 @@ bool makeRoleMultipathShufti(const vector<vector<LookEntry>> &multi_look,
copy(begin(lo_mask), begin(lo_mask) + 16, nib_mask.begin());
copy(begin(hi_mask), begin(hi_mask) + 16, nib_mask.begin() + 16);
auto ri = make_unique<RoseInstrCheckMultipathShufti16x8>
auto ri = std::make_unique<RoseInstrCheckMultipathShufti16x8>
(nib_mask, bucket_select_lo, data_select_mask, hi_bits_mask,
lo_bits_mask, neg_mask, base_offset, last_start, end_inst);
program.add_before_end(move(ri));
@@ -1771,20 +1771,20 @@ bool makeRoleMultipathShufti(const vector<vector<LookEntry>> &multi_look,
assert(!(hi_bits_mask & ~0xffffffffULL));
assert(!(lo_bits_mask & ~0xffffffffULL));
if (bit_index <= 8) {
auto ri = make_unique<RoseInstrCheckMultipathShufti32x8>
auto ri = std::make_unique<RoseInstrCheckMultipathShufti32x8>
(hi_mask, lo_mask, bucket_select_lo, data_select_mask,
hi_bits_mask, lo_bits_mask, neg_mask, base_offset,
last_start, end_inst);
program.add_before_end(move(ri));
} else {
auto ri = make_unique<RoseInstrCheckMultipathShufti32x16>
auto ri = std::make_unique<RoseInstrCheckMultipathShufti32x16>
(hi_mask, lo_mask, bucket_select_hi, bucket_select_lo,
data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask,
base_offset, last_start, end_inst);
program.add_before_end(move(ri));
}
} else {
auto ri = make_unique<RoseInstrCheckMultipathShufti64>
auto ri = std::make_unique<RoseInstrCheckMultipathShufti64>
(hi_mask, lo_mask, bucket_select_lo, data_select_mask,
hi_bits_mask, lo_bits_mask, neg_mask, base_offset,
last_start, end_inst);
@@ -1856,7 +1856,7 @@ void makeRoleMultipathLookaround(const vector<vector<LookEntry>> &multi_look,
ordered_look.emplace_back(multi_entry);
}
auto ri = make_unique<RoseInstrMultipathLookaround>(move(ordered_look),
auto ri = std::make_unique<RoseInstrMultipathLookaround>(move(ordered_look),
last_start, start_mask,
program.end_instruction());
program.add_before_end(move(ri));
@@ -1932,7 +1932,7 @@ void makeRoleSuffix(const RoseBuildImpl &build,
event = MQE_TOP;
}
prog.add_before_end(make_unique<RoseInstrTriggerSuffix>(queue, event));
prog.add_before_end(std::make_unique<RoseInstrTriggerSuffix>(queue, event));
}
static
@@ -1945,7 +1945,7 @@ void addInfixTriggerInstructions(vector<TriggerInfo> triggers,
});
for (const auto &ti : triggers) {
prog.add_before_end(
make_unique<RoseInstrTriggerInfix>(ti.cancel, ti.queue, ti.event));
std::make_unique<RoseInstrTriggerInfix>(ti.cancel, ti.queue, ti.event));
}
}
@@ -2039,7 +2039,7 @@ static
void addCheckOnlyEodInstruction(RoseProgram &prog) {
DEBUG_PRINTF("only at eod\n");
const auto *end_inst = prog.end_instruction();
prog.add_before_end(make_unique<RoseInstrCheckOnlyEod>(end_inst));
prog.add_before_end(std::make_unique<RoseInstrCheckOnlyEod>(end_inst));
}
static
@@ -2164,7 +2164,7 @@ void makeGroupSquashInstruction(const RoseBuildImpl &build, u32 lit_id,
DEBUG_PRINTF("squashes 0x%llx\n", info.group_mask);
assert(info.group_mask);
/* Note: group_mask is negated. */
prog.add_before_end(make_unique<RoseInstrSquashGroups>(~info.group_mask));
prog.add_before_end(std::make_unique<RoseInstrSquashGroups>(~info.group_mask));
}
namespace {
@@ -2209,7 +2209,7 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
* only set if a state has been. */
if (!prog.empty() && reads_work_done_flag(block)) {
RoseProgram clear_block;
clear_block.add_before_end(make_unique<RoseInstrClearWorkDone>());
clear_block.add_before_end(std::make_unique<RoseInstrClearWorkDone>());
prog.add_block(move(clear_block));
}
@@ -2369,7 +2369,7 @@ void makeCatchupMpv(const ReportManager &rm, bool needs_mpv_catchup,
return;
}
program.add_before_end(make_unique<RoseInstrCatchUpMpv>());
program.add_before_end(std::make_unique<RoseInstrCatchUpMpv>());
}
RoseProgram makeReportProgram(const RoseBuildImpl &build,
@@ -2402,7 +2402,7 @@ RoseProgram makeBoundaryProgram(const RoseBuildImpl &build,
void addIncludedJumpProgram(RoseProgram &program, u32 child_offset,
u8 squash) {
RoseProgram block;
block.add_before_end(make_unique<RoseInstrIncludedJump>(child_offset,
block.add_before_end(std::make_unique<RoseInstrIncludedJump>(child_offset,
squash));
program.add_block(move(block));
}
@@ -2413,7 +2413,7 @@ void addPredBlockSingle(u32 pred_state, RoseProgram &pred_block,
// Prepend an instruction to check the pred state is on.
const auto *end_inst = pred_block.end_instruction();
pred_block.insert(begin(pred_block),
make_unique<RoseInstrCheckState>(pred_state, end_inst));
std::make_unique<RoseInstrCheckState>(pred_state, end_inst));
program.add_block(move(pred_block));
}
@@ -2428,7 +2428,7 @@ void addPredBlocksAny(map<u32, RoseProgram> &pred_blocks, u32 num_states,
}
const RoseInstruction *end_inst = sparse_program.end_instruction();
auto ri = make_unique<RoseInstrSparseIterAny>(num_states, keys, end_inst);
auto ri = std::make_unique<RoseInstrSparseIterAny>(num_states, keys, end_inst);
sparse_program.add_before_end(move(ri));
RoseProgram &block = pred_blocks.begin()->second;
@@ -2451,14 +2451,14 @@ void addPredBlocksMulti(map<u32, RoseProgram> &pred_blocks,
vector<pair<u32, const RoseInstruction *>> jump_table;
// BEGIN instruction.
auto ri_begin = make_unique<RoseInstrSparseIterBegin>(num_states, end_inst);
auto ri_begin = std::make_unique<RoseInstrSparseIterBegin>(num_states, end_inst);
RoseInstrSparseIterBegin *begin_inst = ri_begin.get();
sparse_program.add_before_end(move(ri_begin));
// NEXT instructions, one per pred program.
u32 prev_key = pred_blocks.begin()->first;
for (auto it = next(begin(pred_blocks)); it != end(pred_blocks); ++it) {
auto ri = make_unique<RoseInstrSparseIterNext>(prev_key, begin_inst,
auto ri = std::make_unique<RoseInstrSparseIterNext>(prev_key, begin_inst,
end_inst);
sparse_program.add_before_end(move(ri));
prev_key = it->first;
@@ -2539,7 +2539,7 @@ void applyFinalSpecialisation(RoseProgram &program) {
auto it = next(program.rbegin());
if (auto *ri = dynamic_cast<const RoseInstrReport *>(it->get())) {
DEBUG_PRINTF("replacing REPORT with FINAL_REPORT\n");
program.replace(it, make_unique<RoseInstrFinalReport>(
program.replace(it, std::make_unique<RoseInstrFinalReport>(
ri->onmatch, ri->offset_adjust));
}
}

View File

@@ -33,7 +33,6 @@
#include "rose_program.h"
#include "util/bytecode_ptr.h"
#include "util/hash.h"
#include "util/make_unique.h"
#include <unordered_map>
#include <vector>

View File

@@ -35,7 +35,6 @@
#include "nfagraph/ng_width.h"
#include "util/container.h"
#include "util/graph_range.h"
#include "util/make_unique.h"
#include <vector>
@@ -93,7 +92,7 @@ private:
unique_ptr<RoseInGraph> cloneRoseGraph(const RoseInGraph &ig) {
assert(hasCorrectlyNumberedVertices(ig));
unique_ptr<RoseInGraph> out = make_unique<RoseInGraph>();
unique_ptr<RoseInGraph> out = std::make_unique<RoseInGraph>();
unordered_map<const NGHolder *, shared_ptr<NGHolder>> graph_map;
unordered_map<const raw_som_dfa *, shared_ptr<raw_som_dfa>> haig_map;