Skip to content

Commit

Permalink
Avoid compiler range-loop-analysis failure when using xcode command l…
Browse files Browse the repository at this point in the history
…ine tools 12.0.
  • Loading branch information
niyue committed Nov 1, 2020
1 parent c758cdf commit c4a86cf
Show file tree
Hide file tree
Showing 62 changed files with 235 additions and 235 deletions.
8 changes: 4 additions & 4 deletions src/compiler/asserts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void replaceAssertVertex(NGHolder &g, NFAVertex t, const ExpressionInfo &expr,

// Wire up all the predecessors to all the successors.

for (const auto &inEdge : in_edges_range(t, g)) {
for (const auto inEdge : in_edges_range(t, g)) {
NFAVertex u = source(inEdge, g);
if (u == t) {
continue; // ignore self-loops
Expand All @@ -141,7 +141,7 @@ void replaceAssertVertex(NGHolder &g, NFAVertex t, const ExpressionInfo &expr,
continue;
}

for (const auto &outEdge : out_edges_range(t, g)) {
for (const auto outEdge : out_edges_range(t, g)) {
NFAVertex v = target(outEdge, g);

DEBUG_PRINTF("consider path [%zu,%zu,%zu]\n", g[u].index,
Expand Down Expand Up @@ -229,7 +229,7 @@ void checkForMultilineStart(ReportManager &rm, NGHolder &g,

/* we need to interpose a dummy dot vertex between v and accept if
* required so that ^ doesn't match trailing \n */
for (const auto &e : out_edges_range(v, g)) {
for (const auto e : out_edges_range(v, g)) {
if (target(e, g) == g.accept) {
dead.push_back(e);
}
Expand Down Expand Up @@ -283,7 +283,7 @@ void removeAssertVertices(ReportManager &rm, NGHolder &g,

// Build a cache of (u, v) vertex pairs to edge descriptors.
edge_cache_t edge_cache;
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
edge_cache[make_pair(source(e, g), target(e, g))] = e;
}

Expand Down
2 changes: 1 addition & 1 deletion src/nfa/castlecompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void getNeighborInfo(const CliqueGraph &g, vector<u32> &neighbor,
u32 id = g[cv].stateId;

// find neighbors for cv
for (const auto &v : adjacent_vertices_range(cv, g)) {
for (const auto v : adjacent_vertices_range(cv, g)) {
if (g[v].stateId != id && contains(group, g[v].stateId)) {
neighbor.push_back(g[v].stateId);
DEBUG_PRINTF("Neighbor:%u\n", g[v].stateId);
Expand Down
10 changes: 5 additions & 5 deletions src/nfa/goughcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ void copy_propagation(GoughGraph &g, const Grey &grey) {
for (auto v : vertices_range(g)) {
copy_propagate_update_vars(g[v].vars, &changes);
}
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
copy_propagate_update_vars(g[e].vars, &changes);
}
} while(changes);
Expand Down Expand Up @@ -562,7 +562,7 @@ void remove_dead(GoughGraph &g) {
i--;
}
}
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
for (u32 i = 0; i < g[e].vars.size(); i++) {
GoughSSAVar *var = g[e].vars[i].get();
if (var->seen) {
Expand Down Expand Up @@ -896,7 +896,7 @@ static
void build_blocks(const GoughGraph &g,
map<gough_edge_id, vector<gough_ins> > *blocks,
u32 base_temp_slot) {
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
if (g[e].vars.empty()) {
continue;
}
Expand Down Expand Up @@ -946,7 +946,7 @@ void copy_in_blocks(raw_som_dfa &raw, u8 alphaShift, const GoughGraph &cfg,
assert(top_sym == raw.alpha_size - 1U);
map<vector<gough_ins>, u32> &processed = *prog_offsets;

for (const auto &e : edges_range(cfg)) {
for (const auto e : edges_range(cfg)) {
if (!contains(blocks, gough_edge_id(cfg, e))) {
continue;
}
Expand Down Expand Up @@ -985,7 +985,7 @@ void copy_in_blocks(raw_som_dfa &raw, u8 alphaShift, const GoughGraph &cfg,
}

bool find_normal_self_loop(GoughVertex v, const GoughGraph &g, GoughEdge *out) {
for (const auto &e : out_edges_range(v, g)) {
for (const auto e : out_edges_range(v, g)) {
if (target(e, g) != v) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/nfa/goughcompile_accel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ bool verify_neighbour(const GoughGraph &g, GoughVertex u,
const map<gough_edge_id, vector<gough_ins> > &blocks,
const set<GoughVertex> &succs,
const vector<gough_ins> &block_sl) {
for (const auto &e : out_edges_range(u, g)) {
for (const auto e : out_edges_range(u, g)) {
if (!g[e].reach.any()) { /* ignore top edges */
continue;
}
Expand All @@ -172,7 +172,7 @@ static
bool verify_neighbour_no_block(const GoughGraph &g, GoughVertex u,
const map<gough_edge_id, vector<gough_ins> > &blocks,
const set<GoughVertex> &succs) {
for (const auto &e : out_edges_range(u, g)) {
for (const auto e : out_edges_range(u, g)) {
if (!g[e].reach.any()) { /* ignore top edges */
continue;
}
Expand Down Expand Up @@ -216,7 +216,7 @@ bool allow_two_byte_accel(const GoughGraph &g,
const auto &block_sl = blocks.at(gough_edge_id(g, self_loop));

set<GoughVertex> succs;
for (const auto &e : out_edges_range(v, g)) {
for (const auto e : out_edges_range(v, g)) {
if (g[e].reach.none()) { /* ignore top edges */
continue;
}
Expand All @@ -237,7 +237,7 @@ bool allow_two_byte_accel(const GoughGraph &g,
} else {
DEBUG_PRINTF("no edge plan on self loop\n");
set<GoughVertex> succs;
for (const auto &e : out_edges_range(v, g)) {
for (const auto e : out_edges_range(v, g)) {
if (g[e].reach.none()) { /* ignore top edges */
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions src/nfa/goughcompile_dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void dump_graph(const GoughGraph &g, const string &base, const Grey &grey) {

fprintf(f, "label = \"%u\"];\n", g[v].state_id);
}
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
GoughVertex s = source(e, g);
GoughVertex t = target(e, g);

Expand Down Expand Up @@ -153,7 +153,7 @@ void dump_var_mapping(const GoughGraph &g, const string &base,
fprintf(f, "\n");
}
}
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
set<const GoughSSAVar *> used = uses(g[e]);
if (g[e].vars.empty() && used.empty()) {
continue;
Expand Down Expand Up @@ -200,7 +200,7 @@ void gather_vars(const GoughGraph &g, vector<const GoughSSAVar *> *vars,
}
}

for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
for (u32 i = 0; i < g[e].vars.size(); i++) {
const GoughSSAVar *vp = g[e].vars[i].get();
stringstream ss;
Expand Down
12 changes: 6 additions & 6 deletions src/nfa/goughcompile_reg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void all_vars(const GoughGraph &g, vector<GoughSSAVar *> *out) {
for (auto v : vertices_range(g)) {
push_back_all_raw(out, g[v].vars);
}
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
push_back_all_raw(out, g[e].vars);
}
}
Expand Down Expand Up @@ -89,7 +89,7 @@ void fill_aux(const GoughGraph &g, GoughGraphAux *aux) {
aux->reporters[var].insert(v);
}
}
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
for (const auto &var : g[e].vars) {
aux->containing_e[var.get()] = e;
DEBUG_PRINTF("%u is on edge %u->%u\n", var->slot,
Expand Down Expand Up @@ -217,7 +217,7 @@ void handle_pending_vertex(GoughVertex def_v, const GoughGraph &g,
DEBUG_PRINTF("contains target vertex\n");
return; /* we have reached def */
}
for (const auto &e : in_edges_range(current, g)) {
for (const auto e : in_edges_range(current, g)) {
handle_pending_edge(g, e, nullptr, pending_vertex, rv);
}
}
Expand Down Expand Up @@ -293,7 +293,7 @@ u32 initial_slots(const GoughGraph &g) {
for (auto v : vertices_range(g)) {
set_initial_slots(g[v].vars, &next_slot);
}
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
set_initial_slots(g[e].vars, &next_slot);
}

Expand Down Expand Up @@ -405,7 +405,7 @@ void find_dom_ordering(const GoughGraph &cfg, vector<GoughSSAVar *> *out) {

for (auto it = g_order.rbegin(); it != g_order.rend(); ++it) {
add_to_dom_ordering(cfg[*it].vars, out);
for (const auto &e : out_edges_range(*it, cfg)) {
for (const auto e : out_edges_range(*it, cfg)) {
add_to_dom_ordering(cfg[e].vars, out);
}
}
Expand Down Expand Up @@ -444,7 +444,7 @@ void update_local_slots(GoughGraph &g, set<GoughSSAVar *> &locals,
/* local variables only occur on edges (joins are never local) */

u32 allocated_count = 0;
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
u32 next_slot = local_base;
for (auto &var : g[e].vars) {
if (contains(locals, var.get())) {
Expand Down
12 changes: 6 additions & 6 deletions src/nfa/limex_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ void findMaskedCompressionStates(const build_info &args,
if (!inspects_states_for_accepts(h)
&& !hasInitDsStates(h, args.state_ids)) {
NFAStateSet nonleaf(args.num_states);
for (const auto &e : edges_range(h)) {
for (const auto e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h));
if (from == NO_STATE) {
Expand Down Expand Up @@ -1447,7 +1447,7 @@ u32 buildExceptionMap(const build_info &args, ReportListCache &reports_cache,
}

// are we a non-limited transition?
for (const auto &oe : out_edges_range(v, h)) {
for (const auto oe : out_edges_range(v, h)) {
if (contains(exceptional, oe)) {
NFAVertex w = target(oe, h);
u32 w_idx = args.state_ids.at(w);
Expand Down Expand Up @@ -1538,7 +1538,7 @@ static
u32 findMaxVarShift(const build_info &args, u32 nShifts) {
const NGHolder &h = args.h;
u32 shiftMask = 0;
for (const auto &e : edges_range(h)) {
for (const auto e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h));
if (from == NO_STATE || to == NO_STATE) {
Expand Down Expand Up @@ -1567,7 +1567,7 @@ int getLimexScore(const build_info &args, u32 nShifts) {
maxVarShift = findMaxVarShift(args, nShifts);

NFAStateSet exceptionalStates(args.num_states);
for (const auto &e : edges_range(h)) {
for (const auto e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h));
if (from == NO_STATE || to == NO_STATE) {
Expand Down Expand Up @@ -1858,7 +1858,7 @@ struct Factory {
u32 shiftMask = 0;
int shiftMaskIdx = 0;

for (const auto &e : edges_range(h)) {
for (const auto e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h));
if (from == NO_STATE || to == NO_STATE) {
Expand Down Expand Up @@ -1896,7 +1896,7 @@ struct Factory {
u32 maxShift) {
const NGHolder &h = args.h;

for (const auto &e : edges_range(h)) {
for (const auto e : edges_range(h)) {
u32 from = args.state_ids.at(source(e, h));
u32 to = args.state_ids.at(target(e, h));
if (from == NO_STATE || to == NO_STATE) {
Expand Down
4 changes: 2 additions & 2 deletions src/nfa/mcsheng_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ dstate_id_t find_sheng_states(dfa_info &info,
/* get an estimate of stickness of the cyclic: assume any edges from
* states with larger state ids are back edges */
CharReach est_back_reach;
for (const auto &u : inv_adjacent_vertices_range(v, g)) {
for (const auto u : inv_adjacent_vertices_range(v, g)) {
if (g[u].index < g[v].index) {
continue;
}
Expand Down Expand Up @@ -486,7 +486,7 @@ dstate_id_t find_sheng_states(dfa_info &info,
}

sheng_states.insert(v);
for (const auto &t : adjacent_vertices_range(v, g)) {
for (const auto t : adjacent_vertices_range(v, g)) {
if (!contains(considered, g[t].index)) {
to_consider.push_back(t);
}
Expand Down
4 changes: 2 additions & 2 deletions src/nfagraph/ng_anchored_dots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
bool selfLoop = false;
bool bustOut = false;

for (const auto &e : out_edges_range(dotV, g)) {
for (const auto e : out_edges_range(dotV, g)) {
NFAVertex t = target(e, g);
if (t == dotV) {
selfLoop = true;
Expand Down Expand Up @@ -280,7 +280,7 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
bool selfLoop = false;
bool bustOut = false;

for (const auto &e : out_edges_range(dotV, g)) {
for (const auto e : out_edges_range(dotV, g)) {
NFAVertex t = target(e, g);

if (t == dotV) {
Expand Down
4 changes: 2 additions & 2 deletions src/nfagraph/ng_asserts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static const CharReach CHARREACH_NONWORD_UCP_PRE(CHARREACH_NONWORD);
static
vector<NFAEdge> getAsserts(const NGHolder &g) {
vector<NFAEdge> out;
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
if (g[e].assert_flags) {
out.push_back(e);
}
Expand Down Expand Up @@ -255,7 +255,7 @@ void splitVertex(ReportManager &rm, NGHolder &g, const ExpressionInfo &expr,
static
void resolveEdges(ReportManager &rm, NGHolder &g, const ExpressionInfo &expr,
set<NFAEdge> *dead) {
for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
u32 flags = g[e].assert_flags;
if (!flags) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/nfagraph/ng_calc_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ vector<NFAEdge> findShellEdges(const NGHolder &g,
const flat_set<NFAVertex> &tail_shell) {
vector<NFAEdge> shell_edges;

for (const auto &e : edges_range(g)) {
for (const auto e : edges_range(g)) {
auto u = source(e, g);
auto v = target(e, g);

Expand Down
2 changes: 1 addition & 1 deletion src/nfagraph/ng_cyclic_redundancy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ bool removeCyclicPathRedundancy(Graph &g, typename Graph::vertex_descriptor v,

flat_set<vertex_descriptor> s;

for (const auto &e : in_edges_range(v, g)) {
for (const auto e : in_edges_range(v, g)) {
vertex_descriptor u = source(e, g);
if (u == v) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/nfagraph/ng_depth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ vector<bool> findLoopReachable(const Graph &g,
}

for (auto v : reverse(topoOrder)) {
for (const auto &e : in_edges_range(v, g)) {
for (const auto e : in_edges_range(v, g)) {
if (deadNodes[g[source(e, g)].index]) {
deadNodes[g[v].index] = true;
break;
Expand Down
12 changes: 6 additions & 6 deletions src/nfagraph/ng_edge_redundancy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void checkLargeOutU(const NGHolder &g, NFAVertex u,
return;
}

for (const auto &e : out_edges_range(u, g)) {
for (const auto e : out_edges_range(u, g)) {
const NFAVertex v = target(e, g);

if (is_special(v, g)) {
Expand All @@ -364,7 +364,7 @@ void checkLargeOutU(const NGHolder &g, NFAVertex u,

/* Now need check to find any edges which can be removed due to the
* existence of edge e */
for (const auto &e2 : in_edges_range(v, g)) {
for (const auto e2 : in_edges_range(v, g)) {
if (e == e2 || contains(*dead, e2)) {
continue;
}
Expand All @@ -386,7 +386,7 @@ void checkSmallOutU(const NGHolder &g, NFAVertex u,
const flat_set<NFAVertex> &parents_u,
map<NFAVertex, bool> &done,
set<NFAEdge> *dead) {
for (const auto &e : out_edges_range(u, g)) {
for (const auto e : out_edges_range(u, g)) {
const NFAVertex v = target(e, g);

if (is_special(v, g)) {
Expand All @@ -399,7 +399,7 @@ void checkSmallOutU(const NGHolder &g, NFAVertex u,

/* Now need check to find any edges which can be removed due to the
* existence of edge e */
for (const auto &e2 : in_edges_range(v, g)) {
for (const auto e2 : in_edges_range(v, g)) {
if (e == e2 || contains(*dead, e2)) {
continue;
}
Expand Down Expand Up @@ -487,7 +487,7 @@ bool removeSiblingsOfStartDotStar(NGHolder &g) {
continue;
}

for (const auto &e : in_edges_range(v, g)) {
for (const auto e : in_edges_range(v, g)) {
NFAVertex u = source(e, g);
if (is_special(u, g)) {
continue;
Expand Down Expand Up @@ -518,7 +518,7 @@ bool optimiseVirtualStarts(NGHolder &g) {
continue;
}

for (const auto &e : in_edges_range(v, g)) {
for (const auto e : in_edges_range(v, g)) {
if (!is_any_start(source(e, g), g)) {
dead.push_back(e);
}
Expand Down

0 comments on commit c4a86cf

Please sign in to comment.