Always qualify calls to std::move()

This quashes a new warning in clang++ 15, when std::move() (the
one-parameter version) is used as simply move(). There is a strong
recommendation from WG21 to avoid that.

Details here: https://reviews.llvm.org/D119670

It might be that we should not use that many move()s. I am not
competent to decide on that.

I also used this occasion to get rid of a spacial casing for C++11
that does not seem necessary after all.
This commit is contained in:
Jean-Marc Lasgouttes 2022-10-21 14:11:36 +02:00
parent 647c7b1ac3
commit fff28c5756
12 changed files with 22 additions and 26 deletions

View File

@ -2277,7 +2277,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
if (!tmppreamble.str.empty()) if (!tmppreamble.str.empty())
atlyxpreamble << "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% " atlyxpreamble << "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
"LyX specific LaTeX commands.\n" "LyX specific LaTeX commands.\n"
<< move(tmppreamble) << std::move(tmppreamble)
<< '\n'; << '\n';
} }
// the text class specific preamble // the text class specific preamble

View File

@ -837,7 +837,7 @@ void addSnippet(std::list<TexString> & list, TexString ts, bool allow_dupes)
return ts.str == ts2.str; return ts.str == ts2.str;
}) })
) )
list.push_back(move(ts)); list.push_back(std::move(ts));
} }
@ -854,7 +854,7 @@ TexString getSnippets(std::list<TexString> const & list)
void LaTeXFeatures::addPreambleSnippet(TexString snippet, bool allow_dupes) void LaTeXFeatures::addPreambleSnippet(TexString snippet, bool allow_dupes)
{ {
addSnippet(preamble_snippets_, move(snippet), allow_dupes); addSnippet(preamble_snippets_, std::move(snippet), allow_dupes);
} }

View File

@ -33,7 +33,7 @@ namespace lyx {
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w) MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w)
: bv(b), font(move(f)), fontname("mathnormal"), : bv(b), font(std::move(f)), fontname("mathnormal"),
textwidth(w), macro_nesting(0), textwidth(w), macro_nesting(0),
solid_line_thickness_(1), solid_line_offset_(1), dotted_line_thickness_(1) solid_line_thickness_(1), solid_line_offset_(1), dotted_line_thickness_(1)
{ {
@ -75,11 +75,7 @@ Changer MetricsBase::changeFontSet(string const & name)
&& ((isTextFont(oldname) && oldcolor != Color_foreground) && ((isTextFont(oldname) && oldcolor != Color_foreground)
|| (isMathFont(oldname) && oldcolor != Color_math))) || (isMathFont(oldname) && oldcolor != Color_math)))
font.setColor(oldcolor); font.setColor(oldcolor);
#if __cplusplus >= 201402L
return rc; return rc;
#else
return move(rc);
#endif
} }

View File

@ -38,14 +38,14 @@ namespace lyx {
TexString::TexString(docstring s) TexString::TexString(docstring s)
: str(move(s)), texrow(TexRow()) : str(std::move(s)), texrow(TexRow())
{ {
texrow.setRows(1 + count(str.begin(), str.end(), '\n')); texrow.setRows(1 + count(str.begin(), str.end(), '\n'));
} }
TexString::TexString(docstring s, TexRow t) TexString::TexString(docstring s, TexRow t)
: str(move(s)), texrow(move(t)) : str(std::move(s)), texrow(std::move(t))
{ {
validate(); validate();
} }
@ -235,7 +235,7 @@ void TexRow::append(TexRow other)
RowList::iterator it = other.rowlist_.begin(); RowList::iterator it = other.rowlist_.begin();
RowList::iterator const end = other.rowlist_.end(); RowList::iterator const end = other.rowlist_.end();
LASSERT(it != end, return); LASSERT(it != end, return);
currentRow().append(move(*it++)); currentRow().append(std::move(*it++));
move(it, end, back_inserter(rowlist_)); move(it, end, back_inserter(rowlist_));
} }

View File

@ -147,7 +147,7 @@ shared_ptr<Toc> TocBackend::toc(string const & type)
TocBuilder & TocBackend::builder(string const & type) TocBuilder & TocBackend::builder(string const & type)
{ {
auto p = lyx::make_unique<TocBuilder>(toc(type)); auto p = lyx::make_unique<TocBuilder>(toc(type));
return * builders_.insert(make_pair(type, move(p))).first->second; return * builders_.insert(make_pair(type, std::move(p))).first->second;
} }

View File

