diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-06 11:39:54 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 14:37:04 +0200 |
commit | 3ecd6ad4cd0bcec11e17f69e9e5d25057634b048 (patch) | |
tree | 3b31726e55e548e8f1643243715daa4305972995 /tools | |
parent | 8f8aacdeadea1ddf92923f6183c4c67925a25db2 (diff) |
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.
Task-number: QTBUG-99313
Change-Id: I4b4548c9d4a13337731159c1e1184e48bb0a328b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qscxmlc/generator.cpp | 2 | ||||
-rw-r--r-- | tools/qscxmlc/qscxmlc.cpp | 4 | ||||
-rw-r--r-- | tools/qscxmlc/scxmlcppdumper.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/tools/qscxmlc/generator.cpp b/tools/qscxmlc/generator.cpp index 419e5da..bbc4c64 100644 --- a/tools/qscxmlc/generator.cpp +++ b/tools/qscxmlc/generator.cpp @@ -664,7 +664,7 @@ void Generator::generateCode() fprintf(out, "// a) You are using a NOTIFY signal that does not exist. Fix it.\n"); fprintf(out, "// b) You are using a NOTIFY signal that does exist (in a parent class) but has a non-empty parameter list. This is a moc limitation.\n"); fprintf(out, "[[maybe_unused]] static void checkNotifySignalValidity_%s(%s *t) {\n", qualifiedClassNameIdentifier.constData(), cdef->qualified.constData()); - for (const QByteArray &nonClassSignal : qAsConst(cdef->nonClassSignalList)) + for (const QByteArray &nonClassSignal : std::as_const(cdef->nonClassSignalList)) fprintf(out, " t->%s();\n", nonClassSignal.constData()); fprintf(out, "}\n"); } diff --git a/tools/qscxmlc/qscxmlc.cpp b/tools/qscxmlc/qscxmlc.cpp index f8e7a15..fdf89a1 100644 --- a/tools/qscxmlc/qscxmlc.cpp +++ b/tools/qscxmlc/qscxmlc.cpp @@ -68,7 +68,7 @@ static void collectAllDocuments(DocumentModel::ScxmlDocument *doc, QList<DocumentModel::ScxmlDocument *> *docs) { docs->append(doc); - for (DocumentModel::ScxmlDocument *subDoc : qAsConst(doc->allSubDocuments)) + for (DocumentModel::ScxmlDocument *subDoc : std::as_const(doc->allSubDocuments)) collectAllDocuments(subDoc, docs); } @@ -192,7 +192,7 @@ int run(const QStringList &arguments) docs.pop_front(); - for (DocumentModel::ScxmlDocument *doc : qAsConst(docs)) { + for (DocumentModel::ScxmlDocument *doc : std::as_const(docs)) { auto name = doc->root->name; auto prefix = name; if (name.isEmpty()) { diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp index 5e19d33..46eb496 100644 --- a/tools/qscxmlc/scxmlcppdumper.cpp +++ b/tools/qscxmlc/scxmlcppdumper.cpp @@ -512,7 +512,7 @@ void CppDumper::writeImplStart() << Qt::endl; QStringList includes; - for (DocumentModel::ScxmlDocument *doc : qAsConst(m_translationUnit->allDocuments)) { + for (DocumentModel::ScxmlDocument *doc : std::as_const(m_translationUnit->allDocuments)) { switch (doc->root->dataModel) { case DocumentModel::Scxml::NullDataModel: includes += l("QScxmlNullDataModel"); @@ -534,7 +534,7 @@ void CppDumper::writeImplStart() cpp << Qt::endl << QStringLiteral("#include <qscxmlinvokableservice.h>") << Qt::endl << QStringLiteral("#include <qscxmltabledata.h>") << Qt::endl; - for (const QString &inc : qAsConst(includes)) { + for (const QString &inc : std::as_const(includes)) { cpp << l("#include <") << inc << l(">") << Qt::endl; } cpp << Qt::endl |