summaryrefslogtreecommitdiff
path: root/src/tools/cplusplus-update-frontend
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-07 14:46:06 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-07 13:47:53 +0000
commit8eb4d52342fe3a6ede1c1dce3174d95bfa0cea88 (patch)
tree0f5556c5e4098e75853e3d9ee2620e0306f0cf2a /src/tools/cplusplus-update-frontend
parent90de29d530dfc2921d5179977b3393c11a3cc238 (diff)
downloadqt-creator-8eb4d52342fe3a6ede1c1dce3174d95bfa0cea88.tar.gz
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: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/tools/cplusplus-update-frontend')
-rw-r--r--src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp b/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp
index d4708356e5..f9f9358b83 100644
--- a/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp
+++ b/src/tools/cplusplus-update-frontend/cplusplus-update-frontend.cpp
@@ -1020,7 +1020,7 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir)
StringClassSpecifierASTMap classesNeedingLastToken;
// find all classes with method declarations for firstToken/lastToken
- for (ClassSpecifierAST *classAST : qAsConst(astNodes.deriveds)) {
+ for (ClassSpecifierAST *classAST : std::as_const(astNodes.deriveds)) {
const QString className = oo(classAST->symbol->name());
if (className.isEmpty())
continue;
@@ -1110,7 +1110,7 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir)
const int documentEnd = cpp_document.lastBlock().position() + cpp_document.lastBlock().length() - 1;
Utils::ChangeSet changes;
- for (GenInfo info : qAsConst(todo)) {
+ for (GenInfo info : std::as_const(todo)) {
if (info.end > documentEnd)
info.end = documentEnd;
@@ -1318,7 +1318,7 @@ QStringList generateAST_H(const Snapshot &snapshot, const QDir &cplusplusDir, co
Overview oo;
QStringList castMethods;
- for (ClassSpecifierAST *classAST : qAsConst(astNodes.deriveds)) {
+ for (ClassSpecifierAST *classAST : std::as_const(astNodes.deriveds)) {
cursors[classAST] = removeCastMethods(classAST);
const QString className = oo(classAST->symbol->name());
const QString methodName = QLatin1String("as") + className.mid(0, className.length() - 3);
@@ -1485,7 +1485,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
Control *control = AST_h_document->control();
QSet<QString> classesSet;
- for (ClassSpecifierAST *classNode : qAsConst(astNodes.deriveds)) {
+ for (ClassSpecifierAST *classNode : std::as_const(astNodes.deriveds)) {
Class *klass = classNode->symbol;
const Identifier *match0_id = control->identifier("match0");
@@ -1540,7 +1540,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
<< " {" << Qt::endl
<< " " << className << " *ast = new (&pool) " << className << ';' << Qt::endl;
- for (const StringPair &p : qAsConst(args))
+ for (const StringPair &p : std::as_const(args))
out << " ast->" << p.second << " = " << p.second << ';' << Qt::endl;
out << " return ast;" << Qt::endl << " }" << Qt::endl << Qt::endl;
@@ -1548,7 +1548,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
QStringList classesList = Utils::toList(classesSet);
Utils::sort(classesList);
- for (const QString &className : qAsConst(classesList)) {
+ for (const QString &className : std::as_const(classesList)) {
const QString methodName = className.left(className.length() - 3);
const QString elementName = className.left(className.length() - 7) + QLatin1String("AST");
out << " " << className << " *" << methodName << "(" << elementName << " *value, "