@ -34,7 +34,7 @@ namespace frontend {
Action::Action(FuncRequest func, QIcon const & icon, QString const & text, Action::Action(FuncRequest func, QIcon const & icon, QString const & text,
QString const & tooltip, QObject * parent) QString const & tooltip, QObject * parent)
: QAction(parent), func_(make_shared<FuncRequest>(move(func))), icon_(icon) : QAction(parent), func_(make_shared<FuncRequest>(std::move(func))), icon_(icon)
{ {
init(text, tooltip); init(text, tooltip);
} }

View File

@ -356,7 +356,7 @@ void InsetArgument::latexArgument(otexstream & os,
os << presetarg; os << presetarg;
if (!presetarg.empty() && !ts.str.empty()) if (!presetarg.empty() && !ts.str.empty())
os << ", "; os << ", ";
os << move(ts); os << std::move(ts);
if (add_braces) if (add_braces)
os << '}'; os << '}';
os << rdelim; os << rdelim;

View File

@ -965,7 +965,7 @@ TexString InsetFloat::getCaption(OutputParams const & runparams) const
// Protect ']' // Protect ']'
if (arg.find(']') != docstring::npos) if (arg.find(']') != docstring::npos)
arg = '{' + arg + '}'; arg = '{' + arg + '}';
os << move(ts); os << std::move(ts);
os << ']'; os << ']';
if (!runparams.nice) if (!runparams.nice)
os << safebreakln; os << safebreakln;

View File

@ -369,7 +369,7 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const
os << '[' << float_placement << "]"; os << '[' << float_placement << "]";
} else if (captionfirst && !caption.str.empty()) { } else if (captionfirst && !caption.str.empty()) {
os << breakln << "\\lyxmintcaption[t]{" os << breakln << "\\lyxmintcaption[t]{"
<< move(caption) << "}\n"; << std::move(caption) << "}\n";
} }
os << breakln << "\\begin{minted}"; os << breakln << "\\begin{minted}";
if (!param_string.empty()) if (!param_string.empty())
@ -378,11 +378,11 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const
<< code << breakln << "\\end{minted}\n"; << code << breakln << "\\end{minted}\n";
if (isfloat) { if (isfloat) {
if (!caption.str.empty()) if (!caption.str.empty())
os << "\\caption{" << move(caption) << "}\n"; os << "\\caption{" << std::move(caption) << "}\n";
os << "\\end{listing}\n"; os << "\\end{listing}\n";
} else if (!captionfirst && !caption.str.empty()) { } else if (!captionfirst && !caption.str.empty()) {
os << breakln << "\\lyxmintcaption[b]{" os << breakln << "\\lyxmintcaption[b]{"
<< move(caption) << "}"; << std::move(caption) << "}";
} }
} else { } else {
OutputParams rp = runparams; OutputParams rp = runparams;
@ -396,7 +396,7 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const
os << safebreakln; os << safebreakln;
os << "["; os << "[";
if (!caption.str.empty()) { if (!caption.str.empty()) {
os << "caption={" << move(caption) << '}'; os << "caption={" << std::move(caption) << '}';
if (!param_string.empty()) if (!param_string.empty())
os << ','; os << ',';
} }

View File

@ -1118,7 +1118,7 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool cons
tclass.counters().current_float(savecnt.current_float()); tclass.counters().current_float(savecnt.current_float());
tclass.counters().isSubfloat(savecnt.isSubfloat()); tclass.counters().isSubfloat(savecnt.isSubfloat());
buffer().updateBuffer(it2, utype, deleted); buffer().updateBuffer(it2, utype, deleted);
tclass.counters() = move(savecnt); tclass.counters() = std::move(savecnt);
} }
} }

View File

@ -61,7 +61,7 @@ struct IconvProcessor::Handler {
IconvProcessor::IconvProcessor(string tocode, string fromcode) IconvProcessor::IconvProcessor(string tocode, string fromcode)
: tocode_(move(tocode)), fromcode_(move(fromcode)) : tocode_(std::move(tocode)), fromcode_(std::move(fromcode))
{} {}
@ -251,7 +251,7 @@ IconvProcessor & getProc(map<string, IconvProcessor> & processors,
map<string, IconvProcessor>::iterator const it = processors.find(encoding); map<string, IconvProcessor>::iterator const it = processors.find(encoding);
if (it == processors.end()) { if (it == processors.end()) {
IconvProcessor p(fromcode, tocode); IconvProcessor p(fromcode, tocode);
return processors.insert(make_pair(encoding, move(p))).first->second; return processors.insert(make_pair(encoding, std::move(p))).first->second;
} }
return it->second; return it->second;
} }

View File

@ -90,7 +90,7 @@ size_t otexstringstream::length()
TexString otexstringstream::release() TexString otexstringstream::release()
{ {
TexString ts(ods_.str(), move(texrow())); TexString ts(ods_.str(), std::move(texrow()));
// reset this // reset this
texrow() = TexRow(); texrow() = TexRow();
ods_.clear(); ods_.clear();
@ -164,8 +164,8 @@ otexstream & operator<<(otexstream & ots, odocstream_manip pf)
otexrowstream & operator<<(otexrowstream & ots, TexString ts) otexrowstream & operator<<(otexrowstream & ots, TexString ts)
{ {
ts.validate(); ts.validate();
ots.os() << move(ts.str); ots.os() << std::move(ts.str);
ots.texrow().append(move(ts.texrow)); ots.texrow().append(std::move(ts.texrow));
return ots; return ots;
} }
@ -201,7 +201,7 @@ otexstream & operator<<(otexstream & ots, TexString ts)
ots.canBreakLine(ts.str[len - 2] != '\n'); ots.canBreakLine(ts.str[len - 2] != '\n');
ots.lastChar(ts.str[len - 1]); ots.lastChar(ts.str[len - 1]);
otrs << move(ts); otrs << std::move(ts);
return ots; return ots;
} }