diff --git a/chimera/ch_compile.cpp b/chimera/ch_compile.cpp index 46536f31..fbe8fe53 100644 --- a/chimera/ch_compile.cpp +++ b/chimera/ch_compile.cpp @@ -39,7 +39,6 @@ #include "hs_internal.h" #include "ue2common.h" #include "util/compile_error.h" -#include "util/make_unique.h" #include "util/multibit_build.h" #include "util/target_info.h" @@ -495,7 +494,7 @@ void ch_compile_multi_int(const char *const *expressions, const unsigned *flags, // First, build with libpcre. A build failure from libpcre will throw // an exception up to the caller. auto patternData = - ue2::make_unique(myExpr, myFlags, i, myId, mode, match_limit, + std::make_unique(myExpr, myFlags, i, myId, mode, match_limit, match_limit_recursion, platform); pcres.push_back(move(patternData)); PatternData &curr = *pcres.back(); diff --git a/src/fdr/fdr_compile.cpp b/src/fdr/fdr_compile.cpp index a19f4390..af0f35de 100644 --- a/src/fdr/fdr_compile.cpp +++ b/src/fdr/fdr_compile.cpp @@ -44,7 +44,6 @@ #include "util/compare.h" #include "util/container.h" #include "util/dump_mask.h" -#include "util/make_unique.h" #include "util/math.h" #include "util/noncopyable.h" #include "util/target_info.h" @@ -868,7 +867,7 @@ unique_ptr fdrBuildProtoInternal(u8 engType, auto bucketToLits = assignStringsToBuckets(lits, *des); addIncludedInfo(lits, des->getNumBuckets(), bucketToLits); auto proto = - ue2::make_unique(engType, move(des), lits, bucketToLits, + std::make_unique(engType, move(des), lits, bucketToLits, make_small); return proto; } diff --git a/src/fdr/fdr_engine_description.cpp b/src/fdr/fdr_engine_description.cpp index 2f9ba420..c4f59258 100644 --- a/src/fdr/fdr_engine_description.cpp +++ b/src/fdr/fdr_engine_description.cpp @@ -31,7 +31,6 @@ #include "hs_compile.h" #include "util/target_info.h" #include "util/compare.h" // for ourisalpha() -#include "util/make_unique.h" #include #include @@ -196,7 +195,7 @@ unique_ptr chooseEngine(const target_t &target, } DEBUG_PRINTF("using engine %u\n", best->getID()); - return ue2::make_unique(*best); + return std::make_unique(*best); } SchemeBitIndex FDREngineDescription::getSchemeBit(BucketIndex b, @@ -222,7 +221,7 @@ unique_ptr getFdrDescription(u32 engineID) { return nullptr; } - return ue2::make_unique(allDescs[engineID]); + return std::make_unique(allDescs[engineID]); } } // namespace ue2 diff --git a/src/fdr/teddy_compile.cpp b/src/fdr/teddy_compile.cpp index d797c53b..9fb7b26b 100644 --- a/src/fdr/teddy_compile.cpp +++ b/src/fdr/teddy_compile.cpp @@ -46,7 +46,6 @@ #include "util/alloc.h" #include "util/compare.h" #include "util/container.h" -#include "util/make_unique.h" #include "util/noncopyable.h" #include "util/popcount.h" #include "util/small_vector.h" @@ -677,7 +676,7 @@ unique_ptr teddyBuildProtoHinted( return nullptr; } - return ue2::make_unique(engType, move(des), lits, + return std::make_unique(engType, move(des), lits, bucketToLits, make_small); } diff --git a/src/fdr/teddy_engine_description.cpp b/src/fdr/teddy_engine_description.cpp index 88ae0f53..7cd33ab2 100644 --- a/src/fdr/teddy_engine_description.cpp +++ b/src/fdr/teddy_engine_description.cpp @@ -34,7 +34,6 @@ #include "fdr_engine_description.h" #include "teddy_internal.h" #include "teddy_engine_description.h" -#include "util/make_unique.h" #include @@ -197,7 +196,7 @@ chooseTeddyEngine(const target_t &target, const vector &vl) { } DEBUG_PRINTF("using engine %u\n", best->getID()); - return ue2::make_unique(*best); + return std::make_unique(*best); } unique_ptr getTeddyDescription(u32 engineID) { @@ -206,7 +205,7 @@ unique_ptr getTeddyDescription(u32 engineID) { for (const auto &desc : descs) { if (desc.getID() == engineID) { - return ue2::make_unique(desc); + return std::make_unique(desc); } } diff --git a/src/hwlm/hwlm_build.cpp b/src/hwlm/hwlm_build.cpp index 1b332815..615224fe 100644 --- a/src/hwlm/hwlm_build.cpp +++ b/src/hwlm/hwlm_build.cpp @@ -46,7 +46,6 @@ #include "fdr/teddy_engine_description.h" #include "util/compile_context.h" #include "util/compile_error.h" -#include "util/make_unique.h" #include "util/ue2string.h" #include @@ -201,7 +200,7 @@ hwlmBuildProto(vector &lits, bool make_small, if (isNoodleable(lits, cc)) { DEBUG_PRINTF("build noodle table\n"); - proto = ue2::make_unique(HWLM_ENGINE_NOOD, lits); + proto = std::make_unique(HWLM_ENGINE_NOOD, lits); } else { DEBUG_PRINTF("building a new deal\n"); proto = fdrBuildProto(HWLM_ENGINE_FDR, lits, make_small, diff --git a/src/nfa/castlecompile.cpp b/src/nfa/castlecompile.cpp index 698c07e6..20bc2925 100644 --- a/src/nfa/castlecompile.cpp +++ b/src/nfa/castlecompile.cpp @@ -50,7 +50,6 @@ #include "util/dump_charclass.h" #include "util/flat_containers.h" #include "util/graph.h" -#include "util/make_unique.h" #include "util/multibit_build.h" #include "util/report_manager.h" #include "util/verify_types.h" @@ -977,7 +976,7 @@ unique_ptr makeHolder(const CastleProto &proto, } } - auto g = ue2::make_unique(proto.kind); + auto g = std::make_unique(proto.kind); for (const auto &m : proto.repeats) { addToHolder(*g, m.first, m.second); diff --git a/src/nfa/goughcompile.cpp b/src/nfa/goughcompile.cpp index 4b3d0c3d..3bf729b3 100644 --- a/src/nfa/goughcompile.cpp +++ b/src/nfa/goughcompile.cpp @@ -39,7 +39,6 @@ #include "util/container.h" #include "util/flat_containers.h" #include "util/graph_range.h" -#include "util/make_unique.h" #include "util/order_check.h" #include "util/report_manager.h" #include "util/verify_types.h" @@ -348,7 +347,7 @@ static never_inline unique_ptr makeCFG(const raw_som_dfa &raw) { vector vertices; vertices.reserve(raw.states.size()); - unique_ptr cfg = ue2::make_unique(); + unique_ptr cfg = std::make_unique(); u32 min_state = !is_triggered(raw.kind); if (min_state) { @@ -1235,7 +1234,7 @@ unique_ptr gough_build_strat::gatherReports( const bool remap_reports = has_managed_reports(rdfa.kind); - auto ri = ue2::make_unique(); + auto ri = std::make_unique(); map rev; assert(!rdfa.states.empty()); diff --git a/src/nfa/mcclellancompile.cpp b/src/nfa/mcclellancompile.cpp index 2ea7fcb4..b5c3a8ac 100644 --- a/src/nfa/mcclellancompile.cpp +++ b/src/nfa/mcclellancompile.cpp @@ -43,7 +43,6 @@ #include "util/compare.h" #include "util/compile_context.h" #include "util/container.h" -#include "util/make_unique.h" #include "util/order_check.h" #include "util/report_manager.h" #include "util/flat_containers.h" @@ -393,7 +392,7 @@ unique_ptr mcclellan_build_strat::gatherReports( const bool remap_reports = has_managed_reports(rdfa.kind); - auto ri = ue2::make_unique(); + auto ri = std::make_unique(); map rev; for (const dstate &s : rdfa.states) { diff --git a/src/nfa/mcsheng_compile.cpp b/src/nfa/mcsheng_compile.cpp index fea4062c..622362be 100644 --- a/src/nfa/mcsheng_compile.cpp +++ b/src/nfa/mcsheng_compile.cpp @@ -48,7 +48,6 @@ #include "util/flat_containers.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/unaligned.h" diff --git a/src/nfa/rdfa_merge.cpp b/src/nfa/rdfa_merge.cpp index 07b1c550..8506f90b 100644 --- a/src/nfa/rdfa_merge.cpp +++ b/src/nfa/rdfa_merge.cpp @@ -37,7 +37,6 @@ #include "util/container.h" #include "util/determinise.h" #include "util/flat_containers.h" -#include "util/make_unique.h" #include "util/report_manager.h" #include "util/unordered.h" @@ -287,7 +286,7 @@ unique_ptr mergeTwoDfas(const raw_dfa *d1, const raw_dfa *d2, assert(d1->kind == d2->kind); assert(max_states <= MAX_DFA_STATES); - auto rdfa = ue2::make_unique(d1->kind); + auto rdfa = std::make_unique(d1->kind); Automaton_Merge autom(d1, d2, rm, grey); if (determinise(autom, rdfa->states, max_states)) { @@ -370,7 +369,7 @@ unique_ptr mergeAllDfas(const vector &dfas, assert(all_of(begin(dfas), end(dfas), [&kind](const raw_dfa *rdfa) { return rdfa->kind == kind; })); - auto rdfa = ue2::make_unique(kind); + auto rdfa = std::make_unique(kind); Automaton_Merge n(dfas, rm, grey); DEBUG_PRINTF("merging dfa\n"); diff --git a/src/nfa/shengcompile.cpp b/src/nfa/shengcompile.cpp index f343679b..240d6c08 100644 --- a/src/nfa/shengcompile.cpp +++ b/src/nfa/shengcompile.cpp @@ -46,7 +46,6 @@ #include "sheng_internal.h" #include "ue2common.h" #include "util/compile_context.h" -#include "util/make_unique.h" #include "util/verify_types.h" #include "util/simd_types.h" @@ -203,7 +202,7 @@ unique_ptr sheng_build_strat::gatherReports( const bool remap_reports = has_managed_reports(rdfa.kind); - auto ri = ue2::make_unique(); + auto ri = std::make_unique(); map rev; for (const dstate &s : rdfa.states) { diff --git a/src/nfagraph/ng.cpp b/src/nfagraph/ng.cpp index 8dccf986..b2a87523 100644 --- a/src/nfagraph/ng.cpp +++ b/src/nfagraph/ng.cpp @@ -71,7 +71,6 @@ #include "util/container.h" #include "util/depth.h" #include "util/graph_range.h" -#include "util/make_unique.h" #include "util/ue2string.h" using namespace std; diff --git a/src/nfagraph/ng_builder.cpp b/src/nfagraph/ng_builder.cpp index 60f667f4..72beba3e 100644 --- a/src/nfagraph/ng_builder.cpp +++ b/src/nfagraph/ng_builder.cpp @@ -39,7 +39,6 @@ #include "ue2common.h" #include "compiler/compiler.h" // for ParsedExpression #include "util/compile_error.h" -#include "util/make_unique.h" #include @@ -114,7 +113,7 @@ private: NFABuilderImpl::NFABuilderImpl(ReportManager &rm_in, const Grey &grey_in, const ParsedExpression &parsed) - : rm(rm_in), grey(grey_in), graph(ue2::make_unique()), + : rm(rm_in), grey(grey_in), graph(std::make_unique()), expr(parsed.expr), vertIdx(N_SPECIALS) { // Reserve space for a reasonably-sized NFA @@ -270,7 +269,7 @@ void NFABuilderImpl::cloneRegion(Position first, Position last, unsigned posOffs unique_ptr makeNFABuilder(ReportManager &rm, const CompileContext &cc, const ParsedExpression &expr) { - return ue2::make_unique(rm, cc.grey, expr); + return std::make_unique(rm, cc.grey, expr); } NFABuilder::~NFABuilder() { } diff --git a/src/nfagraph/ng_calc_components.cpp b/src/nfagraph/ng_calc_components.cpp index 5be1ff0d..2d26aae6 100644 --- a/src/nfagraph/ng_calc_components.cpp +++ b/src/nfagraph/ng_calc_components.cpp @@ -58,7 +58,6 @@ #include "ue2common.h" #include "util/graph_range.h" #include "util/graph_undirected.h" -#include "util/make_unique.h" #include #include @@ -355,7 +354,7 @@ void splitIntoComponents(unique_ptr g, * no deterministic ordering (split_components map). */ sort(begin(vv), end(vv)); - auto gc = ue2::make_unique(); + auto gc = std::make_unique(); v_map.clear(); fillHolder(gc.get(), *g, vv, &v_map); @@ -379,7 +378,7 @@ void splitIntoComponents(unique_ptr g, vv.insert(vv.end(), begin(head_shell), end(head_shell)); vv.insert(vv.end(), begin(tail_shell), end(tail_shell)); - auto gc = ue2::make_unique(); + auto gc = std::make_unique(); v_map.clear(); fillHolder(gc.get(), *g, vv, &v_map); diff --git a/src/nfagraph/ng_equivalence.cpp b/src/nfagraph/ng_equivalence.cpp index 5af0c012..c575ad2f 100644 --- a/src/nfagraph/ng_equivalence.cpp +++ b/src/nfagraph/ng_equivalence.cpp @@ -39,7 +39,6 @@ #include "util/compile_context.h" #include "util/flat_containers.h" #include "util/graph_range.h" -#include "util/make_unique.h" #include "util/unordered.h" #include @@ -269,7 +268,7 @@ vector> getVertexInfos(const NGHolder &g) { vertex_map.resize(num_verts); for (auto v : vertices_range(g)) { - infos.emplace_back(make_unique(v, g)); + infos.emplace_back(std::make_unique(v, g)); vertex_map[g[v].index] = infos.back().get(); } @@ -516,7 +515,7 @@ void mergeClass(vector> &infos, NGHolder &g, g[new_v].reports.clear(); /* populated as we pull in succs */ // store this vertex in our global vertex list - infos.emplace_back(make_unique(new_v, g)); + infos.emplace_back(std::make_unique(new_v, g)); VertexInfo *new_vertex_info = infos.back().get(); NFAVertex new_v_eod = NGHolder::null_vertex(); @@ -525,7 +524,7 @@ void mergeClass(vector> &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.emplace_back(make_unique(new_v_eod, g)); + infos.emplace_back(std::make_unique(new_v_eod, g)); new_vertex_info_eod = infos.back().get(); } diff --git a/src/nfagraph/ng_haig.cpp b/src/nfagraph/ng_haig.cpp index 156b8f6b..bf951a0b 100644 --- a/src/nfagraph/ng_haig.cpp +++ b/src/nfagraph/ng_haig.cpp @@ -44,7 +44,6 @@ #include "util/graph.h" #include "util/graph_range.h" #include "util/hash_dynamic_bitset.h" -#include "util/make_unique.h" #include "util/unordered.h" #include @@ -581,7 +580,7 @@ attemptToBuildHaig(const NGHolder &g, som_type som, u32 somPrecision, return nullptr; } - auto rdfa = ue2::make_unique(g.kind, unordered_som, NODE_START, + auto rdfa = std::make_unique(g.kind, unordered_som, NODE_START, somPrecision); DEBUG_PRINTF("determinising nfa with %u vertices\n", numStates); @@ -724,7 +723,7 @@ unique_ptr attemptToMergeHaig(const vector &df using StateSet = Automaton_Haig_Merge::StateSet; vector nfa_state_map; - auto rdfa = ue2::make_unique(dfas[0]->kind, unordered_som, + auto rdfa = std::make_unique(dfas[0]->kind, unordered_som, NODE_START, dfas[0]->stream_som_loc_width); diff --git a/src/nfagraph/ng_is_equal.cpp b/src/nfagraph/ng_is_equal.cpp index 35a09d0e..ca6e30b3 100644 --- a/src/nfagraph/ng_is_equal.cpp +++ b/src/nfagraph/ng_is_equal.cpp @@ -41,7 +41,6 @@ #include "util/container.h" #include "util/flat_containers.h" #include "util/graph_range.h" -#include "util/make_unique.h" using namespace std; diff --git a/src/nfagraph/ng_literal_decorated.cpp b/src/nfagraph/ng_literal_decorated.cpp index b8367cd6..d3a42b59 100644 --- a/src/nfagraph/ng_literal_decorated.cpp +++ b/src/nfagraph/ng_literal_decorated.cpp @@ -39,7 +39,6 @@ #include "rose/rose_in_util.h" #include "util/compile_context.h" #include "util/dump_charclass.h" -#include "util/make_unique.h" #include #include diff --git a/src/nfagraph/ng_mcclellan.cpp b/src/nfagraph/ng_mcclellan.cpp index c361c3be..1e4b743f 100644 --- a/src/nfagraph/ng_mcclellan.cpp +++ b/src/nfagraph/ng_mcclellan.cpp @@ -45,7 +45,6 @@ #include "util/graph_range.h" #include "util/hash.h" #include "util/hash_dynamic_bitset.h" -#include "util/make_unique.h" #include "util/report_manager.h" #include @@ -568,7 +567,7 @@ unique_ptr buildMcClellan(const NGHolder &graph, return nullptr; } - auto rdfa = ue2::make_unique(graph.kind); + auto rdfa = std::make_unique(graph.kind); if (numStates <= NFA_STATE_LIMIT) { /* Fast path. Automaton_Graph uses a bitfield internally to represent diff --git a/src/nfagraph/ng_som.cpp b/src/nfagraph/ng_som.cpp index fcc61a41..10d93fb8 100644 --- a/src/nfagraph/ng_som.cpp +++ b/src/nfagraph/ng_som.cpp @@ -65,7 +65,6 @@ #include "util/container.h" #include "util/dump_charclass.h" #include "util/graph_range.h" -#include "util/make_unique.h" #include #include @@ -364,7 +363,7 @@ makePrefix(const NGHolder &g, const unordered_map ®ions, assert(!next_enters.empty()); assert(!curr_exits.empty()); - unique_ptr prefix_ptr = ue2::make_unique(); + unique_ptr prefix_ptr = std::make_unique(); NGHolder &prefix = *prefix_ptr; deque lhs_verts; diff --git a/src/nfagraph/ng_util.cpp b/src/nfagraph/ng_util.cpp index 45ad7a3a..b1d39d2e 100644 --- a/src/nfagraph/ng_util.cpp +++ b/src/nfagraph/ng_util.cpp @@ -39,7 +39,6 @@ #include "parser/position.h" #include "util/graph_range.h" #include "util/graph_small_color_map.h" -#include "util/make_unique.h" #include "util/order_check.h" #include "util/ue2string.h" #include "util/report_manager.h" @@ -596,7 +595,7 @@ void cloneHolder(NGHolder &out, const NGHolder &in, } unique_ptr cloneHolder(const NGHolder &in) { - unique_ptr h = ue2::make_unique(); + unique_ptr h = std::make_unique(); cloneHolder(*h, in); return h; } diff --git a/src/nfagraph/ng_violet.cpp b/src/nfagraph/ng_violet.cpp index ceceb19c..4a5b492c 100644 --- a/src/nfagraph/ng_violet.cpp +++ b/src/nfagraph/ng_violet.cpp @@ -62,7 +62,6 @@ #include "util/graph_range.h" #include "util/graph_small_color_map.h" #include "util/insertion_ordered.h" -#include "util/make_unique.h" #include "util/order_check.h" #include "util/target_info.h" #include "util/ue2string.h" @@ -70,6 +69,7 @@ #include #include #include +#include #include #include @@ -375,7 +375,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored, DEBUG_PRINTF("candidate is a candidate\n"); scores[v] = score; - lit_info[v] = make_unique(v, s, anchored); + lit_info[v] = std::make_unique(v, s, anchored); } /* try to filter out cases where appending some characters produces worse @@ -531,7 +531,7 @@ void getRegionRoseLiterals(const NGHolder &g, bool seeking_anchored, } DEBUG_PRINTF("candidate is a candidate\n"); - lits->emplace_back(make_unique(vv, s, anchored)); + lits->emplace_back(std::make_unique(vv, s, anchored)); } } @@ -945,7 +945,7 @@ unique_ptr findSimplePrefixSplit(const NGHolder &g, sanitizeAndCompressAndScore(best_lit_set); } - return ue2::make_unique(best_v, best_lit_set, anchored, true); + return std::make_unique(best_v, best_lit_set, anchored, true); } static @@ -1835,7 +1835,7 @@ static unique_ptr make_chain(u32 count) { assert(count); - auto rv = make_unique(NFA_INFIX); + auto rv = std::make_unique(NFA_INFIX); NGHolder &h = *rv; diff --git a/src/parser/ComponentClass.cpp b/src/parser/ComponentClass.cpp index a91ae979..106c1dab 100644 --- a/src/parser/ComponentClass.cpp +++ b/src/parser/ComponentClass.cpp @@ -35,7 +35,6 @@ #include "ucp_table.h" #include "Utf8ComponentClass.h" #include "util/charreach.h" -#include "util/make_unique.h" #include @@ -399,9 +398,9 @@ CharReach getPredefinedCharReach(PredefinedClass c, const ParseMode &mode) { unique_ptr getComponentClass(const ParseMode &mode) { if (mode.utf8) { - return ue2::make_unique(mode); + return std::make_unique(mode); } else { - return ue2::make_unique(mode); + return std::make_unique(mode); } } diff --git a/src/parser/ComponentRepeat.cpp b/src/parser/ComponentRepeat.cpp index 984026f0..4bd51e1a 100644 --- a/src/parser/ComponentRepeat.cpp +++ b/src/parser/ComponentRepeat.cpp @@ -41,7 +41,6 @@ #include "position_dump.h" #include "position_info.h" #include "ue2common.h" -#include "util/make_unique.h" #include #include @@ -362,7 +361,7 @@ void ComponentRepeat::postSubNotePositionHook() { unique_ptr makeComponentRepeat(unique_ptr sub_comp, u32 min, u32 max, ComponentRepeat::RepeatType t) { - return ue2::make_unique(move(sub_comp), min, max, t); + return std::make_unique(move(sub_comp), min, max, t); } } // namespace ue2 diff --git a/src/parser/ComponentSequence.cpp b/src/parser/ComponentSequence.cpp index 7dbf61e8..fc82c11f 100644 --- a/src/parser/ComponentSequence.cpp +++ b/src/parser/ComponentSequence.cpp @@ -43,7 +43,6 @@ #include "position_info.h" #include "nfagraph/ng_builder.h" #include "util/container.h" -#include "util/make_unique.h" #include #include @@ -140,10 +139,10 @@ bool ComponentSequence::addRepeat(u32 min, u32 max, void ComponentSequence::addAlternation() { if (!alternation) { - alternation = ue2::make_unique(); + alternation = std::make_unique(); } - auto seq = ue2::make_unique(); + auto seq = std::make_unique(); seq->children.swap(children); alternation->append(move(seq)); } diff --git a/src/parser/Parser.rl b/src/parser/Parser.rl index 8643aebf..0fa76aca 100644 --- a/src/parser/Parser.rl +++ b/src/parser/Parser.rl @@ -54,7 +54,6 @@ #include "ue2common.h" #include "util/compare.h" #include "util/flat_containers.h" -#include "util/make_unique.h" #include "util/unicode_def.h" #include "util/verify_types.h" @@ -328,7 +327,7 @@ unichar readUtf8CodePoint4c(const char *s) { # enter a CAPTURING group ( e.g. '(blah)' ) action enterCapturingGroup { PUSH_SEQUENCE; - auto seq = ue2::make_unique(); + auto seq = std::make_unique(); seq->setCaptureIndex(groupIndex++); currentSeq = enterSequence(currentSeq, move(seq)); } @@ -344,7 +343,7 @@ unichar readUtf8CodePoint4c(const char *s) { throw LocatedParseError("Two named subpatterns use the name '" + label + "'"); } PUSH_SEQUENCE; - auto seq = ue2::make_unique(); + auto seq = std::make_unique(); seq->setCaptureIndex(groupIndex++); seq->setCaptureName(label); currentSeq = enterSequence(currentSeq, move(seq)); @@ -357,7 +356,7 @@ unichar readUtf8CodePoint4c(const char *s) { PUSH_SEQUENCE; mode = newMode; currentSeq = - enterSequence(currentSeq, ue2::make_unique()); + enterSequence(currentSeq, std::make_unique()); } action exitGroup { @@ -370,25 +369,25 @@ unichar readUtf8CodePoint4c(const char *s) { action enterZWLookAhead { PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(ComponentAssertion::LOOKAHEAD, + std::make_unique(ComponentAssertion::LOOKAHEAD, ComponentAssertion::POS)); } action enterZWNegLookAhead { PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(ComponentAssertion::LOOKAHEAD, + std::make_unique(ComponentAssertion::LOOKAHEAD, ComponentAssertion::NEG)); } action enterZWLookBehind { PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(ComponentAssertion::LOOKBEHIND, + std::make_unique(ComponentAssertion::LOOKBEHIND, ComponentAssertion::POS)); } action enterZWNegLookBehind { PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(ComponentAssertion::LOOKBEHIND, + std::make_unique(ComponentAssertion::LOOKBEHIND, ComponentAssertion::NEG)); } action enterEmbeddedCode { @@ -406,18 +405,18 @@ unichar readUtf8CodePoint4c(const char *s) { } PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(accumulator)); + std::make_unique(accumulator)); } action enterNamedConditionalRef { PUSH_SEQUENCE; assert(!label.empty()); currentSeq = enterSequence(currentSeq, - ue2::make_unique(label)); + std::make_unique(label)); } action enterAtomicGroup { PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique()); + std::make_unique()); } action eatClass { assert(!currentCls); @@ -433,7 +432,7 @@ unichar readUtf8CodePoint4c(const char *s) { } action applyModifiers { mode = newMode; - currentSeq->addComponent(ue2::make_unique()); + currentSeq->addComponent(std::make_unique()); } action modifyMatchPositive { switch (fc) { @@ -481,7 +480,7 @@ unichar readUtf8CodePoint4c(const char *s) { if (accumulator == 0) { throw LocatedParseError("Numbered reference cannot be zero"); } - currentSeq->addComponent(ue2::make_unique(accumulator)); + currentSeq->addComponent(std::make_unique(accumulator)); } action addNegativeNumberedBackRef { @@ -493,11 +492,11 @@ unichar readUtf8CodePoint4c(const char *s) { throw LocatedParseError("Invalid reference"); } unsigned idx = groupIndex - accumulator; - currentSeq->addComponent(ue2::make_unique(idx)); + currentSeq->addComponent(std::make_unique(idx)); } action addNamedBackRef { - currentSeq->addComponent(ue2::make_unique(label)); + currentSeq->addComponent(std::make_unique(label)); } escapedOctal0 = '\\0' @clearOctAccumulator [0-7]{0,2} $appendAccumulatorOctDigit; @@ -1305,7 +1304,7 @@ unichar readUtf8CodePoint4c(const char *s) { if (mode.utf8) { throw LocatedParseError("\\C is unsupported in UTF8"); } - currentSeq->addComponent(ue2::make_unique()); + currentSeq->addComponent(std::make_unique()); }; # Match 0 or more times (greedy) '\*' => { @@ -1422,39 +1421,39 @@ unichar readUtf8CodePoint4c(const char *s) { '\^' => { auto bound = mode.multiline ? ComponentBoundary::BEGIN_LINE : ComponentBoundary::BEGIN_STRING; - currentSeq->addComponent(ue2::make_unique(bound)); + currentSeq->addComponent(std::make_unique(bound)); }; # End of data (with optional internal newline); also before # internal newline in multiline mode '\$' => { auto bound = mode.multiline ? ComponentBoundary::END_LINE : ComponentBoundary::END_STRING_OPTIONAL_LF; - currentSeq->addComponent(ue2::make_unique(bound)); + currentSeq->addComponent(std::make_unique(bound)); }; # Beginning of data '\\A' => { auto bound = ComponentBoundary::BEGIN_STRING; - currentSeq->addComponent(ue2::make_unique(bound)); + currentSeq->addComponent(std::make_unique(bound)); }; # End of data (with optional internal newline) '\\Z' => { auto bound = ComponentBoundary::END_STRING_OPTIONAL_LF; - currentSeq->addComponent(ue2::make_unique(bound)); + currentSeq->addComponent(std::make_unique(bound)); }; # End of data '\\z' => { auto bound = ComponentBoundary::END_STRING; - currentSeq->addComponent(ue2::make_unique(bound)); + currentSeq->addComponent(std::make_unique(bound)); }; # Word boundary '\\b' => { currentSeq->addComponent( - ue2::make_unique(ts - ptr, false, mode)); + std::make_unique(ts - ptr, false, mode)); }; # Non-word boundary '\\B' => { currentSeq->addComponent( - ue2::make_unique(ts - ptr, true, mode)); + std::make_unique(ts - ptr, true, mode)); }; ############################################################# @@ -1494,7 +1493,7 @@ unichar readUtf8CodePoint4c(const char *s) { // a back reference accumulator = parseAsDecimal(octAccumulator); if (accumulator < groupIndex) { - currentSeq->addComponent(ue2::make_unique(accumulator)); + currentSeq->addComponent(std::make_unique(accumulator)); } else { addEscapedOctal(currentSeq, octAccumulator, mode); } @@ -1509,7 +1508,7 @@ unichar readUtf8CodePoint4c(const char *s) { '\\' backRefId => { // if there are enough left parens to this point, back ref if (accumulator < groupIndex) { - currentSeq->addComponent(ue2::make_unique(accumulator)); + currentSeq->addComponent(std::make_unique(accumulator)); } else { // Otherwise, we interpret the first three digits as an // octal escape, and the remaining characters stand for @@ -1731,7 +1730,7 @@ unichar readUtf8CodePoint4c(const char *s) { }; '\\X' => { - currentSeq->addComponent(ue2::make_unique(ts - ptr, mode)); + currentSeq->addComponent(std::make_unique(ts - ptr, mode)); }; # Fall through general escaped character @@ -1782,45 +1781,45 @@ unichar readUtf8CodePoint4c(const char *s) { # Conditional reference with a positive lookahead assertion '(?(?=' => { - auto a = ue2::make_unique( + auto a = std::make_unique( ComponentAssertion::LOOKAHEAD, ComponentAssertion::POS); ComponentAssertion *a_seq = a.get(); PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(move(a))); + std::make_unique(move(a))); PUSH_SEQUENCE; currentSeq = a_seq; }; # Conditional reference with a negative lookahead assertion '(?(?!' => { - auto a = ue2::make_unique( + auto a = std::make_unique( ComponentAssertion::LOOKAHEAD, ComponentAssertion::NEG); ComponentAssertion *a_seq = a.get(); PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(move(a))); + std::make_unique(move(a))); PUSH_SEQUENCE; currentSeq = a_seq; }; # Conditional reference with a positive lookbehind assertion '(?(?<=' => { - auto a = ue2::make_unique( + auto a = std::make_unique( ComponentAssertion::LOOKBEHIND, ComponentAssertion::POS); ComponentAssertion *a_seq = a.get(); PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(move(a))); + std::make_unique(move(a))); PUSH_SEQUENCE; currentSeq = a_seq; }; # Conditional reference with a negative lookbehind assertion '(?(? { - auto a = ue2::make_unique( + auto a = std::make_unique( ComponentAssertion::LOOKBEHIND, ComponentAssertion::NEG); ComponentAssertion *a_seq = a.get(); PUSH_SEQUENCE; currentSeq = enterSequence(currentSeq, - ue2::make_unique(move(a))); + std::make_unique(move(a))); PUSH_SEQUENCE; currentSeq = a_seq; }; @@ -1953,7 +1952,7 @@ unique_ptr parse(const char *ptr, ParseMode &globalMode) { flat_set groupNames; // Root sequence. - unique_ptr rootSeq = ue2::make_unique(); + unique_ptr rootSeq = std::make_unique(); rootSeq->setCaptureIndex(0); // Current sequence being appended to diff --git a/src/parser/buildstate.cpp b/src/parser/buildstate.cpp index 3a2bb7d9..96f91cb6 100644 --- a/src/parser/buildstate.cpp +++ b/src/parser/buildstate.cpp @@ -41,7 +41,6 @@ #include "util/container.h" #include "util/flat_containers.h" #include "util/hash.h" -#include "util/make_unique.h" #include "util/unordered.h" #include @@ -441,7 +440,7 @@ void GlushkovBuildStateImpl::buildEdges() { // Construct a usable GlushkovBuildState for the outside world. unique_ptr makeGlushkovBuildState(NFABuilder &b, bool prefilter) { - return ue2::make_unique(b, prefilter); + return std::make_unique(b, prefilter); } // free functions for utility use diff --git a/src/rose/rose_build_add.cpp b/src/rose/rose_build_add.cpp index 357fbb84..dc9ee308 100644 --- a/src/rose/rose_build_add.cpp +++ b/src/rose/rose_build_add.cpp @@ -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(haig))); + outfixes.emplace_back(OutfixInfo(std::make_unique(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(MpvProto()); + mpv_outfix = std::make_unique(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(MpvProto()); + mpv_outfix = std::make_unique(MpvProto()); } auto *mpv = mpv_outfix->mpv(); diff --git a/src/rose/rose_build_add_mask.cpp b/src/rose/rose_build_add_mask.cpp index a0b7ecd9..c3736f62 100644 --- a/src/rose/rose_build_add_mask.cpp +++ b/src/rose/rose_build_add_mask.cpp @@ -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 buildMaskLhs(bool anchored, u32 prefix_len, DEBUG_PRINTF("build %slhs len %u/%zu\n", anchored ? "anc " : "", prefix_len, mask.size()); - unique_ptr lhs = ue2::make_unique(NFA_PREFIX); + unique_ptr lhs = std::make_unique(NFA_PREFIX); assert(prefix_len); assert(mask.size() >= prefix_len); @@ -568,7 +567,7 @@ unique_ptr buildMaskRhs(const flat_set &reports, assert(suffix_len); assert(mask.size() > suffix_len); - unique_ptr rhs = ue2::make_unique(NFA_SUFFIX); + unique_ptr rhs = std::make_unique(NFA_SUFFIX); NGHolder &h = *rhs; NFAVertex succ = h.accept; @@ -751,7 +750,7 @@ static unique_ptr makeAnchoredGraph(const vector &mask, const flat_set &reports, bool eod) { - auto gp = ue2::make_unique(); + auto gp = std::make_unique(); NGHolder &g = *gp; NFAVertex u = g.start; diff --git a/src/rose/rose_build_anchored.cpp b/src/rose/rose_build_anchored.cpp index fd0cfcbd..862740e4 100644 --- a/src/rose/rose_build_anchored.cpp +++ b/src/rose/rose_build_anchored.cpp @@ -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(NFA_OUTFIX_RAW); + auto out_dfa = std::make_unique(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 &frag_map, } auto h = populate_holder(simple.first, exit_ids); Automaton_Holder autom(*h); - auto rdfa = ue2::make_unique(NFA_OUTFIX_RAW); + auto rdfa = std::make_unique(NFA_OUTFIX_RAW); UNUSED bool rv = determinise(autom, rdfa->states, MAX_DFA_STATES); assert(rv); rdfa->start_anchored = INIT_STATE; diff --git a/src/rose/rose_build_bytecode.cpp b/src/rose/rose_build_bytecode.cpp index ec9d5d17..fb2d50a5 100644 --- a/src/rose/rose_build_bytecode.cpp +++ b/src/rose/rose_build_bytecode.cpp @@ -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 constructTamaInfo(const RoseGraph &g, const vector &subengines, const bool is_suffix) { - unique_ptr tamaInfo = ue2::make_unique(); + unique_ptr tamaInfo = std::make_unique(); for (const auto &sub : subengines) { const auto &rose_vertices = sub.vertices; NFA *nfa = sub.nfa.get(); diff --git a/src/rose/rose_build_convert.cpp b/src/rose/rose_build_convert.cpp index 37234520..b8d0a09b 100644 --- a/src/rose/rose_build_convert.cpp +++ b/src/rose/rose_build_convert.cpp @@ -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 makeFloodProneSuffix(const ue2_literal &s, size_t len, assert(len < s.length()); assert(!reports.empty()); - unique_ptr h = ue2::make_unique(NFA_SUFFIX); + unique_ptr h = std::make_unique(NFA_SUFFIX); NFAVertex u = h->start; for (auto it = s.begin() + s.length() - len; it != s.end(); ++it) { @@ -114,7 +113,7 @@ unique_ptr makeFloodProneSuffix(const ue2_literal &s, size_t len, static unique_ptr makeRosePrefix(const ue2_literal &s) { - unique_ptr h = ue2::make_unique(NFA_PREFIX); + unique_ptr h = std::make_unique(NFA_PREFIX); NFAVertex u = h->startDs; for (const auto &c : s) { diff --git a/src/rose/rose_build_dedupe.cpp b/src/rose/rose_build_dedupe.cpp index d56a1d4f..0a19480a 100644 --- a/src/rose/rose_build_dedupe.cpp +++ b/src/rose/rose_build_dedupe.cpp @@ -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 RoseBuildImpl::generateDedupeAux() const { - return ue2::make_unique(*this); + return std::make_unique(*this); } RoseDedupeAux::~RoseDedupeAux() = default; diff --git a/src/rose/rose_build_exclusive.cpp b/src/rose/rose_build_exclusive.cpp index 8a1f3f94..bc9b1558 100644 --- a/src/rose/rose_build_exclusive.cpp +++ b/src/rose/rose_build_exclusive.cpp @@ -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> &exclusiveGroups, } // Construct the exclusivity graph map vertex_map; - unique_ptr cg = make_unique(); + unique_ptr cg = std::make_unique(); // Add vertices representing infixes/suffixes for (const auto &e : exclusiveGroups) { diff --git a/src/rose/rose_build_matchers.cpp b/src/rose/rose_build_matchers.cpp index 819787da..ba141d35 100644 --- a/src/rose/rose_build_matchers.cpp +++ b/src/rose/rose_build_matchers.cpp @@ -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(move(proto), mp.accel_lits); + return std::make_unique(move(proto), mp.accel_lits); } unique_ptr @@ -965,7 +964,7 @@ buildDelayRebuildMatcherProto(const RoseBuildImpl &build, throw CompileError("Unable to generate literal matcher proto."); } - return ue2::make_unique(move(proto), mp.accel_lits); + return std::make_unique(move(proto), mp.accel_lits); } unique_ptr @@ -1022,7 +1021,7 @@ buildSmallBlockMatcherProto(const RoseBuildImpl &build, throw CompileError("Unable to generate literal matcher proto."); } - return ue2::make_unique(move(proto), mp.accel_lits); + return std::make_unique(move(proto), mp.accel_lits); } unique_ptr @@ -1047,7 +1046,7 @@ buildEodAnchoredMatcherProto(const RoseBuildImpl &build, throw CompileError("Unable to generate literal matcher proto."); } - return ue2::make_unique(move(proto), mp.accel_lits); + return std::make_unique(move(proto), mp.accel_lits); } } // namespace ue2 diff --git a/src/rose/rose_build_misc.cpp b/src/rose/rose_build_misc.cpp index f2f80ec5..d3ff236d 100644 --- a/src/rose/rose_build_misc.cpp +++ b/src/rose/rose_build_misc.cpp @@ -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 makeRoseBuilder(ReportManager &rm, SmallWriteBuild &smwr, const CompileContext &cc, const BoundaryReports &boundary) { - return ue2::make_unique(rm, ssm, smwr, cc, boundary); + return std::make_unique(rm, ssm, smwr, cc, boundary); } bool roseIsPureLiteral(const RoseEngine *t) { diff --git a/src/rose/rose_build_program.cpp b/src/rose/rose_build_program.cpp index 46a19e71..3ddf2fcd 100644 --- a/src/rose/rose_build_program.cpp +++ b/src/rose/rose_build_program.cpp @@ -95,7 +95,7 @@ OffsetMap makeOffsetMap(const RoseProgram &program, u32 *total_len) { } RoseProgram::RoseProgram() { - prog.emplace_back(make_unique()); + prog.emplace_back(std::make_unique()); } RoseProgram::~RoseProgram() = default; @@ -297,28 +297,28 @@ void addEnginesEodProgram(u32 eodNfaIterOffset, RoseProgram &program) { } RoseProgram block; - block.add_before_end(make_unique(eodNfaIterOffset)); + block.add_before_end(std::make_unique(eodNfaIterOffset)); program.add_block(move(block)); } void addSuffixesEodProgram(RoseProgram &program) { RoseProgram block; - block.add_before_end(make_unique()); + block.add_before_end(std::make_unique()); program.add_block(move(block)); } void addMatcherEodProgram(RoseProgram &program) { RoseProgram block; - block.add_before_end(make_unique()); + block.add_before_end(std::make_unique()); program.add_block(move(block)); } void addFlushCombinationProgram(RoseProgram &program) { - program.add_before_end(make_unique()); + program.add_before_end(std::make_unique()); } void addLastFlushCombinationProgram(RoseProgram &program) { - program.add_before_end(make_unique()); + program.add_before_end(std::make_unique()); } static @@ -342,11 +342,11 @@ void makeRoleCheckLeftfix(const RoseBuildImpl &build, unique_ptr ri; if (is_prefix) { - ri = make_unique(lni.queue, build.g[v].left.lag, + ri = std::make_unique(lni.queue, build.g[v].left.lag, build.g[v].left.leftfix_report, end_inst); } else { - ri = make_unique(lni.queue, build.g[v].left.lag, + ri = std::make_unique(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(groups, anch_id, end_inst); + auto ri = std::make_unique(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(report.quashSom, rm.getDkey(report), + std::make_unique(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(report.quashSom, + auto ri = std::make_unique(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()); + program.add_before_end(std::make_unique()); } static @@ -511,12 +511,12 @@ void addLogicalSetRequired(const Report &report, ReportManager &rm, return; } // set matching status of current lkey - auto risl = make_unique(report.lkey, + auto risl = std::make_unique(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(ckey); + auto risc = std::make_unique(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(report.minOffset, + auto ri = std::make_unique(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(report.ekey, end_inst); + auto ri = std::make_unique(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(); + auto ri = std::make_unique(); 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( + auto ri = std::make_unique( report.offsetAdjust, report.minLength, end_inst); report_block.add_before_end(move(ri)); } if (report.quashSom) { - report_block.add_before_end(make_unique()); + report_block.add_before_end(std::make_unique()); } 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( + std::make_unique( 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( + std::make_unique( 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( + std::make_unique( report.onmatch, report.offsetAdjust, report.ekey)); } else { report_block.add_before_end( - make_unique(report.ekey)); + std::make_unique(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( + report_block.add_before_end(std::make_unique( report.onmatch, report.offsetAdjust)); } } else { if (!report.quiet) { report_block.add_before_end( - make_unique( + std::make_unique( report.onmatch, report.offsetAdjust, report.ekey)); } else { report_block.add_before_end( - make_unique(report.ekey)); + std::make_unique(report.ekey)); } } } @@ -639,17 +639,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, addFlushCombinationProgram(report_block); } if (has_som) { - auto ri = make_unique(); + auto ri = std::make_unique(); writeSomOperation(report, &ri->som); report_block.add_before_end(move(ri)); } else { - auto ri = make_unique(); + auto ri = std::make_unique(); writeSomOperation(report, &ri->som); report_block.add_before_end(move(ri)); } break; case INTERNAL_ROSE_CHAIN: { - report_block.add_before_end(make_unique( + report_block.add_before_end(std::make_unique( 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( + report_block.add_before_end(std::make_unique( report.onmatch, report.offsetAdjust)); } } else { if (!report.quiet) { report_block.add_before_end( - make_unique( + std::make_unique( report.onmatch, report.offsetAdjust, report.ekey)); } else { report_block.add_before_end( - make_unique(report.ekey)); + std::make_unique(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( + report_block.add_before_end(std::make_unique( report.onmatch, report.offsetAdjust)); } } else { if (!report.quiet) { report_block.add_before_end( - make_unique( + std::make_unique( report.onmatch, report.offsetAdjust, report.ekey)); } else { report_block.add_before_end( - make_unique(report.ekey)); + std::make_unique(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(lni.queue, g[v].left.lag)); + std::make_unique(lni.queue, g[v].left.lag)); report_som = true; } else if (g[v].som_adjust) { program.add_before_end( - make_unique(g[v].som_adjust)); + std::make_unique(g[v].som_adjust)); report_som = true; } @@ -748,7 +748,7 @@ void makeRoleSetState(const unordered_map &roleStateIndices, if (it == end(roleStateIndices)) { return; } - program.add_before_end(make_unique(it->second)); + program.add_before_end(std::make_unique(it->second)); } static @@ -772,7 +772,7 @@ void makePushDelayedInstructions(const RoseLiteralMap &literals, }); for (const auto &ri : delay_instructions) { - program.add_before_end(make_unique(ri)); + program.add_before_end(std::make_unique(ri)); } } @@ -801,10 +801,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit, const auto *end_inst = program.end_instruction(); unique_ptr ri; if (lit.s.any_nocase()) { - ri = make_unique(lit.s.get_string(), + ri = std::make_unique(lit.s.get_string(), end_inst); } else { - ri = make_unique(lit.s.get_string(), + ri = std::make_unique(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 ri; if (lit.s.any_nocase()) { - ri = make_unique(lit.s.get_string(), + ri = std::make_unique(lit.s.get_string(), end_inst); } else { - ri = make_unique(lit.s.get_string(), end_inst); + ri = std::make_unique(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(handled_key, end_inst); + auto ri = std::make_unique(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(min_bound, max_bound, end_inst)); + std::make_unique(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(groups)); + program.add_before_end(std::make_unique(groups)); } static @@ -968,7 +968,7 @@ bool makeRoleByte(const vector &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(andmask_u8, cmpmask_u8, flip, + auto ri = std::make_unique(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 &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(and_mask, cmp_mask, neg_mask, + auto ri = std::make_unique(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 &look, DEBUG_PRINTF("base_offset %d\n", base_offset); const auto *end_inst = program.end_instruction(); - auto ri = make_unique(and_mask, cmp_mask, neg_mask, + auto ri = std::make_unique(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 &look, DEBUG_PRINTF("base_offset %d\n", base_offset); const auto *end_inst = program.end_instruction(); - auto ri = make_unique(and_mask, cmp_mask, neg_mask, + auto ri = std::make_unique(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 + return std::make_unique (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 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 + return std::make_unique (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 + return std::make_unique (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 + return std::make_unique (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 + return std::make_unique (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 + return std::make_unique (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 &look, if (look.size() == 1) { s8 offset = look.begin()->offset; const CharReach &reach = look.begin()->reach; - auto ri = make_unique(offset, reach, + auto ri = std::make_unique(offset, reach, program.end_instruction()); program.add_before_end(move(ri)); return; @@ -1508,7 +1508,7 @@ void makeLookaroundInstruction(const vector &look, return; } - auto ri = make_unique(look, + auto ri = std::make_unique(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(min_offset, end)); + prog.add_before_end(std::make_unique(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(info.group_mask)); + prog.add_before_end(std::make_unique(info.group_mask)); } static @@ -1762,7 +1762,7 @@ bool makeRoleMultipathShufti(const vector> &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 + auto ri = std::make_unique (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> &multi_look, assert(!(hi_bits_mask & ~0xffffffffULL)); assert(!(lo_bits_mask & ~0xffffffffULL)); if (bit_index <= 8) { - auto ri = make_unique + auto ri = std::make_unique (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 + auto ri = std::make_unique (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 + auto ri = std::make_unique (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> &multi_look, ordered_look.emplace_back(multi_entry); } - auto ri = make_unique(move(ordered_look), + auto ri = std::make_unique(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(queue, event)); + prog.add_before_end(std::make_unique(queue, event)); } static @@ -1945,7 +1945,7 @@ void addInfixTriggerInstructions(vector triggers, }); for (const auto &ti : triggers) { prog.add_before_end( - make_unique(ti.cancel, ti.queue, ti.event)); + std::make_unique(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(end_inst)); + prog.add_before_end(std::make_unique(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(~info.group_mask)); + prog.add_before_end(std::make_unique(~info.group_mask)); } namespace { @@ -2209,7 +2209,7 @@ RoseProgram assembleProgramBlocks(vector &&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()); + clear_block.add_before_end(std::make_unique()); 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()); + program.add_before_end(std::make_unique()); } 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(child_offset, + block.add_before_end(std::make_unique(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(pred_state, end_inst)); + std::make_unique(pred_state, end_inst)); program.add_block(move(pred_block)); } @@ -2428,7 +2428,7 @@ void addPredBlocksAny(map &pred_blocks, u32 num_states, } const RoseInstruction *end_inst = sparse_program.end_instruction(); - auto ri = make_unique(num_states, keys, end_inst); + auto ri = std::make_unique(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 &pred_blocks, vector> jump_table; // BEGIN instruction. - auto ri_begin = make_unique(num_states, end_inst); + auto ri_begin = std::make_unique(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(prev_key, begin_inst, + auto ri = std::make_unique(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(it->get())) { DEBUG_PRINTF("replacing REPORT with FINAL_REPORT\n"); - program.replace(it, make_unique( + program.replace(it, std::make_unique( ri->onmatch, ri->offset_adjust)); } } diff --git a/src/rose/rose_build_program.h b/src/rose/rose_build_program.h index 7d781f31..6ad5529c 100644 --- a/src/rose/rose_build_program.h +++ b/src/rose/rose_build_program.h @@ -33,7 +33,6 @@ #include "rose_program.h" #include "util/bytecode_ptr.h" #include "util/hash.h" -#include "util/make_unique.h" #include #include diff --git a/src/rose/rose_in_util.cpp b/src/rose/rose_in_util.cpp index 9fe47c27..c2628082 100644 --- a/src/rose/rose_in_util.cpp +++ b/src/rose/rose_in_util.cpp @@ -35,7 +35,6 @@ #include "nfagraph/ng_width.h" #include "util/container.h" #include "util/graph_range.h" -#include "util/make_unique.h" #include @@ -93,7 +92,7 @@ private: unique_ptr cloneRoseGraph(const RoseInGraph &ig) { assert(hasCorrectlyNumberedVertices(ig)); - unique_ptr out = make_unique(); + unique_ptr out = std::make_unique(); unordered_map> graph_map; unordered_map> haig_map; diff --git a/src/smallwrite/smallwrite_build.cpp b/src/smallwrite/smallwrite_build.cpp index 26291f44..5dad4704 100644 --- a/src/smallwrite/smallwrite_build.cpp +++ b/src/smallwrite/smallwrite_build.cpp @@ -56,7 +56,6 @@ #include "util/compare.h" #include "util/compile_context.h" #include "util/container.h" -#include "util/make_unique.h" #include "util/ue2_graph.h" #include "util/ue2string.h" #include "util/verify_types.h" @@ -862,7 +861,7 @@ bytecode_ptr prepEngine(raw_dfa &rdfa, u32 roseQuality, unique_ptr makeSmallWriteBuilder(size_t num_patterns, const ReportManager &rm, const CompileContext &cc) { - return ue2::make_unique(num_patterns, rm, cc); + return std::make_unique(num_patterns, rm, cc); } bytecode_ptr SmallWriteBuildImpl::build(u32 roseQuality) { diff --git a/src/som/slot_manager.cpp b/src/som/slot_manager.cpp index c81d055f..9984d836 100644 --- a/src/som/slot_manager.cpp +++ b/src/som/slot_manager.cpp @@ -41,7 +41,6 @@ #include "nfagraph/ng_region.h" #include "util/charreach.h" #include "util/hash.h" -#include "util/make_unique.h" #include "util/dump_charclass.h" #include "util/verify_types.h" @@ -105,7 +104,7 @@ const SlotCacheEntry *SlotCache::find(const NGHolder &prefix, } SomSlotManager::SomSlotManager(u8 p) - : nextSomSlot(0), cache(ue2::make_unique()), historyRequired(0), + : nextSomSlot(0), cache(std::make_unique()), historyRequired(0), precision(p) {} SomSlotManager::~SomSlotManager() { } diff --git a/src/util/clique.cpp b/src/util/clique.cpp index 33a3e119..a8195d0c 100644 --- a/src/util/clique.cpp +++ b/src/util/clique.cpp @@ -33,7 +33,6 @@ #include "clique.h" #include "container.h" #include "graph_range.h" -#include "make_unique.h" #include #include diff --git a/src/util/make_unique.h b/src/util/make_unique.h deleted file mode 100644 index 651e8c5c..00000000 --- a/src/util/make_unique.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2015-2017, Intel Corporation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of Intel Corporation nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef UTIL_MAKE_UNIQUE_H -#define UTIL_MAKE_UNIQUE_H - -#if (defined(_WIN32) || defined(_WIN64)) && (_MSC_VER > 1700) -// VC++ 2013 onwards has make_unique in the STL -#define USE_STD -#include -#else -#include -#endif - -namespace ue2 { -#if defined(USE_STD) -using std::make_unique; -#else -using boost::make_unique; -#endif -} - -#undef USE_STD -#endif // UTIL_MAKE_UNIQUE_H diff --git a/tools/hsbench/engine_chimera.cpp b/tools/hsbench/engine_chimera.cpp index 24a99d61..b310c214 100644 --- a/tools/hsbench/engine_chimera.cpp +++ b/tools/hsbench/engine_chimera.cpp @@ -38,8 +38,6 @@ #include "chimera/ch_database.h" -#include "util/make_unique.h" - using namespace std; EngineCHContext::EngineCHContext(const ch_database_t *db) { @@ -105,7 +103,7 @@ EngineChimera::~EngineChimera() { } unique_ptr EngineChimera::makeContext() const { - return ue2::make_unique(db); + return std::make_unique(db); } void EngineChimera::scan(const char *data, unsigned int len, unsigned int id, @@ -333,5 +331,5 @@ buildEngineChimera(const ExpressionMap &expressions, const string &name, cs.compileSecs = compileSecs; cs.peakMemorySize = peakMemorySize; - return ue2::make_unique(db, move(cs)); + return std::make_unique(db, move(cs)); } diff --git a/tools/hsbench/engine_hyperscan.cpp b/tools/hsbench/engine_hyperscan.cpp index c94b42af..4898c0bf 100644 --- a/tools/hsbench/engine_hyperscan.cpp +++ b/tools/hsbench/engine_hyperscan.cpp @@ -42,7 +42,6 @@ #include "hs_internal.h" #include "hs_runtime.h" #include "util/database_util.h" -#include "util/make_unique.h" #include #include @@ -126,7 +125,7 @@ EngineHyperscan::~EngineHyperscan() { } unique_ptr EngineHyperscan::makeContext() const { - return ue2::make_unique(db); + return std::make_unique(db); } void EngineHyperscan::scan(const char *data, unsigned int len, unsigned int id, @@ -166,7 +165,7 @@ void EngineHyperscan::scan_vectored(const char *const *data, unique_ptr EngineHyperscan::streamOpen(EngineContext &ectx, unsigned streamId) const { EngineHSContext &ctx = static_cast(ectx); - auto stream = ue2::make_unique(); + auto stream = std::make_unique(); stream->ctx = &ctx; hs_open_stream(db, 0, &stream->id); @@ -549,5 +548,5 @@ buildEngineHyperscan(const ExpressionMap &expressions, ScanMode scan_mode, cs.compileSecs = compileSecs; cs.peakMemorySize = peakMemorySize; - return ue2::make_unique(db, std::move(cs)); + return std::make_unique(db, std::move(cs)); } diff --git a/tools/hsbench/engine_pcre.cpp b/tools/hsbench/engine_pcre.cpp index 23ab9d17..f2ad303d 100644 --- a/tools/hsbench/engine_pcre.cpp +++ b/tools/hsbench/engine_pcre.cpp @@ -38,7 +38,6 @@ #include "sqldb.h" #include "timer.h" -#include "util/make_unique.h" #include "util/unicode_def.h" #include @@ -105,7 +104,7 @@ EnginePCRE::~EnginePCRE() { } unique_ptr EnginePCRE::makeContext() const { - return ue2::make_unique(capture_cnt); + return std::make_unique(capture_cnt); } void EnginePCRE::scan(const char *data, unsigned int len, unsigned int id, @@ -322,7 +321,7 @@ buildEnginePcre(const ExpressionMap &expressions, const string &name, for (const auto &m : expressions) { string expr(m.second); unsigned int flags = 0; - auto pcreDB = ue2::make_unique(); + auto pcreDB = std::make_unique(); if (!decodeExprPCRE(expr, &flags, *pcreDB)) { printf("Error parsing PCRE: %s (id %u)\n", m.second.c_str(), m.first); @@ -406,5 +405,5 @@ buildEnginePcre(const ExpressionMap &expressions, const string &name, cs.compileSecs = compileSecs; cs.peakMemorySize = peakMemorySize; - return ue2::make_unique(move(dbs), move(cs), capture_cnt); + return std::make_unique(move(dbs), move(cs), capture_cnt); } diff --git a/tools/hsbench/main.cpp b/tools/hsbench/main.cpp index 1c91813b..45db8a61 100644 --- a/tools/hsbench/main.cpp +++ b/tools/hsbench/main.cpp @@ -45,7 +45,6 @@ #include "grey.h" #include "hs.h" #include "ue2common.h" -#include "util/make_unique.h" #include #include @@ -979,7 +978,7 @@ unique_ptr makeThreadContext(const Engine &db, } assert(fn); - return ue2::make_unique(id, db, sync_barrier, fn, blocks); + return std::make_unique(id, db, sync_barrier, fn, blocks); } /** Run the given benchmark. */ diff --git a/tools/hscheck/main.cpp b/tools/hscheck/main.cpp index 197087bb..0b44b3a2 100644 --- a/tools/hscheck/main.cpp +++ b/tools/hscheck/main.cpp @@ -52,7 +52,6 @@ #include "expressions.h" #include "string_util.h" #include "util/expression_path.h" -#include "util/make_unique.h" #include "grey.h" #include "hs_compile.h" @@ -664,7 +663,7 @@ int HS_CDECL main(int argc, char **argv) { num_of_threads = max(1u, std::thread::hardware_concurrency()); #if !defined(RELEASE_BUILD) - g_grey = make_unique(); + g_grey = std::make_unique(); #endif processArgs(argc, argv, g_grey); diff --git a/tools/hscollider/GraphTruth.cpp b/tools/hscollider/GraphTruth.cpp index 0b67b11c..6069ff5c 100644 --- a/tools/hscollider/GraphTruth.cpp +++ b/tools/hscollider/GraphTruth.cpp @@ -50,7 +50,6 @@ #include "parser/unsupported.h" #include "parser/logical_combination.h" #include "util/compile_context.h" -#include "util/make_unique.h" #include "util/report_manager.h" #include @@ -131,7 +130,7 @@ void CNGInfo::compile() { try { if (combination) { - auto pl = ue2::make_unique(); + auto pl = std::make_unique(); pl->parseLogicalCombination(id, re.c_str(), ~0U, 0, ~0ULL); pl->logicalKeyRenumber(); cng = make_unique(move(pl)); @@ -148,7 +147,7 @@ void CNGInfo::compile() { // original expression starts with (*UTF8) utf8 |= pe.expr.utf8; - auto rm = ue2::make_unique(cc.grey); + auto rm = std::make_unique(cc.grey); // Expressions containing zero-width assertions and other extended pcre // types aren't supported yet. This call will throw a ParseError diff --git a/tools/hscollider/GroundTruth.cpp b/tools/hscollider/GroundTruth.cpp index a2673063..11ff40e3 100644 --- a/tools/hscollider/GroundTruth.cpp +++ b/tools/hscollider/GroundTruth.cpp @@ -42,7 +42,6 @@ #include "parser/control_verbs.h" #include "parser/Parser.h" #include "parser/parse_error.h" -#include "util/make_unique.h" #include "util/string_util.h" #include "util/unicode_def.h" #include "util/unordered.h" @@ -331,7 +330,7 @@ GroundTruth::compile(unsigned id, bool no_callouts) { int errloc = 0; int errcode = 0; - unique_ptr compiled = make_unique(); + unique_ptr compiled = std::make_unique(); compiled->utf8 = flags & PCRE_UTF8; compiled->highlander = highlander; compiled->prefilter = prefilter; diff --git a/tools/hscollider/UltimateTruth.cpp b/tools/hscollider/UltimateTruth.cpp index 038fbf77..c448b780 100644 --- a/tools/hscollider/UltimateTruth.cpp +++ b/tools/hscollider/UltimateTruth.cpp @@ -39,7 +39,6 @@ #include "crc32.h" #include "hs.h" #include "hs_internal.h" -#include "util/make_unique.h" #include "scratch.h" #include "nfa/nfa_api_queue.h" @@ -948,7 +947,7 @@ compileHyperscan(vector &patterns, vector &flags, return nullptr; } - return ue2::make_unique(db, idsvec.begin(), idsvec.end()); + return std::make_unique(db, idsvec.begin(), idsvec.end()); } #ifdef HS_HYBRID @@ -970,7 +969,7 @@ compileHybrid(vector &patterns, return nullptr; } - return ue2::make_unique(db, idsvec.begin(), idsvec.end()); + return std::make_unique(db, idsvec.begin(), idsvec.end()); } #endif diff --git a/tools/hscollider/main.cpp b/tools/hscollider/main.cpp index afa6ef5a..f6ef1d43 100644 --- a/tools/hscollider/main.cpp +++ b/tools/hscollider/main.cpp @@ -52,7 +52,6 @@ #include "parser/utf8_validate.h" #include "ue2common.h" #include "util/container.h" -#include "util/make_unique.h" #include #include @@ -1077,7 +1076,7 @@ void addCorporaToQueue(ostream &out, BoundedQueue &testq, unsigned id, size_t corpus_id = 0; for (const Corpus &corpus : c) { - tests.push_back(ue2::make_unique(id, corpus_id, corpus, cpcre, + tests.push_back(std::make_unique(id, corpus_id, corpus, cpcre, cngi, ue2, multi, utf8, highlander, prefilter, som)); corpus_id++; @@ -1435,7 +1434,7 @@ unique_ptr makeCorpusGenUnit(unsigned id, TestSummary &summary, // Caller may already have set the UTF-8 property (in multi cases) utf8 |= cpcre ? cpcre->utf8 : cngi->utf8; - return ue2::make_unique(move(cngi), move(cpcre), ue2, id, + return std::make_unique(move(cngi), move(cpcre), ue2, id, multi, utf8); } @@ -1824,7 +1823,7 @@ static unique_ptr buildCorpora(const vector &corporaFiles, const ExpressionMap &exprMap) { if (!corporaFiles.empty()) { - auto c = ue2::make_unique(); + auto c = std::make_unique(); for (const auto &file : corporaFiles) { if (!c->readFile(file)) { cout << "Error reading corpora from file: " << file << endl; @@ -1833,7 +1832,7 @@ unique_ptr buildCorpora(const vector &corporaFiles, } return move(c); /* move allows unique_ptr conversion */ } else { - auto c = ue2::make_unique( + auto c = std::make_unique( exprMap, corpus_gen_prop, force_utf8, force_prefilter); return move(c); } @@ -1886,7 +1885,7 @@ bool runTests(CorporaSource &corpora_source, const ExpressionMap &exprMap, // Start scanning threads. vector> scanners; for (size_t i = 0; i < numScannerThreads; i++) { - auto s = ue2::make_unique(i, testq, exprMap, plat, grey); + auto s = std::make_unique(i, testq, exprMap, plat, grey); s->start(); scanners.push_back(move(s)); } @@ -1989,7 +1988,7 @@ int HS_CDECL main(int argc, char *argv[]) { // If we're saving corpora out, truncate the output file. if (saveCorpora) { - corporaOut = ue2::make_unique(saveCorporaFile); + corporaOut = std::make_unique(saveCorporaFile); } GroundTruth::global_prep(); diff --git a/unit/internal/multi_bit.cpp b/unit/internal/multi_bit.cpp index 2b0c7c79..c7632d3a 100644 --- a/unit/internal/multi_bit.cpp +++ b/unit/internal/multi_bit.cpp @@ -32,7 +32,6 @@ #include "ue2common.h" #include "rose/rose_build_scatter.h" #include "util/compile_error.h" -#include "util/make_unique.h" #include "util/multibit.h" #include "util/multibit_build.h" @@ -49,10 +48,10 @@ class mmbit_holder { public: mmbit_holder() {} explicit mmbit_holder(u32 num_bits, u32 excess = 0) - : data(ue2::make_unique(mmbit_size(num_bits) + 7 + excess)) {} + : data(std::make_unique(mmbit_size(num_bits) + 7 + excess)) {} void init(u32 num_bits) { assert(!data); - data = ue2::make_unique(mmbit_size(num_bits) + 7); + data = std::make_unique(mmbit_size(num_bits) + 7); } operator u8 *() { assert(data); @@ -727,7 +726,7 @@ TEST_P(MultiBitTest, InitRangeChunked) { } static -void apply(const scatter_plan_raw &sp, u8 *out) { +void applyMB(const scatter_plan_raw &sp, u8 *out) { for (const auto &e : sp.p_u64a) { memcpy(out + e.offset, &e.val, sizeof(e.val)); } @@ -761,7 +760,7 @@ TEST_P(MultiBitTest, InitRangePlanChunked) { scatter_plan_raw sp; mmbBuildInitRangePlan(test_size, chunk_begin, chunk_end, &sp); memset(ba, 0xaa, mmbit_size(test_size)); - apply(sp, ba); + applyMB(sp, ba); // First bit set should be chunk_begin. ASSERT_EQ(chunk_begin, mmbit_iterate(ba, test_size, MMB_INVALID)); diff --git a/unit/internal/multi_bit_compress.cpp b/unit/internal/multi_bit_compress.cpp index d7396b81..2d59ea14 100644 --- a/unit/internal/multi_bit_compress.cpp +++ b/unit/internal/multi_bit_compress.cpp @@ -31,7 +31,6 @@ #include "gtest/gtest.h" #include "ue2common.h" #include "util/compile_error.h" -#include "util/make_unique.h" #include "util/multibit.h" #include "util/multibit_build.h" #include "util/multibit_compress.h" @@ -86,10 +85,10 @@ class mmbit_holder { public: mmbit_holder() {} explicit mmbit_holder(u32 num_bits, u32 excess = 0) - : data(ue2::make_unique(mmbit_size(num_bits) + 7 + excess)) {} + : data(std::make_unique(mmbit_size(num_bits) + 7 + excess)) {} void init(u32 num_bits) { assert(!data); - data = ue2::make_unique(mmbit_size(num_bits) + 7); + data = std::make_unique(mmbit_size(num_bits) + 7); } operator u8 *() { assert(data); @@ -108,10 +107,10 @@ class comp_holder { public: comp_holder() {} explicit comp_holder(u32 length) - : data(ue2::make_unique(length + 7)) {} + : data(std::make_unique(length + 7)) {} void init(u32 length) { assert(!data); - data = ue2::make_unique(length + 7); + data = std::make_unique(length + 7); } operator u8 *() { assert(data); diff --git a/unit/internal/pack_bits.cpp b/unit/internal/pack_bits.cpp index aa0a35eb..453dccfd 100644 --- a/unit/internal/pack_bits.cpp +++ b/unit/internal/pack_bits.cpp @@ -30,7 +30,6 @@ #include "gtest/gtest.h" #include "util/pack_bits.h" -#include "util/make_unique.h" #include "ue2common.h" #include @@ -92,7 +91,7 @@ void test_pack_and_unpack(const vector &v, const vector &bits) { // Temporary char array to pack into. const size_t mem_size = packed_size(bits); - unique_ptr mem = ue2::make_unique(mem_size); + unique_ptr mem = std::make_unique(mem_size); pack_bits(&mem[0], &v[0], &bits[0], elements); diff --git a/unit/internal/repeat.cpp b/unit/internal/repeat.cpp index 546d7d4f..5665a0c3 100644 --- a/unit/internal/repeat.cpp +++ b/unit/internal/repeat.cpp @@ -34,7 +34,6 @@ #include "nfa/repeat.h" #include "nfa/repeatcompile.h" #include "util/depth.h" -#include "util/make_unique.h" #include #include @@ -431,7 +430,7 @@ TEST_P(RepeatTest, Pack) { // We should be able to pack and then unpack the control block at any // offset up to repeatMin and get a match at both the min and max repeats. - unique_ptr packed = ue2::make_unique(info.packedCtrlSize); + unique_ptr packed = std::make_unique(info.packedCtrlSize); for (u32 i = 0; i < info.repeatMax; i++) { SCOPED_TRACE(testing::Message() << "i=" << i); diff --git a/unit/internal/rose_build_merge.cpp b/unit/internal/rose_build_merge.cpp index 5029f0a5..73abff4d 100644 --- a/unit/internal/rose_build_merge.cpp +++ b/unit/internal/rose_build_merge.cpp @@ -39,7 +39,6 @@ #include "util/boundary_reports.h" #include "util/compile_context.h" #include "util/graph_range.h" -#include "util/make_unique.h" #include "smallwrite/smallwrite_build.h" #include "som/slot_manager.h" @@ -52,7 +51,7 @@ using namespace ue2; static std::unique_ptr makeSuffixGraph(ReportID report) { - auto h = ue2::make_unique(NFA_SUFFIX); + auto h = std::make_unique(NFA_SUFFIX); NGHolder &g = *h; NFAVertex v = add_vertex(g); diff --git a/unit/internal/shufti.cpp b/unit/internal/shufti.cpp index 0c9d2607..9a4a4983 100644 --- a/unit/internal/shufti.cpp +++ b/unit/internal/shufti.cpp @@ -894,6 +894,7 @@ TEST(DoubleShufti, ExecMatchMixed3) { for (size_t i = 0; i < 400; i++) { t2[len - i] = 'x'; t2[len - i + 1] = 'y'; + DEBUG_PRINTF("i = %ld\n", i); const u8 *rv = shuftiDoubleExec(lo1, hi1, lo2, hi2, (u8 *)t2, (u8 *)t2 + len); @@ -1106,6 +1107,7 @@ TEST(ReverseShufti, ExecMatch6) { for (size_t i = 0; i < len; i++) { t1[i] = 'a'; + DEBUG_PRINTF("i=%ld\n", i); const u8 *rv = rshuftiExec(lo, hi, (u8 *)t1, (u8 *)t1 + len); ASSERT_EQ((const u8 *)t1 + i, rv); diff --git a/unit/internal/simd_utils.cpp b/unit/internal/simd_utils.cpp index da9bb62a..2a9accae 100644 --- a/unit/internal/simd_utils.cpp +++ b/unit/internal/simd_utils.cpp @@ -31,7 +31,6 @@ #include "gtest/gtest.h" #include "util/arch.h" #include "util/bytecode_ptr.h" -#include "util/make_unique.h" #include "util/simd_utils.h" using namespace std; @@ -522,7 +521,7 @@ TYPED_TEST(SimdUtilsTest, loadu) { const TypeParam ones = simd_ones(); const size_t mem_len = sizeof(ones) * 2; - unique_ptr mem_array = ue2::make_unique(mem_len); + unique_ptr mem_array = std::make_unique(mem_len); char *mem = mem_array.get(); for (size_t offset = 1; offset < sizeof(ones); offset++) { diff --git a/util/cross_compile.cpp b/util/cross_compile.cpp index 0d136998..df2aff5a 100644 --- a/util/cross_compile.cpp +++ b/util/cross_compile.cpp @@ -31,7 +31,6 @@ #include "cross_compile.h" #include "src/ue2common.h" #include "src/hs_compile.h" -#include "src/util/make_unique.h" #include #include @@ -74,7 +73,7 @@ unique_ptr xcompileReadMode(const char *s) { return nullptr; } else { DEBUG_PRINTF("cpu_features %llx\n", rv.cpu_features); - return ue2::make_unique(rv); + return std::make_unique(rv); } } diff --git a/util/ng_corpus_generator.cpp b/util/ng_corpus_generator.cpp index e5e8e06c..145a0ab8 100644 --- a/util/ng_corpus_generator.cpp +++ b/util/ng_corpus_generator.cpp @@ -41,7 +41,6 @@ #include "ue2common.h" #include "util/container.h" #include "util/graph_range.h" -#include "util/make_unique.h" #include "util/ue2string.h" #include "util/unicode_def.h" #include "util/unicode_set.h" @@ -141,7 +140,7 @@ void findPaths(const NGHolder &g, CorpusProperties &cProps, const size_t MAX_OPEN = min((size_t)1000, corpusLimit * 10); vector> open; - open.push_back(ue2::make_unique(1, g.start)); + open.push_back(std::make_unique(1, g.start)); unordered_set one_way_in; for (const auto &v : vertices_range(g)) { @@ -200,7 +199,7 @@ void findPaths(const NGHolder &g, CorpusProperties &cProps, if (boost::next(ai) == ae) { new_path = std::move(p); } else { - new_path = make_unique(*p); + new_path = std::make_unique(*p); } new_path->push_back(v); @@ -714,8 +713,8 @@ unique_ptr makeCorpusGenerator(const NGHolder &graph, const ExpressionInfo &expr, CorpusProperties &props) { if (expr.utf8) { - return ue2::make_unique(graph, expr, props); + return std::make_unique(graph, expr, props); } else { - return ue2::make_unique(graph, expr, props); + return std::make_unique(graph, expr, props); } }