diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-05 08:10:32 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 14:37:00 +0200 |
commit | 8f8aacdeadea1ddf92923f6183c4c67925a25db2 (patch) | |
tree | eefe3d96f1a0b789b34166000f2b424f9affceaf /tools/qscxmlc/qscxmlc.cpp | |
parent | cf65af2f6d4b399cfe28bbf27d1fc43a791ce442 (diff) |
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.
Change-Id: Iaf46b2ba54f3b125aee087c2cacb702d8d564201
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qscxmlc/qscxmlc.cpp')
-rw-r--r-- | tools/qscxmlc/qscxmlc.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/qscxmlc/qscxmlc.cpp b/tools/qscxmlc/qscxmlc.cpp index 63898a4..f8e7a15 100644 --- a/tools/qscxmlc/qscxmlc.cpp +++ b/tools/qscxmlc/qscxmlc.cpp @@ -113,12 +113,12 @@ int run(const QStringList &arguments) const QStringList inputFiles = cmdParser.positionalArguments(); - if (inputFiles.count() < 1) { + if (inputFiles.size() < 1) { errs << QCoreApplication::translate("main", "Error: no input file.") << Qt::endl; cmdParser.showHelp(NoInputFilesError); } - if (inputFiles.count() > 1) { + if (inputFiles.size() > 1) { errs << QCoreApplication::translate("main", "Error: unexpected argument(s): %1") .arg(inputFiles.mid(1).join(QLatin1Char(' '))) << Qt::endl; cmdParser.showHelp(NoInputFilesError); |