tidy: "ue2::flat_set/map" -> "flat_set/map"

This commit is contained in:
Justin Viiret 2017-07-19 11:20:39 +10:00 committed by Matthew Barr
parent 9cf66b6ac9
commit 33823d60d1
23 changed files with 65 additions and 70 deletions

View File

@ -883,7 +883,7 @@ bool is_equal(const CastleProto &c1, const CastleProto &c2) {
}
bool requiresDedupe(const CastleProto &proto,
const ue2::flat_set<ReportID> &reports) {
const flat_set<ReportID> &reports) {
for (const auto &report : reports) {
auto it = proto.report_map.find(report);
if (it == end(proto.report_map)) {

View File

@ -106,10 +106,10 @@ struct GoughSSAVarJoin;
struct GoughSSAVar : noncopyable {
GoughSSAVar(void) : seen(false), slot(INVALID_SLOT) {}
virtual ~GoughSSAVar();
const ue2::flat_set<GoughSSAVar *> &get_inputs() const {
const flat_set<GoughSSAVar *> &get_inputs() const {
return inputs;
}
const ue2::flat_set<GoughSSAVarWithInputs *> &get_outputs() const {
const flat_set<GoughSSAVarWithInputs *> &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<GoughSSAVar *> inputs;
ue2::flat_set<GoughSSAVarWithInputs *> outputs;
flat_set<GoughSSAVar *> inputs;
flat_set<GoughSSAVarWithInputs *> 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<GoughEdge> &get_edges_for_input(GoughSSAVar *input)
const;
const std::map<GoughSSAVar *, ue2::flat_set<GoughEdge> > &get_input_map()
const;
const flat_set<GoughEdge> &get_edges_for_input(GoughSSAVar *input) const;
const std::map<GoughSSAVar *, flat_set<GoughEdge>> &get_input_map() const;
protected:
void remove_input_raw(GoughSSAVar *v) override;
private:
std::map<GoughSSAVar *, ue2::flat_set<GoughEdge>> input_map;
std::map<GoughSSAVar *, flat_set<GoughEdge>> input_map;
};
struct gough_accel_state_info {

View File

@ -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<CharReach> *mask, bool *anchored,
ue2::flat_set<ReportID> *reports) {
flat_set<ReportID> *reports) {
DEBUG_PRINTF("looking for a mask pattern\n");
set<NFAVertex> 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<ReportID> reports;
flat_set<ReportID> reports;
bool anchored = false;
vector<CharReach> mask;

View File

@ -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<u32> tops;
flat_set<u32> tops;
/** \brief Flags associated with assertions. */
u32 assert_flags = 0;

View File

@ -335,7 +335,7 @@ struct DAccelScheme {
return false;
}
ue2::flat_set<std::pair<u8, u8> > double_byte;
flat_set<pair<u8, u8>> double_byte;
CharReach double_cr;
u32 double_offset = 0;
};

View File

@ -57,8 +57,7 @@ struct CompileContext;
void findAccelFriends(const NGHolder &g, NFAVertex v,
const std::map<NFAVertex, BoundedRepeatSummary> &br_cyclic,
u32 offset,
ue2::flat_set<NFAVertex> *friends);
u32 offset, flat_set<NFAVertex> *friends);
#define DOUBLE_SHUFTI_LIMIT 20

View File

@ -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<CharReach> mask;
ue2::flat_set<ReportID> reports;
flat_set<ReportID> reports;
bool is_anchored;
bool is_eod;
};

View File

@ -1598,7 +1598,7 @@ vector<CharReach> getUnionedTrigger(const NGHolder &g, const NFAVertex v) {
vector<CharReach> trigger;
ue2::flat_set<NFAVertex> curr, next;
flat_set<NFAVertex> 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<u32> allTops = getTops(g);
const flat_set<u32> allTops = getTops(g);
#endif
// Later on, we're (a little bit) dependent on depth information for

View File

@ -100,7 +100,7 @@ bool operator<(const sls_literal &a, const sls_literal &b) {
static
bool checkLongMixedSensitivityLiterals(
const map<sls_literal, ue2::flat_set<ReportID>> &literals) {
const map<sls_literal, flat_set<ReportID>> &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<sls_literal, ue2::flat_set<ReportID>> *literals) {
map<sls_literal, flat_set<ReportID>> *literals) {
vector<NFAVertex> order = getTopoOrdering(g);
vector<set<sls_literal>> built(num_vertices(g));
@ -198,7 +198,7 @@ bool findLiterals(const NGHolder &g,
}
static
size_t min_period(const map<sls_literal, ue2::flat_set<ReportID>> &literals) {
size_t min_period(const map<sls_literal, flat_set<ReportID>> &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<sls_literal, ue2::flat_set<ReportID>> literals;
map<sls_literal, flat_set<ReportID>> literals;
if (!findLiterals(g, &literals)) {
DEBUG_PRINTF(":(\n");
return false;

View File

@ -267,7 +267,7 @@ bool validateEXSL(const NGHolder &g,
const vector<CharReach> escapes_vec(1, escapes);
const vector<CharReach> notescapes_vec(1, ~escapes);
ue2::flat_set<NFAVertex> states;
flat_set<NFAVertex> 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<NFAVertex> prev_states;
flat_set<NFAVertex> 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<NFAVertex> prefix_start_states;
flat_set<NFAVertex> 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 */

View File

@ -450,8 +450,8 @@ void appendLiteral(NGHolder &h, const ue2_literal &s) {
}
}
ue2::flat_set<u32> getTops(const NGHolder &h) {
ue2::flat_set<u32> tops;
flat_set<u32> getTops(const NGHolder &h) {
flat_set<u32> tops;
for (const auto &e : out_edges_range(h.start, h)) {
insert(&tops, h[e].tops);
}

View File

@ -1950,7 +1950,7 @@ unique_ptr<Component> parse(const char *ptr, ParseMode &globalMode) {
unsigned groupIndex = 1;
// Set storing group names that are currently in use.
ue2::flat_set<string> groupNames;
flat_set<string> groupNames;
// Root sequence.
unique_ptr<ComponentSequence> rootSeq = ue2::make_unique<ComponentSequence>();

View File

@ -114,7 +114,7 @@ public:
ReferenceVisitor::~ReferenceVisitor() {}
void checkReferences(const Component &root, unsigned int groupIndices,
const ue2::flat_set<std::string> &groupNames) {
const flat_set<std::string> &groupNames) {
ReferenceVisitor vis(groupIndices, groupNames);
root.accept(vis);
}

View File

@ -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<ReportID> &reports) {
const flat_set<ReportID> &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<ReportID> &reports) {
const flat_set<ReportID> &reports) {
assert(!reports.empty());
if (cc.grey.floodAsPuffette && !anchored && !eod && is_flood(lit) &&

View File

@ -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 <set>
#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<ReportID> &reports);
const flat_set<ReportID> &reports);
} // namespace ue2
#endif
#endif // ROSE_BUILD_ADD_INTERNAL_H

View File

@ -414,8 +414,8 @@ bool validateTransientMask(const vector<CharReach> &mask, bool anchored,
static
bool maskIsNeeded(const ue2_literal &lit, const NGHolder &g) {
ue2::flat_set<NFAVertex> curr = {g.accept};
ue2::flat_set<NFAVertex> next;
flat_set<NFAVertex> curr = {g.accept};
flat_set<NFAVertex> 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<CharReach> &mask,
const ue2::flat_set<ReportID> &reports, bool anchored,
const flat_set<ReportID> &reports, bool anchored,
bool eod) {
vector<ue2_literal> lits;
u32 lit_minBound; /* minBound of each literal in lit */
@ -516,7 +516,7 @@ void addTransientMask(RoseBuildImpl &build, const vector<CharReach> &mask,
ENSURE_AT_LEAST(&build.ematcher_region_size, mask.size());
}
const ue2::flat_set<ReportID> no_reports;
const flat_set<ReportID> 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<CharReach> &mask,
}
static
unique_ptr<NGHolder> buildMaskRhs(const ue2::flat_set<ReportID> &reports,
unique_ptr<NGHolder> buildMaskRhs(const flat_set<ReportID> &reports,
const vector<CharReach> &mask,
u32 suffix_len) {
assert(suffix_len);
@ -581,10 +581,9 @@ unique_ptr<NGHolder> buildMaskRhs(const ue2::flat_set<ReportID> &reports,
}
static
void doAddMask(RoseBuildImpl &tbi, bool anchored,
const vector<CharReach> &mask, const ue2_literal &lit,
u32 prefix_len, u32 suffix_len,
const ue2::flat_set<ReportID> &reports) {
void doAddMask(RoseBuildImpl &tbi, bool anchored, const vector<CharReach> &mask,
const ue2_literal &lit, u32 prefix_len, u32 suffix_len,
const flat_set<ReportID> &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<CharReach> &mask, ue2_literal *lit,
}
bool RoseBuildImpl::add(bool anchored, const vector<CharReach> &mask,
const ue2::flat_set<ReportID> &reports) {
const flat_set<ReportID> &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<CharReach> &mask,
}
bool RoseBuildImpl::validateMask(const vector<CharReach> &mask,
UNUSED const ue2::flat_set<ReportID> &reports,
UNUSED const flat_set<ReportID> &reports,
bool anchored, bool eod) const {
return validateTransientMask(mask, anchored, eod, cc.grey);
}
static
unique_ptr<NGHolder> makeAnchoredGraph(const vector<CharReach> &mask,
const ue2::flat_set<ReportID> &reports,
const flat_set<ReportID> &reports,
bool eod) {
auto gp = ue2::make_unique<NGHolder>();
NGHolder &g = *gp;
@ -763,7 +762,7 @@ unique_ptr<NGHolder> makeAnchoredGraph(const vector<CharReach> &mask,
static
bool addAnchoredMask(RoseBuildImpl &build, const vector<CharReach> &mask,
const ue2::flat_set<ReportID> &reports, bool eod) {
const flat_set<ReportID> &reports, bool eod) {
if (!build.cc.grey.allowAnchoredAcyclic) {
return false;
}
@ -775,8 +774,8 @@ bool addAnchoredMask(RoseBuildImpl &build, const vector<CharReach> &mask,
}
void RoseBuildImpl::addMask(const vector<CharReach> &mask,
const ue2::flat_set<ReportID> &reports,
bool anchored, bool eod) {
const flat_set<ReportID> &reports, bool anchored,
bool eod) {
if (anchored && addAnchoredMask(*this, mask, reports, eod)) {
DEBUG_PRINTF("added mask as anchored acyclic graph\n");
return;

View File

@ -1087,13 +1087,13 @@ bool triggerKillsRoseGraph(const RoseBuildImpl &build, const left_id &left,
assert(left.graph());
const NGHolder &h = *left.graph();
ue2::flat_set<NFAVertex> all_states;
flat_set<NFAVertex> 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<NFAVertex> states;
flat_set<NFAVertex> states;
/* check each pred literal to see if they all kill previous graph
* state */

View File

@ -39,7 +39,7 @@ using namespace std;
namespace ue2 {
static
bool requiresDedupe(const NGHolder &h, const ue2::flat_set<ReportID> &reports,
bool requiresDedupe(const NGHolder &h, const flat_set<ReportID> &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<ReportID> &reports) const override;
const flat_set<ReportID> &reports) const override;
private:
bool hasSafeMultiReports(const ue2::flat_set<ReportID> &reports) const;
bool hasSafeMultiReports(const flat_set<ReportID> &reports) const;
const RoseBuildImpl &build;
map<ReportID, set<RoseVertex>> vert_map; //!< ordinary literals

View File

@ -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<NFAVertex> states;
flat_set<NFAVertex> states;
for (const auto &v : vertices_range(h)) {
if (h[v].index >= lower_bound || h[v].index < 2) {
states.insert(v);

View File

@ -1738,7 +1738,7 @@ void dedupeLeftfixesVariableLag(RoseBuildImpl &tbi) {
}
static
u32 findUnusedTop(const ue2::flat_set<u32> &tops) {
u32 findUnusedTop(const flat_set<u32> &tops) {
u32 i = 0;
while (contains(tops, i)) {
i++;
@ -1766,7 +1766,7 @@ void replaceTops(NGHolder &h, const map<u32, u32> &top_mapping) {
static
bool setDistinctTops(NGHolder &h1, const NGHolder &h2,
map<u32, u32> &top_mapping) {
ue2::flat_set<u32> tops1 = getTops(h1), tops2 = getTops(h2);
flat_set<u32> tops1 = getTops(h1), tops2 = getTops(h2);
DEBUG_PRINTF("before: h1 has %zu tops, h2 has %zu tops\n", tops1.size(),
tops2.size());

View File

@ -146,7 +146,7 @@ void find_unreachable(const Graph &g, const SourceCont &sources, OutCont *out) {
}
template <class Graph>
ue2::flat_set<typename Graph::vertex_descriptor>
flat_set<typename Graph::vertex_descriptor>
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<vertex_descriptor> rv;
flat_set<vertex_descriptor> rv;
for (const auto &comp : comps | boost::adaptors::map_values) {
/* every vertex in a strongly connected component is reachable from

View File

@ -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<T> &splitter) {
size_t split(size_t subset_index, const flat_set<T> &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<T> &keys,
void find_overlapping(const flat_set<T> &keys,
std::vector<size_t> *containing) const {
boost::dynamic_bitset<> seen(subsets.size()); // all zero by default.

View File

@ -133,7 +133,7 @@ vector<ReportID> ReportManager::getDkeyToReportTable() const {
void ReportManager::assignDkeys(const RoseBuild *rose) {
DEBUG_PRINTF("assigning...\n");
map<u32, ue2::flat_set<ReportID>> ext_to_int;
map<u32, flat_set<ReportID>> ext_to_int;
for (u32 i = 0; i < reportIds.size(); i++) {
const Report &ir = reportIds[i];