Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change 'move' to 'std::move' to avoid unqualified move call warnings on Clang 17+ #400

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion chimera/ch_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void ch_compile_multi_int(const char *const *expressions, const unsigned *flags,
auto patternData =
ue2::make_unique<PatternData>(myExpr, myFlags, i, myId, mode, match_limit,
match_limit_recursion, platform);
pcres.push_back(move(patternData));
pcres.push_back(std::move(patternData));
PatternData &curr = *pcres.back();

if (!(myFlags & HS_FLAG_SINGLEMATCH)) {
Expand Down
6 changes: 3 additions & 3 deletions src/fdr/fdr_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class FDRCompiler : noncopyable {
const FDREngineDescription &eng_in,
bool make_small_in, const Grey &grey_in)
: eng(eng_in), grey(grey_in), tab(eng_in.getTabSizeBytes()),
lits(move(lits_in)), bucketToLits(move(bucketToLits_in)),
lits(std::move(lits_in)), bucketToLits(std::move(bucketToLits_in)),
make_small(make_small_in) {}

bytecode_ptr<FDR> build();
Expand Down Expand Up @@ -505,7 +505,7 @@ map<BucketIndex, vector<LiteralIndex>> assignStringsToBuckets(
map<BucketIndex, vector<LiteralIndex>> bucketToLits;
size_t bucketCnt = buckets.size();
for (size_t i = 0; i < bucketCnt; i++) {
bucketToLits.emplace(bucketCnt - i - 1, move(buckets[i]));
bucketToLits.emplace(bucketCnt - i - 1, std::move(buckets[i]));
}

return bucketToLits;
Expand Down Expand Up @@ -868,7 +868,7 @@ unique_ptr<HWLMProto> fdrBuildProtoInternal(u8 engType,
auto bucketToLits = assignStringsToBuckets(lits, *des);
addIncludedInfo(lits, des->getNumBuckets(), bucketToLits);
auto proto =
ue2::make_unique<HWLMProto>(engType, move(des), lits, bucketToLits,
ue2::make_unique<HWLMProto>(engType, std::move(des), lits, bucketToLits,
make_small);
return proto;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fdr/fdr_confirm_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ setupFullConfs(const vector<hwlmLiteral> &lits,
DEBUG_PRINTF("b %d sz %zu\n", b, vl.size());
auto fc = getFDRConfirm(vl, make_small);
totalConfirmSize += fc.size();
bc2Conf.emplace(b, move(fc));
bc2Conf.emplace(b, std::move(fc));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/fdr/teddy_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class TeddyCompiler : noncopyable {
const TeddyEngineDescription &eng_in, bool make_small_in,
const Grey &grey_in)
: eng(eng_in), grey(grey_in), lits(lits_in),
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {}
bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}

bytecode_ptr<FDR> build();
};
Expand Down Expand Up @@ -677,7 +677,7 @@ unique_ptr<HWLMProto> teddyBuildProtoHinted(
return nullptr;
}

return ue2::make_unique<HWLMProto>(engType, move(des), lits,
return ue2::make_unique<HWLMProto>(engType, std::move(des), lits,
bucketToLits, make_small);
}

Expand Down
16 changes: 8 additions & 8 deletions src/hwlm/hwlm_build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,24 @@ using namespace std;
namespace ue2 {

HWLMProto::HWLMProto(u8 engType_in, vector<hwlmLiteral> lits_in)
: engType(engType_in), lits(move(lits_in)) {}
: engType(engType_in), lits(std::move(lits_in)) {}

HWLMProto::HWLMProto(u8 engType_in,
unique_ptr<FDREngineDescription> eng_in,
vector<hwlmLiteral> lits_in,
map<u32, vector<u32>> bucketToLits_in,
bool make_small_in)
: engType(engType_in), fdrEng(move(eng_in)), lits(move(lits_in)),
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {}
: engType(engType_in), fdrEng(std::move(eng_in)), lits(std::move(lits_in)),
bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}

HWLMProto::HWLMProto(u8 engType_in,
unique_ptr<TeddyEngineDescription> eng_in,
vector<hwlmLiteral> lits_in,
map<u32, vector<u32>> bucketToLits_in,
bool make_small_in)
: engType(engType_in), teddyEng(move(eng_in)),
lits(move(lits_in)),
bucketToLits(move(bucketToLits_in)), make_small(make_small_in) {}
: engType(engType_in), teddyEng(std::move(eng_in)),
lits(std::move(lits_in)),
bucketToLits(std::move(bucketToLits_in)), make_small(make_small_in) {}

HWLMProto::~HWLMProto() {}

Expand Down Expand Up @@ -133,14 +133,14 @@ bytecode_ptr<HWLM> hwlmBuild(const HWLMProto &proto, const CompileContext &cc,
if (noodle) {
engSize = noodle.size();
}
eng = move(noodle);
eng = std::move(noodle);
} else {
DEBUG_PRINTF("building a new deal\n");
auto fdr = fdrBuildTable(proto, cc.grey);
if (fdr) {
engSize = fdr.size();
}
eng = move(fdr);
eng = std::move(fdr);
}

if (!eng) {
Expand Down
8 changes: 4 additions & 4 deletions src/nfa/accel_dfa_build_strat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ void extend(const raw_dfa &rdfa, const vector<CharReach> &rev_map,
} else {
path pp = append(p, CharReach(), p.dest);
all[p.dest].push_back(pp);
out.push_back(move(pp));
out.push_back(std::move(pp));
}
}

if (!s.reports_eod.empty()) {
path pp = append(p, CharReach(), p.dest);
all[p.dest].push_back(pp);
out.push_back(move(pp));
out.push_back(std::move(pp));
}

flat_map<u32, CharReach> dest;
Expand All @@ -155,7 +155,7 @@ void extend(const raw_dfa &rdfa, const vector<CharReach> &rev_map,
DEBUG_PRINTF("----good: [%s] -> %u\n",
describeClasses(pp.reach).c_str(), pp.dest);
all[e.first].push_back(pp);
out.push_back(move(pp));
out.push_back(std::move(pp));
}
}

Expand All @@ -172,7 +172,7 @@ vector<vector<CharReach>> generate_paths(const raw_dfa &rdfa,
extend(rdfa, rev_map, p, all, next_gen);
}

paths = move(next_gen);
paths = std::move(next_gen);
}

dump_paths(paths);
Expand Down
2 changes: 1 addition & 1 deletion src/nfa/goughcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ unique_ptr<raw_report_info> gough_build_strat::gatherReports(
*arbReport = MO_INVALID_IDX;
assert(!ri->rl.empty()); /* all components should be able to generate
reports */
return move(ri);
return std::move(ri);
}

u32 raw_gough_report_info_impl::getReportListSize() const {
Expand Down
6 changes: 3 additions & 3 deletions src/nfa/limex_compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ u32 addReports(const flat_set<ReportID> &r, vector<ReportID> &reports,

u32 offset = verify_u32(reports.size());
insert(&reports, reports.end(), my_reports);
reports_cache.emplace(move(my_reports), offset);
reports_cache.emplace(std::move(my_reports), offset);
return offset;
}

Expand Down Expand Up @@ -1064,7 +1064,7 @@ void buildAcceptsList(const build_info &args, ReportListCache &reports_cache,
a.reports = addReports(h[v].reports, reports, reports_cache);
}
a.squash = addSquashMask(args, v, squash);
accepts.push_back(move(a));
accepts.push_back(std::move(a));
}
}

Expand Down Expand Up @@ -1819,7 +1819,7 @@ struct Factory {
*streamState += streamStateLen;
*scratchStateSize += sizeof(RepeatControl);

out.emplace_back(move(info));
out.emplace_back(std::move(info));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/nfa/mcclellancompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ unique_ptr<raw_report_info> mcclellan_build_strat::gatherReports(
*isSingleReport = 0;
}

return move(ri);
return std::move(ri);
}

u32 raw_report_info_impl::getReportListSize() const {
Expand Down
18 changes: 9 additions & 9 deletions src/nfa/rdfa_merge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ void mergeDfas(vector<unique_ptr<raw_dfa>> &dfas, size_t max_states,

queue<unique_ptr<raw_dfa>> q;
for (auto &dfa : dfas) {
q.push(move(dfa));
q.push(std::move(dfa));
}

// All DFAs are now on the queue, so we'll clear the vector and use it for
Expand All @@ -329,30 +329,30 @@ void mergeDfas(vector<unique_ptr<raw_dfa>> &dfas, size_t max_states,

while (q.size() > 1) {
// Attempt to merge the two front elements of the queue.
unique_ptr<raw_dfa> d1 = move(q.front());
unique_ptr<raw_dfa> d1 = std::move(q.front());
q.pop();
unique_ptr<raw_dfa> d2 = move(q.front());
unique_ptr<raw_dfa> d2 = std::move(q.front());
q.pop();

auto rdfa = mergeTwoDfas(d1.get(), d2.get(), max_states, rm, grey);
if (rdfa) {
q.push(move(rdfa));
q.push(std::move(rdfa));
} else {
DEBUG_PRINTF("failed to merge\n");
// Put the larger of the two DFAs on the output list, retain the
// smaller one on the queue for further merge attempts.
if (d2->states.size() > d1->states.size()) {
dfas.push_back(move(d2));
q.push(move(d1));
dfas.push_back(std::move(d2));
q.push(std::move(d1));
} else {
dfas.push_back(move(d1));
q.push(move(d2));
dfas.push_back(std::move(d1));
q.push(std::move(d2));
}
}
}

while (!q.empty()) {
dfas.push_back(move(q.front()));
dfas.push_back(std::move(q.front()));
q.pop();
}

Expand Down
2 changes: 1 addition & 1 deletion src/nfa/shengcompile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ unique_ptr<raw_report_info> sheng_build_strat::gatherReports(
*isSingleReport = 0;
}

return move(ri);
return std::move(ri);
}

u32 sheng_build_strat::max_allowed_offset_accel() const {
Expand Down
2 changes: 1 addition & 1 deletion src/nfagraph/ng_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ BuiltExpression NFABuilderImpl::getGraph() {
throw CompileError("Pattern too large.");
}

return { expr, move(graph) };
return { expr, std::move(graph) };
}

void NFABuilderImpl::setNodeReportID(Position pos, int offsetAdjust) {
Expand Down
4 changes: 2 additions & 2 deletions src/nfagraph/ng_calc_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
pruneUseless(*gc);
DEBUG_PRINTF("component %zu has %zu vertices\n", comps.size(),
num_vertices(*gc));
comps.push_back(move(gc));
comps.push_back(std::move(gc));
}

// Another component to handle the direct shell-to-shell edges.
Expand All @@ -386,7 +386,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
pruneUseless(*gc);
DEBUG_PRINTF("shell edge component %zu has %zu vertices\n",
comps.size(), num_vertices(*gc));
comps.push_back(move(gc));
comps.push_back(std::move(gc));
*shell_comp = true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/nfagraph/ng_equivalence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ vector<VertexInfoSet> partitionGraph(vector<unique_ptr<VertexInfo>> &infos,
unsigned eq_class = classes.size();
vi->equivalence_class = eq_class;
classes.push_back({vi.get()});
classinfomap.emplace(move(ci), eq_class);
classinfomap.emplace(std::move(ci), eq_class);
} else {
// vertex is added to an existing class.
unsigned eq_class = ii->second;
Expand Down Expand Up @@ -442,7 +442,7 @@ void equivalence(vector<VertexInfoSet> &classes, WorkQueue &work_queue,
classes[cur_class].erase(vi);
new_class_vertices.insert(vi);
}
classes.push_back(move(new_class_vertices));
classes.push_back(std::move(new_class_vertices));

if (contains(tmi->first, cur_class)) {
reval_queue.push(new_class);
Expand Down
6 changes: 3 additions & 3 deletions src/nfagraph/ng_limex_accel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void findBestInternal(vector<vector<CharReach>>::const_iterator pb,
DEBUG_PRINTF("worse\n");
continue;
}
priority_path.push_back(move(as));
priority_path.push_back(std::move(as));
}

sort(priority_path.begin(), priority_path.end());
Expand Down Expand Up @@ -422,7 +422,7 @@ void findDoubleBest(vector<vector<CharReach> >::const_iterator pb,
DEBUG_PRINTF("worse\n");
continue;
}
priority_path.push_back(move(as));
priority_path.push_back(std::move(as));
}

sort(priority_path.begin(), priority_path.end());
Expand Down Expand Up @@ -569,7 +569,7 @@ AccelScheme findBestAccelScheme(vector<vector<CharReach>> paths,
DAccelScheme da = findBestDoubleAccelScheme(paths, terminating);
if (da.double_byte.size() <= DOUBLE_SHUFTI_LIMIT) {
rv.double_byte = std::move(da.double_byte);
rv.double_cr = move(da.double_cr);
rv.double_cr = std::move(da.double_cr);
rv.double_offset = da.double_offset;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/nfagraph/ng_literal_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace {

struct LitGraphVertexProps {
LitGraphVertexProps() = default;
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(move(c_in)) {}
explicit LitGraphVertexProps(ue2_literal::elem c_in) : c(std::move(c_in)) {}
ue2_literal::elem c; // string element (char + bool)
size_t index = 0; // managed by ue2_graph
};
Expand Down
2 changes: 1 addition & 1 deletion src/nfagraph/ng_literal_decorated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ bool handleDecoratedLiterals(RoseBuild &rose, const NGHolder &g,
DEBUG_PRINTF("failed validation\n");
return false;
}
masks.push_back(move(pm));
masks.push_back(std::move(pm));
}

for (const auto &pm : masks) {
Expand Down
4 changes: 2 additions & 2 deletions src/nfagraph/ng_region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void checkAndAddExitCandidate(const AcyclicGraph &g,

if (!open.empty()) {
DEBUG_PRINTF("exit %zu\n", g[v].index);
exits.push_back(move(v_exit));
exits.push_back(std::move(v_exit));
}
}

Expand Down Expand Up @@ -210,7 +210,7 @@ void buildInitialCandidate(const AcyclicGraph &g,

if (it != ite) {
enters.erase(*it);
open_jumps = move(enters);
open_jumps = std::move(enters);
DEBUG_PRINTF("oj size = %zu\n", open_jumps.size());
++it;
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/nfagraph/ng_som.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ void clearProperInEdges(NGHolder &g, const NFAVertex sink) {
namespace {
struct SomRevNfa {
SomRevNfa(NFAVertex s, ReportID r, bytecode_ptr<NFA> n)
: sink(s), report(r), nfa(move(n)) {}
: sink(s), report(r), nfa(std::move(n)) {}
NFAVertex sink;
ReportID report;
bytecode_ptr<NFA> nfa;
Expand Down Expand Up @@ -1800,7 +1800,7 @@ bool makeSomRevNfa(vector<SomRevNfa> &som_nfas, const NGHolder &g,
return false;
}

som_nfas.emplace_back(sink, report, move(nfa));
som_nfas.emplace_back(sink, report, std::move(nfa));
return true;
}

Expand Down Expand Up @@ -1840,7 +1840,7 @@ bool doSomRevNfa(NG &ng, NGHolder &g, const CompileContext &cc) {
assert(som_nfa.nfa);

// Transfer ownership of the NFA to the SOM slot manager.
u32 comp_id = ng.ssm.addRevNfa(move(som_nfa.nfa), maxWidth);
u32 comp_id = ng.ssm.addRevNfa(std::move(som_nfa.nfa), maxWidth);

// Replace this report on 'g' with a SOM_REV_NFA report pointing at our
// new component.
Expand Down Expand Up @@ -1873,7 +1873,7 @@ u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, NGHolder &g,
max(cc.grey.maxHistoryAvailable, ng.maxSomRevHistoryAvailable));
}

return ng.ssm.addRevNfa(move(nfa), maxWidth);
return ng.ssm.addRevNfa(std::move(nfa), maxWidth);
}

static
Expand Down