diff --git a/src/nfa/castlecompile.cpp b/src/nfa/castlecompile.cpp index 3505e08a..b709d3c5 100644 --- a/src/nfa/castlecompile.cpp +++ b/src/nfa/castlecompile.cpp @@ -883,7 +883,7 @@ bool is_equal(const CastleProto &c1, const CastleProto &c2) { } bool requiresDedupe(const CastleProto &proto, - const ue2::flat_set &reports) { + const flat_set &reports) { for (const auto &report : reports) { auto it = proto.report_map.find(report); if (it == end(proto.report_map)) { diff --git a/src/nfa/goughcompile_internal.h b/src/nfa/goughcompile_internal.h index 9de88c77..e6454052 100644 --- a/src/nfa/goughcompile_internal.h +++ b/src/nfa/goughcompile_internal.h @@ -106,10 +106,10 @@ struct GoughSSAVarJoin; struct GoughSSAVar : noncopyable { GoughSSAVar(void) : seen(false), slot(INVALID_SLOT) {} virtual ~GoughSSAVar(); - const ue2::flat_set &get_inputs() const { + const flat_set &get_inputs() const { return inputs; } - const ue2::flat_set &get_outputs() const { + const flat_set &get_outputs() const { return outputs; } virtual void replace_input(GoughSSAVar *old_v, GoughSSAVar *new_v) = 0; @@ -127,8 +127,8 @@ struct GoughSSAVar : noncopyable { clear_outputs(); } protected: - ue2::flat_set inputs; - ue2::flat_set outputs; + flat_set inputs; + flat_set outputs; friend struct GoughSSAVarWithInputs; friend struct GoughSSAVarMin; friend struct GoughSSAVarJoin; @@ -184,16 +184,14 @@ struct GoughSSAVarJoin : public GoughSSAVarWithInputs { void add_input(GoughSSAVar *v, GoughEdge prev); - const ue2::flat_set &get_edges_for_input(GoughSSAVar *input) - const; - const std::map > &get_input_map() - const; + const flat_set &get_edges_for_input(GoughSSAVar *input) const; + const std::map> &get_input_map() const; protected: void remove_input_raw(GoughSSAVar *v) override; private: - std::map> input_map; + std::map> input_map; }; struct gough_accel_state_info { diff --git a/src/nfagraph/ng_fixed_width.cpp b/src/nfagraph/ng_fixed_width.cpp index 978dad44..8fb264d8 100644 --- a/src/nfagraph/ng_fixed_width.cpp +++ b/src/nfagraph/ng_fixed_width.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, Intel Corporation + * 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: @@ -48,7 +48,7 @@ namespace ue2 { static bool findMask(const NGHolder &g, vector *mask, bool *anchored, - ue2::flat_set *reports) { + flat_set *reports) { DEBUG_PRINTF("looking for a mask pattern\n"); set s_succ; insert(&s_succ, adjacent_vertices(g.start, g)); @@ -117,7 +117,7 @@ bool handleFixedWidth(RoseBuild &rose, const NGHolder &g, const Grey &grey) { return false; } - ue2::flat_set reports; + flat_set reports; bool anchored = false; vector mask; diff --git a/src/nfagraph/ng_holder.h b/src/nfagraph/ng_holder.h index f61c476a..36cf6244 100644 --- a/src/nfagraph/ng_holder.h +++ b/src/nfagraph/ng_holder.h @@ -67,7 +67,7 @@ struct NFAGraphEdgeProps { /** \brief For graphs that will be implemented as multi-top engines, this * specifies the top events. Only used on edges from the start vertex. */ - ue2::flat_set tops; + flat_set tops; /** \brief Flags associated with assertions. */ u32 assert_flags = 0; diff --git a/src/nfagraph/ng_limex_accel.cpp b/src/nfagraph/ng_limex_accel.cpp index 80e08a7f..fa46a42c 100644 --- a/src/nfagraph/ng_limex_accel.cpp +++ b/src/nfagraph/ng_limex_accel.cpp @@ -335,7 +335,7 @@ struct DAccelScheme { return false; } - ue2::flat_set > double_byte; + flat_set> double_byte; CharReach double_cr; u32 double_offset = 0; }; diff --git a/src/nfagraph/ng_limex_accel.h b/src/nfagraph/ng_limex_accel.h index 4c3d2b91..f6f7f1b3 100644 --- a/src/nfagraph/ng_limex_accel.h +++ b/src/nfagraph/ng_limex_accel.h @@ -57,8 +57,7 @@ struct CompileContext; void findAccelFriends(const NGHolder &g, NFAVertex v, const std::map &br_cyclic, - u32 offset, - ue2::flat_set *friends); + u32 offset, flat_set *friends); #define DOUBLE_SHUFTI_LIMIT 20 diff --git a/src/nfagraph/ng_literal_decorated.cpp b/src/nfagraph/ng_literal_decorated.cpp index 1a8cafac..61a31dbf 100644 --- a/src/nfagraph/ng_literal_decorated.cpp +++ b/src/nfagraph/ng_literal_decorated.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016, Intel Corporation + * 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: @@ -192,7 +192,7 @@ struct PathMask { } vector mask; - ue2::flat_set reports; + flat_set reports; bool is_anchored; bool is_eod; }; diff --git a/src/nfagraph/ng_repeat.cpp b/src/nfagraph/ng_repeat.cpp index da42b36d..7add6557 100644 --- a/src/nfagraph/ng_repeat.cpp +++ b/src/nfagraph/ng_repeat.cpp @@ -1598,7 +1598,7 @@ vector getUnionedTrigger(const NGHolder &g, const NFAVertex v) { vector trigger; - ue2::flat_set curr, next; + flat_set curr, next; insert(&curr, inv_adjacent_vertices(v, g)); if (contains(curr, g.start)) { @@ -2234,7 +2234,7 @@ void analyseRepeats(NGHolder &g, const ReportManager *rm, #ifndef NDEBUG // So we can assert that the number of tops hasn't changed at the end of // this analysis. - const ue2::flat_set allTops = getTops(g); + const flat_set allTops = getTops(g); #endif // Later on, we're (a little bit) dependent on depth information for diff --git a/src/nfagraph/ng_small_literal_set.cpp b/src/nfagraph/ng_small_literal_set.cpp index fb191efa..9c2d9ba3 100644 --- a/src/nfagraph/ng_small_literal_set.cpp +++ b/src/nfagraph/ng_small_literal_set.cpp @@ -100,7 +100,7 @@ bool operator<(const sls_literal &a, const sls_literal &b) { static bool checkLongMixedSensitivityLiterals( - const map> &literals) { + const map> &literals) { const size_t len = MAX_MASK2_WIDTH; for (const sls_literal &lit : literals | map_keys) { @@ -114,7 +114,7 @@ bool checkLongMixedSensitivityLiterals( static bool findLiterals(const NGHolder &g, - map> *literals) { + map> *literals) { vector order = getTopoOrdering(g); vector> built(num_vertices(g)); @@ -198,7 +198,7 @@ bool findLiterals(const NGHolder &g, } static -size_t min_period(const map> &literals) { +size_t min_period(const map> &literals) { size_t rv = SIZE_MAX; for (const sls_literal &lit : literals | map_keys) { @@ -229,7 +229,7 @@ bool handleSmallLiteralSets(RoseBuild &rose, const NGHolder &g, DEBUG_PRINTF("looking for literals\n"); - map> literals; + map> literals; if (!findLiterals(g, &literals)) { DEBUG_PRINTF(":(\n"); return false; diff --git a/src/nfagraph/ng_som.cpp b/src/nfagraph/ng_som.cpp index 6520a590..45917b45 100644 --- a/src/nfagraph/ng_som.cpp +++ b/src/nfagraph/ng_som.cpp @@ -267,7 +267,7 @@ bool validateEXSL(const NGHolder &g, const vector escapes_vec(1, escapes); const vector notescapes_vec(1, ~escapes); - ue2::flat_set states; + flat_set states; /* turn on all states past the prefix */ DEBUG_PRINTF("region %u is cutover\n", region); for (auto v : vertices_range(g)) { @@ -280,7 +280,7 @@ bool validateEXSL(const NGHolder &g, states = execute_graph(g, escapes_vec, states); /* flood with any number of not escapes */ - ue2::flat_set prev_states; + flat_set prev_states; while (prev_states != states) { prev_states = states; states = execute_graph(g, notescapes_vec, states); @@ -290,7 +290,7 @@ bool validateEXSL(const NGHolder &g, /* find input starts to use for when we are running the prefix through as * when the escape character arrives we may be in matching the prefix * already */ - ue2::flat_set prefix_start_states; + flat_set prefix_start_states; for (auto v : vertices_range(prefix)) { if (v != prefix.accept && v != prefix.acceptEod /* and as we have already made it past the prefix once */ diff --git a/src/nfagraph/ng_util.cpp b/src/nfagraph/ng_util.cpp index 83b29257..59c73498 100644 --- a/src/nfagraph/ng_util.cpp +++ b/src/nfagraph/ng_util.cpp @@ -450,8 +450,8 @@ void appendLiteral(NGHolder &h, const ue2_literal &s) { } } -ue2::flat_set getTops(const NGHolder &h) { - ue2::flat_set tops; +flat_set getTops(const NGHolder &h) { + flat_set tops; for (const auto &e : out_edges_range(h.start, h)) { insert(&tops, h[e].tops); } diff --git a/src/parser/Parser.rl b/src/parser/Parser.rl index 43dfc760..8643aebf 100644 --- a/src/parser/Parser.rl +++ b/src/parser/Parser.rl @@ -1950,7 +1950,7 @@ unique_ptr parse(const char *ptr, ParseMode &globalMode) { unsigned groupIndex = 1; // Set storing group names that are currently in use. - ue2::flat_set groupNames; + flat_set groupNames; // Root sequence. unique_ptr rootSeq = ue2::make_unique(); diff --git a/src/parser/check_refs.cpp b/src/parser/check_refs.cpp index 0badc780..60b5b6ba 100644 --- a/src/parser/check_refs.cpp +++ b/src/parser/check_refs.cpp @@ -114,7 +114,7 @@ public: ReferenceVisitor::~ReferenceVisitor() {} void checkReferences(const Component &root, unsigned int groupIndices, - const ue2::flat_set &groupNames) { + const flat_set &groupNames) { ReferenceVisitor vis(groupIndices, groupNames); root.accept(vis); } diff --git a/src/rose/rose_build_add.cpp b/src/rose/rose_build_add.cpp index f36fa576..b003336a 100644 --- a/src/rose/rose_build_add.cpp +++ b/src/rose/rose_build_add.cpp @@ -121,7 +121,7 @@ RoseVertex createVertex(RoseBuildImpl *build, u32 literalId, u32 min_offset, RoseVertex createVertex(RoseBuildImpl *build, const RoseVertex parent, u32 minBound, u32 maxBound, u32 literalId, size_t literalLength, - const ue2::flat_set &reports) { + const flat_set &reports) { assert(parent != RoseGraph::null_vertex()); RoseGraph &g = build->g; @@ -1641,7 +1641,7 @@ bool roseCheckRose(const RoseInGraph &ig, bool prefilter, } void RoseBuildImpl::add(bool anchored, bool eod, const ue2_literal &lit, - const ue2::flat_set &reports) { + const flat_set &reports) { assert(!reports.empty()); if (cc.grey.floodAsPuffette && !anchored && !eod && is_flood(lit) && diff --git a/src/rose/rose_build_add_internal.h b/src/rose/rose_build_add_internal.h index 569485a4..143f1dfa 100644 --- a/src/rose/rose_build_add_internal.h +++ b/src/rose/rose_build_add_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Intel Corporation + * 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: @@ -31,8 +31,7 @@ #include "rose_graph.h" #include "ue2common.h" - -#include +#include "util/flat_containers.h" namespace ue2 { @@ -41,8 +40,8 @@ class RoseBuildImpl; RoseVertex createVertex(RoseBuildImpl *build, const RoseVertex parent, u32 minBound, u32 maxBound, u32 literalId, size_t literalLength, - const ue2::flat_set &reports); + const flat_set &reports); } // namespace ue2 -#endif +#endif // ROSE_BUILD_ADD_INTERNAL_H diff --git a/src/rose/rose_build_add_mask.cpp b/src/rose/rose_build_add_mask.cpp index bd8eed0c..c60c053e 100644 --- a/src/rose/rose_build_add_mask.cpp +++ b/src/rose/rose_build_add_mask.cpp @@ -414,8 +414,8 @@ bool validateTransientMask(const vector &mask, bool anchored, static bool maskIsNeeded(const ue2_literal &lit, const NGHolder &g) { - ue2::flat_set curr = {g.accept}; - ue2::flat_set next; + flat_set curr = {g.accept}; + flat_set next; for (auto it = lit.rbegin(), ite = lit.rend(); it != ite; ++it) { const CharReach &cr = *it; @@ -451,7 +451,7 @@ bool maskIsNeeded(const ue2_literal &lit, const NGHolder &g) { static void addTransientMask(RoseBuildImpl &build, const vector &mask, - const ue2::flat_set &reports, bool anchored, + const flat_set &reports, bool anchored, bool eod) { vector lits; u32 lit_minBound; /* minBound of each literal in lit */ @@ -516,7 +516,7 @@ void addTransientMask(RoseBuildImpl &build, const vector &mask, ENSURE_AT_LEAST(&build.ematcher_region_size, mask.size()); } - const ue2::flat_set no_reports; + const flat_set no_reports; for (const auto &lit : lits) { u32 lit_id = build.getLiteralId(lit, msk, cmp, delay, table); @@ -553,7 +553,7 @@ void addTransientMask(RoseBuildImpl &build, const vector &mask, } static -unique_ptr buildMaskRhs(const ue2::flat_set &reports, +unique_ptr buildMaskRhs(const flat_set &reports, const vector &mask, u32 suffix_len) { assert(suffix_len); @@ -581,10 +581,9 @@ unique_ptr buildMaskRhs(const ue2::flat_set &reports, } static -void doAddMask(RoseBuildImpl &tbi, bool anchored, - const vector &mask, const ue2_literal &lit, - u32 prefix_len, u32 suffix_len, - const ue2::flat_set &reports) { +void doAddMask(RoseBuildImpl &tbi, bool anchored, const vector &mask, + const ue2_literal &lit, u32 prefix_len, u32 suffix_len, + const flat_set &reports) { /* Note: bounds are relative to literal start */ RoseInGraph ig; RoseInVertex s = add_vertex(RoseInVertexProps::makeStart(anchored), ig); @@ -711,7 +710,7 @@ bool checkAllowMask(const vector &mask, ue2_literal *lit, } bool RoseBuildImpl::add(bool anchored, const vector &mask, - const ue2::flat_set &reports) { + const flat_set &reports) { if (validateTransientMask(mask, anchored, false, cc.grey)) { bool eod = false; addTransientMask(*this, mask, reports, anchored, eod); @@ -734,14 +733,14 @@ bool RoseBuildImpl::add(bool anchored, const vector &mask, } bool RoseBuildImpl::validateMask(const vector &mask, - UNUSED const ue2::flat_set &reports, + UNUSED const flat_set &reports, bool anchored, bool eod) const { return validateTransientMask(mask, anchored, eod, cc.grey); } static unique_ptr makeAnchoredGraph(const vector &mask, - const ue2::flat_set &reports, + const flat_set &reports, bool eod) { auto gp = ue2::make_unique(); NGHolder &g = *gp; @@ -763,7 +762,7 @@ unique_ptr makeAnchoredGraph(const vector &mask, static bool addAnchoredMask(RoseBuildImpl &build, const vector &mask, - const ue2::flat_set &reports, bool eod) { + const flat_set &reports, bool eod) { if (!build.cc.grey.allowAnchoredAcyclic) { return false; } @@ -775,8 +774,8 @@ bool addAnchoredMask(RoseBuildImpl &build, const vector &mask, } void RoseBuildImpl::addMask(const vector &mask, - const ue2::flat_set &reports, - bool anchored, bool eod) { + const flat_set &reports, bool anchored, + bool eod) { if (anchored && addAnchoredMask(*this, mask, reports, eod)) { DEBUG_PRINTF("added mask as anchored acyclic graph\n"); return; diff --git a/src/rose/rose_build_compile.cpp b/src/rose/rose_build_compile.cpp index e24d0b2e..1cf3bbe6 100644 --- a/src/rose/rose_build_compile.cpp +++ b/src/rose/rose_build_compile.cpp @@ -1087,13 +1087,13 @@ bool triggerKillsRoseGraph(const RoseBuildImpl &build, const left_id &left, assert(left.graph()); const NGHolder &h = *left.graph(); - ue2::flat_set all_states; + flat_set all_states; insert(&all_states, vertices(h)); assert(out_degree(h.startDs, h) == 1); /* triggered don't use sds */ DEBUG_PRINTF("removing sds\n"); all_states.erase(h.startDs); - ue2::flat_set states; + flat_set states; /* check each pred literal to see if they all kill previous graph * state */ diff --git a/src/rose/rose_build_dedupe.cpp b/src/rose/rose_build_dedupe.cpp index d3e72313..04144f56 100644 --- a/src/rose/rose_build_dedupe.cpp +++ b/src/rose/rose_build_dedupe.cpp @@ -39,7 +39,7 @@ using namespace std; namespace ue2 { static -bool requiresDedupe(const NGHolder &h, const ue2::flat_set &reports, +bool requiresDedupe(const NGHolder &h, const flat_set &reports, const Grey &grey) { /* TODO: tighten */ NFAVertex seen_vert = NGHolder::null_vertex(); @@ -83,10 +83,10 @@ class RoseDedupeAuxImpl : public RoseDedupeAux { public: explicit RoseDedupeAuxImpl(const RoseBuildImpl &build_in); bool requiresDedupeSupport( - const ue2::flat_set &reports) const override; + const flat_set &reports) const override; private: - bool hasSafeMultiReports(const ue2::flat_set &reports) const; + bool hasSafeMultiReports(const flat_set &reports) const; const RoseBuildImpl &build; map> vert_map; //!< ordinary literals diff --git a/src/rose/rose_build_exclusive.cpp b/src/rose/rose_build_exclusive.cpp index 25585ec0..4c8796f5 100644 --- a/src/rose/rose_build_exclusive.cpp +++ b/src/rose/rose_build_exclusive.cpp @@ -26,9 +26,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "ue2common.h" - #include "rose_build_exclusive.h" + +#include "ue2common.h" #include "rose_build_merge.h" #include "nfa/castlecompile.h" #include "nfagraph/ng_execute.h" @@ -37,6 +37,7 @@ #include "util/clique.h" #include "util/compile_context.h" #include "util/container.h" +#include "util/flat_containers.h" #include "util/graph.h" #include "util/make_unique.h" @@ -228,7 +229,7 @@ bool isExclusive(const NGHolder &h, lower_bound = ~0U; } - ue2::flat_set states; + flat_set states; for (const auto &v : vertices_range(h)) { if (h[v].index >= lower_bound || h[v].index < 2) { states.insert(v); diff --git a/src/rose/rose_build_merge.cpp b/src/rose/rose_build_merge.cpp index 15a1ae78..5d4d46e4 100644 --- a/src/rose/rose_build_merge.cpp +++ b/src/rose/rose_build_merge.cpp @@ -1738,7 +1738,7 @@ void dedupeLeftfixesVariableLag(RoseBuildImpl &tbi) { } static -u32 findUnusedTop(const ue2::flat_set &tops) { +u32 findUnusedTop(const flat_set &tops) { u32 i = 0; while (contains(tops, i)) { i++; @@ -1766,7 +1766,7 @@ void replaceTops(NGHolder &h, const map &top_mapping) { static bool setDistinctTops(NGHolder &h1, const NGHolder &h2, map &top_mapping) { - ue2::flat_set tops1 = getTops(h1), tops2 = getTops(h2); + flat_set tops1 = getTops(h1), tops2 = getTops(h2); DEBUG_PRINTF("before: h1 has %zu tops, h2 has %zu tops\n", tops1.size(), tops2.size()); diff --git a/src/util/graph.h b/src/util/graph.h index 9d6bb955..660afd02 100644 --- a/src/util/graph.h +++ b/src/util/graph.h @@ -146,7 +146,7 @@ void find_unreachable(const Graph &g, const SourceCont &sources, OutCont *out) { } template -ue2::flat_set +flat_set find_vertices_in_cycles(const Graph &g) { using vertex_descriptor = typename Graph::vertex_descriptor; @@ -160,7 +160,7 @@ find_vertices_in_cycles(const Graph &g) { comps[e.second].push_back(e.first); } - ue2::flat_set rv; + flat_set rv; for (const auto &comp : comps | boost::adaptors::map_values) { /* every vertex in a strongly connected component is reachable from diff --git a/src/util/partitioned_set.h b/src/util/partitioned_set.h index 41710fe7..313c08e1 100644 --- a/src/util/partitioned_set.h +++ b/src/util/partitioned_set.h @@ -98,8 +98,7 @@ public: * If the set was not split (due to there being no overlap with splitter or * being a complete subset), INVALID_SUBSET is returned. */ - size_t split(size_t subset_index, - const typename ue2::flat_set &splitter) { + size_t split(size_t subset_index, const flat_set &splitter) { assert(!splitter.empty()); if (splitter.empty()) { return INVALID_SUBSET; @@ -193,7 +192,7 @@ public: /** * Returns all subsets which have a member in keys. */ - void find_overlapping(const typename ue2::flat_set &keys, + void find_overlapping(const flat_set &keys, std::vector *containing) const { boost::dynamic_bitset<> seen(subsets.size()); // all zero by default. diff --git a/src/util/report_manager.cpp b/src/util/report_manager.cpp index a846eb25..c0e9ee15 100644 --- a/src/util/report_manager.cpp +++ b/src/util/report_manager.cpp @@ -133,7 +133,7 @@ vector ReportManager::getDkeyToReportTable() const { void ReportManager::assignDkeys(const RoseBuild *rose) { DEBUG_PRINTF("assigning...\n"); - map> ext_to_int; + map> ext_to_int; for (u32 i = 0; i < reportIds.size(); i++) { const Report &ir = reportIds[i];