qt5base-lts/tests/auto/corelib/io
Marc Mutz 1c6bf3e09e Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:

    const std::string o = "object";

    auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };

    auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
        auto exprOfDeclaredType = [&](auto decl) {
            return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
        };
        return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
    };

    auto renameMethod = [&] (ArrayRef<StringRef> classes,
                            StringRef from, StringRef to) {
        return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
                            callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
                        changeTo(cat(access(o, cat(to)), "()")),
                        cat("use '", to, "' instead of '", from, "'"));
    };

    renameMethod(<classes>, "count", "size");
    renameMethod(<classes>, "length", "size");

except that the on() matcher has been replaced by one that doesn't
ignoreParens().

a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.

Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().

Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-03 14:59:24 +01:00
..
largefile Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qabstractfileengine Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qbuffer Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qdataurl Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qdebug Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qdir Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qdiriterator Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qfile tst_QFile: remove unused variable on Windows 2022-10-25 18:33:14 -07:00
qfileinfo QFileInfo: add unittest for setFileTime() 2022-11-01 21:33:15 +02:00
qfileselector Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qfilesystementry Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qfilesystemmetadata Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qfilesystemwatcher Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qiodevice Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qipaddress Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qlockfile Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qloggingcategory Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qloggingregistry Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qnodebug Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qprocess Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qprocess-noapplication Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qprocessenvironment Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qresourceengine tst_QResourceEngine::checkStructure(): fix name of some data rows 2022-10-11 11:23:04 +02:00
qsavefile Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qsettings Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qstandardpaths Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qstorageinfo Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00
qtemporarydir Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qtemporaryfile Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qurl Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qurlinternal Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qurlquery tst_QUrlQuery: remove duplicate of reconstructQuery data row 2022-10-11 11:22:31 +02:00
qurluts46 Update UCD to Revision 30 2022-10-11 14:10:59 +00:00
CMakeLists.txt Change the license of all CMakeLists.txt and *.cmake files to BSD 2022-08-23 23:58:42 +02:00