qt6-bb10/src/gui/kernel
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
..
qaction.cpp Port from qAsConst() to std::as_const() 2022-10-11 23:17:18 +02:00
qaction.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qaction_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qactiongroup.cpp Port from qAsConst() to std::as_const() 2022-10-11 23:17:18 +02:00
qactiongroup.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qactiongroup_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qclipboard.cpp QtGui: replace indexed for loop with range for loop 2022-09-21 22:11:21 +02:00
qclipboard.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qcursor.cpp QCursor: add missing QT_DEPRECATED_VERSION_X_6_0 for deprecated methods 2022-07-21 19:59:07 +02:00
qcursor.h Replace qExchange calls with std::exchange 2022-09-28 17:39:21 +00:00
qcursor_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdnd.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdnd_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdrag.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qdrag.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qevent.cpp Fix duplicated words in documentation 2022-10-19 17:24:26 +00:00
qevent.h Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qevent_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qeventpoint.cpp doc: QEventPoint::timeHeld is reported in seconds, not milliseconds 2022-08-16 16:00:15 +02:00
qeventpoint.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qeventpoint_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgenericplugin.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgenericplugin.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgenericpluginfactory.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qgenericpluginfactory.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qguiapplication.cpp Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qguiapplication.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qguiapplication_p.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qguiapplication_platform.h Add QNativeInterface::QWaylandApplication 2022-10-25 12:52:05 +02:00
qguivariant.cpp Remove qvariant_p.h 2022-07-27 14:51:31 -07:00
qhighdpiscaling.cpp Fix build with -no-feature-highdpiscaling 2022-10-25 12:52:06 +02:00
qhighdpiscaling_p.h Add more logging to QHighDpiScaling 2022-09-09 23:24:06 +02:00
qinputdevice.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinputdevice.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinputdevice_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinputdevicemanager.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinputdevicemanager_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinputdevicemanager_p_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinputmethod.cpp IM: Don't let all widgets support IM by default 2022-07-01 10:47:17 +02:00
qinputmethod.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinputmethod_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinternalmimedata.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qinternalmimedata_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qkeymapper.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qkeymapper_p.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qkeysequence.cpp Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qkeysequence.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qkeysequence_p.h QKeySequence: fix dynamic initialization of shared_empty 2022-05-20 18:07:39 +00:00
qoffscreensurface.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qoffscreensurface.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qoffscreensurface_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qoffscreensurface_platform.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qopenglcontext.cpp Apply Q_CONSTINIT where beneficial 2022-09-01 19:44:19 +02:00
qopenglcontext.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qopenglcontext_p.h QOpenGLContext: de-inline virtual dtors of private classes 2022-07-13 18:18:30 +02:00
qopenglcontext_platform.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qpaintdevicewindow.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qpaintdevicewindow.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qpaintdevicewindow_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qpalette.cpp Make sure that palette cache keys are unique 2022-10-03 23:39:23 +02:00
qpalette.h Replace qExchange calls with std::exchange 2022-09-28 17:39:21 +00:00
qpixelformat.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qpixelformat.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformclipboard.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformclipboard.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformcursor.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformcursor.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformdialoghelper.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformdialoghelper.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformdrag.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformdrag.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformgraphicsbuffer.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformgraphicsbuffer.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformgraphicsbufferhelper.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformgraphicsbufferhelper.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatforminputcontext.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatforminputcontext.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatforminputcontext_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatforminputcontextfactory.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatforminputcontextfactory_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatforminputcontextplugin.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatforminputcontextplugin_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformintegration.cpp Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qplatformintegration.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qplatformintegrationfactory.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformintegrationfactory_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformintegrationplugin.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformintegrationplugin.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformmenu.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformmenu.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformmenu_p.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qplatformnativeinterface.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformnativeinterface.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformoffscreensurface.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformoffscreensurface.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformopenglcontext.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformopenglcontext.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformscreen.cpp Move QPlatformScreen::deviceIndependentGeometry() logic to QScreen 2022-09-08 12:49:30 +02:00
qplatformscreen.h Move QPlatformScreen::deviceIndependentGeometry() logic to QScreen 2022-09-08 12:49:30 +02:00
qplatformscreen_p.h Add QNativeInterface::Private::QWaylandScreen 2022-10-27 12:03:00 +02:00
qplatformservices.cpp add color picking support on wayland using the XDG desktop portal 2022-08-26 13:33:15 +02:00
qplatformservices.h add color picking support on wayland using the XDG desktop portal 2022-08-26 13:33:15 +02:00
qplatformsessionmanager.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformsessionmanager.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformsharedgraphicscache.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformsharedgraphicscache.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformsurface.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformsurface.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformsystemtrayicon.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformsystemtrayicon.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformtheme.cpp Add QPlatformTheme::MenuBarFocusOnAltPressRelease 2022-10-23 13:04:02 +02:00
qplatformtheme.h Add QPlatformTheme::MenuBarFocusOnAltPressRelease 2022-10-23 13:04:02 +02:00
qplatformtheme_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformthemefactory.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformthemefactory_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformthemeplugin.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformthemeplugin.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformwindow.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformwindow.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qplatformwindow_p.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qpointingdevice.cpp doc: Add docs for QPointingDevice::GrabTransition and grabChanged signal 2022-10-11 18:36:11 +02:00
qpointingdevice.h Fix clazy warnings in QPointingDevice::grabChanged signal 2022-10-11 18:36:11 +02:00
qpointingdevice_p.h Use QVarLengthFlatMap for QPointingDevicePrivate::activePoints 2022-09-06 12:34:43 +00:00
qrasterwindow.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qrasterwindow.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qscreen.cpp Add QNativeInterface::Private::QWaylandScreen 2022-10-27 12:03:00 +02:00
qscreen.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qscreen_p.h Share logic for QScreen property update emitting in helper class 2022-09-16 16:32:51 +02:00
qsessionmanager.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsessionmanager.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsessionmanager_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qshapedpixmapdndwindow.cpp Do not set Qt::ToolTip flag for QShapedPixmapWindow 2022-09-15 01:12:52 +02:00
qshapedpixmapdndwindow_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qshortcut.cpp Port from qAsConst() to std::as_const() 2022-10-11 23:17:18 +02:00
qshortcut.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qshortcut_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qshortcutmap.cpp Long live Q_UNREACHABLE_RETURN()! 2022-10-15 22:11:47 +02:00
qshortcutmap_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsimpledrag.cpp Port from container::count() and length() to size() - V5 2022-11-03 14:59:24 +01:00
qsimpledrag_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qstylehints.cpp Properly deprecate QStyleHints::keyboardAutoRepeatRate() 2022-10-01 12:44:48 +02:00
qstylehints.h Properly deprecate QStyleHints::keyboardAutoRepeatRate() 2022-10-01 12:44:48 +02:00
qstylehints_p.h Propagate appearance property from QPlatformTheme to QStyleHints 2022-09-24 01:30:48 +02:00
qsurface.cpp Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsurface.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qsurfaceformat.cpp QtBase: #ifdef out definitions of deprecated methods 2022-07-12 20:43:03 +02:00
qsurfaceformat.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qt_gui_pch.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtestsupport_gui.cpp Update documentation of qWaitForWindowActive / qWaitForWindowExposed 2022-09-30 22:28:31 +02:00
qtestsupport_gui.h Restore signature of qt_handleTouchEvent() 2022-08-31 22:58:24 +02:00
qtguiglobal.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qtguiglobal_p.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwindow.cpp Emit windowStateChanged in QGuiApplicationPrivate instead of QWindow 2022-10-29 14:06:24 +00:00
qwindow.h Replace usages of Q_CLANG_QDOC with Q_QDOC 2022-10-21 09:48:36 +02:00
qwindow_p.h QWindowPrivate::setMinOrMaxSize: port to function_ref 2022-06-30 10:29:01 +02:00
qwindowdefs.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwindowdefs_win.h Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
qwindowsysteminterface.cpp Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00
qwindowsysteminterface.h QWSI: Remove dead code for macOS-specific shortcut-override handling 2022-09-15 15:27:09 +02:00
qwindowsysteminterface_p.h Port from container.count()/length() to size() 2022-10-04 07:40:08 +02:00