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())
atlyxpreamble << "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
"LyX specific LaTeX commands.\n"
<< move(tmppreamble)
<< std::move(tmppreamble)
<< '\n';
}
// 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;
})
)
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)
{
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)
: bv(b), font(move(f)), fontname("mathnormal"),
: bv(b), font(std::move(f)), fontname("mathnormal"),
textwidth(w), macro_nesting(0),
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)
|| (isMathFont(oldname) && oldcolor != Color_math)))
font.setColor(oldcolor);
#if __cplusplus >= 201402L
return rc;
#else
return move(rc);
#endif
}

View File

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

View File

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

View File

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

View File

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

View File

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