mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
use STL make_unique, remove wrapper header, breaks C++17 compilation
This commit is contained in:
@@ -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;
|
||||
|
@@ -39,7 +39,6 @@
|
||||
#include "ue2common.h"
|
||||
#include "compiler/compiler.h" // for ParsedExpression
|
||||
#include "util/compile_error.h"
|
||||
#include "util/make_unique.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -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<NGHolder>()),
|
||||
: rm(rm_in), grey(grey_in), graph(std::make_unique<NGHolder>()),
|
||||
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<NFABuilder> makeNFABuilder(ReportManager &rm, const CompileContext &cc,
|
||||
const ParsedExpression &expr) {
|
||||
return ue2::make_unique<NFABuilderImpl>(rm, cc.grey, expr);
|
||||
return std::make_unique<NFABuilderImpl>(rm, cc.grey, expr);
|
||||
}
|
||||
|
||||
NFABuilder::~NFABuilder() { }
|
||||
|
@@ -58,7 +58,6 @@
|
||||
#include "ue2common.h"
|
||||
#include "util/graph_range.h"
|
||||
#include "util/graph_undirected.h"
|
||||
#include "util/make_unique.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@@ -355,7 +354,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
|
||||
* no deterministic ordering (split_components map). */
|
||||
sort(begin(vv), end(vv));
|
||||
|
||||
auto gc = ue2::make_unique<NGHolder>();
|
||||
auto gc = std::make_unique<NGHolder>();
|
||||
v_map.clear();
|
||||
fillHolder(gc.get(), *g, vv, &v_map);
|
||||
|
||||
@@ -379,7 +378,7 @@ void splitIntoComponents(unique_ptr<NGHolder> 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<NGHolder>();
|
||||
auto gc = std::make_unique<NGHolder>();
|
||||
v_map.clear();
|
||||
fillHolder(gc.get(), *g, vv, &v_map);
|
||||
|
||||
|
@@ -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 <algorithm>
|
||||
@@ -269,7 +268,7 @@ vector<unique_ptr<VertexInfo>> getVertexInfos(const NGHolder &g) {
|
||||
vertex_map.resize(num_verts);
|
||||
|
||||
for (auto v : vertices_range(g)) {
|
||||
infos.emplace_back(make_unique<VertexInfo>(v, g));
|
||||
infos.emplace_back(std::make_unique<VertexInfo>(v, g));
|
||||
vertex_map[g[v].index] = infos.back().get();
|
||||
}
|
||||
|
||||
@@ -516,7 +515,7 @@ void mergeClass(vector<unique_ptr<VertexInfo>> &infos, NGHolder &g,
|
||||
g[new_v].reports.clear(); /* populated as we pull in succs */
|
||||
|
||||
// store this vertex in our global vertex list
|
||||
infos.emplace_back(make_unique<VertexInfo>(new_v, g));
|
||||
infos.emplace_back(std::make_unique<VertexInfo>(new_v, g));
|
||||
VertexInfo *new_vertex_info = infos.back().get();
|
||||
|
||||
NFAVertex new_v_eod = NGHolder::null_vertex();
|
||||
@@ -525,7 +524,7 @@ void mergeClass(vector<unique_ptr<VertexInfo>> &infos, NGHolder &g,
|
||||
if (require_separate_eod_vertex(cur_class_vertices, g)) {
|
||||
new_v_eod = clone_vertex(g, old_v);
|
||||
g[new_v_eod].reports.clear();
|
||||
infos.emplace_back(make_unique<VertexInfo>(new_v_eod, g));
|
||||
infos.emplace_back(std::make_unique<VertexInfo>(new_v_eod, g));
|
||||
new_vertex_info_eod = infos.back().get();
|
||||
}
|
||||
|
||||
|
@@ -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 <algorithm>
|
||||
@@ -581,7 +580,7 @@ attemptToBuildHaig(const NGHolder &g, som_type som, u32 somPrecision,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto rdfa = ue2::make_unique<raw_som_dfa>(g.kind, unordered_som, NODE_START,
|
||||
auto rdfa = std::make_unique<raw_som_dfa>(g.kind, unordered_som, NODE_START,
|
||||
somPrecision);
|
||||
|
||||
DEBUG_PRINTF("determinising nfa with %u vertices\n", numStates);
|
||||
@@ -724,7 +723,7 @@ unique_ptr<raw_som_dfa> attemptToMergeHaig(const vector<const raw_som_dfa *> &df
|
||||
|
||||
using StateSet = Automaton_Haig_Merge::StateSet;
|
||||
vector<StateSet> nfa_state_map;
|
||||
auto rdfa = ue2::make_unique<raw_som_dfa>(dfas[0]->kind, unordered_som,
|
||||
auto rdfa = std::make_unique<raw_som_dfa>(dfas[0]->kind, unordered_som,
|
||||
NODE_START,
|
||||
dfas[0]->stream_som_loc_width);
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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 <algorithm>
|
||||
#include <memory>
|
||||
|
@@ -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 <algorithm>
|
||||
@@ -568,7 +567,7 @@ unique_ptr<raw_dfa> buildMcClellan(const NGHolder &graph,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto rdfa = ue2::make_unique<raw_dfa>(graph.kind);
|
||||
auto rdfa = std::make_unique<raw_dfa>(graph.kind);
|
||||
|
||||
if (numStates <= NFA_STATE_LIMIT) {
|
||||
/* Fast path. Automaton_Graph uses a bitfield internally to represent
|
||||
|
@@ -65,7 +65,6 @@
|
||||
#include "util/container.h"
|
||||
#include "util/dump_charclass.h"
|
||||
#include "util/graph_range.h"
|
||||
#include "util/make_unique.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
@@ -364,7 +363,7 @@ makePrefix(const NGHolder &g, const unordered_map<NFAVertex, u32> ®ions,
|
||||
assert(!next_enters.empty());
|
||||
assert(!curr_exits.empty());
|
||||
|
||||
unique_ptr<NGHolder> prefix_ptr = ue2::make_unique<NGHolder>();
|
||||
unique_ptr<NGHolder> prefix_ptr = std::make_unique<NGHolder>();
|
||||
NGHolder &prefix = *prefix_ptr;
|
||||
|
||||
deque<NFAVertex> lhs_verts;
|
||||
|
@@ -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<NGHolder> cloneHolder(const NGHolder &in) {
|
||||
unique_ptr<NGHolder> h = ue2::make_unique<NGHolder>();
|
||||
unique_ptr<NGHolder> h = std::make_unique<NGHolder>();
|
||||
cloneHolder(*h, in);
|
||||
return h;
|
||||
}
|
||||
|
@@ -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 <set>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <boost/dynamic_bitset.hpp>
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
|
||||
@@ -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<VertLitInfo>(v, s, anchored);
|
||||
lit_info[v] = std::make_unique<VertLitInfo>(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<VertLitInfo>(vv, s, anchored));
|
||||
lits->emplace_back(std::make_unique<VertLitInfo>(vv, s, anchored));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -945,7 +945,7 @@ unique_ptr<VertLitInfo> findSimplePrefixSplit(const NGHolder &g,
|
||||
sanitizeAndCompressAndScore(best_lit_set);
|
||||
}
|
||||
|
||||
return ue2::make_unique<VertLitInfo>(best_v, best_lit_set, anchored, true);
|
||||
return std::make_unique<VertLitInfo>(best_v, best_lit_set, anchored, true);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -1835,7 +1835,7 @@ static
|
||||
unique_ptr<NGHolder> make_chain(u32 count) {
|
||||
assert(count);
|
||||
|
||||
auto rv = make_unique<NGHolder>(NFA_INFIX);
|
||||
auto rv = std::make_unique<NGHolder>(NFA_INFIX);
|
||||
|
||||
NGHolder &h = *rv;
|
||||
|
||||
|
Reference in New Issue
Block a user