qt6-bb10/src/corelib/thread
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
..
qatomic.cpp Document QAtomic testAndSet 2022-09-21 08:31:24 +02:00
qatomic.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qatomic_cxx11.h Get rid of bootstrapped atomics 2022-09-28 01:23:31 +02:00
qbasicatomic.h Q(Basic)Atomic: remove QT_BASIC_ATOMIC_HAS_CONSTRUCTORS 2022-09-28 01:23:31 +02:00
qexception.cpp Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qexception.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qfutex_p.h Long live Q_UNREACHABLE_RETURN()! 2022-10-15 22:11:47 +02:00
qfuture.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qfuture.qdoc Doc: Format certain operators in text 2022-08-23 20:49:47 +02:00
qfuture_impl.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qfutureinterface.cpp Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qfutureinterface.h Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qfutureinterface_p.h QFuture: fix handling of cancelled continuation chain 2022-09-21 01:18:31 +02:00
qfuturesynchronizer.h Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qfuturesynchronizer.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfuturewatcher.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfuturewatcher.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qfuturewatcher_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgenericatomic.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qlocking_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qmutex.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qmutex.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qmutex_mac.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qmutex_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qmutex_unix.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qmutex_win.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qorderedmutexlocker_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qpromise.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qpromise.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qreadwritelock.cpp QReadWriteLock: fix another data race in stateForWaitCondition() 2022-05-17 16:49:31 +00:00
qreadwritelock.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qreadwritelock_p.h Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
qresultstore.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qresultstore.h Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qrunnable.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qrunnable.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsemaphore.cpp QSemaphore: Fix warnings about shift exceeding size on 32-bit 2022-08-16 16:05:25 -07:00
qsemaphore.h Replace qExchange calls with std::exchange 2022-09-28 17:39:21 +00:00
qthread.cpp QThread: add empty functions for the no-thread build 2022-08-26 16:21:47 +02:00
qthread.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qthread_p.h QThread: Clean up bindingStatusOrList if object gets deleted 2022-07-14 19:34:46 +02:00
qthread_unix.cpp Fix possible undefined behavior in clear_thread_data 2022-08-31 19:55:00 +00:00
qthread_win.cpp Apply Q_CONSTINIT where beneficial 2022-09-01 19:44:19 +02:00
qthreadpool.cpp Port from qAsConst() to std::as_const() 2022-10-11 23:17:18 +02:00
qthreadpool.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qthreadpool_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qthreadstorage.cpp Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qthreadstorage.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtsan_impl.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwaitcondition.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwaitcondition.qdoc QWaitCondition/Doc: add a simple explanation of the time units 2022-10-08 01:06:42 -07:00
qwaitcondition_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwaitcondition_unix.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwaitcondition_win.cpp Port from qAsConst() to std::as_const() 2022-10-11 23:17:18 +02:00