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>
| commit | 8f8aacdeadea1ddf92923f6183c4c67925a25db2 |
| parent | cf65af2f6d4b399cfe28bbf27d1fc43a791ce442 |
| author | Marc Mutz <marc.mutz@qt.io> |
| committer | Marc Mutz <marc.mutz@qt.io> |
| commit time | Fri, 7 Oct 2022 14:37:00 +0200 |
- M src/scxml/qscxmlcompiler.cpp
- M src/scxml/qscxmlexecutablecontent.cpp
- M src/scxml/qscxmlnulldatamodel.cpp
- M src/statemachineqml/childrenprivate_p.h
- M src/statemachineqml/signaltransition.cpp
- M tests/auto/compiled/tst_compiled.cpp
- M tests/auto/dynamicmetaobject/tst_dynamicmetaobject.cpp
- M tests/auto/parser/tst_parser.cpp
- M tests/auto/qml/scxmlqmlcpp/tst_scxmlqmlcpp.cpp
- M tests/auto/qstatemachine/qstate/tst_qstate.cpp
- M tests/auto/qstatemachine/qstatemachine/tst_qstatemachine.cpp
- M tests/auto/scion/tst_scion.cpp
- M tests/auto/statemachine/tst_statemachine.cpp
- M tools/qscxmlc/generator.cpp
- M tools/qscxmlc/moc.h
- M tools/qscxmlc/qscxmlc.cpp
- M tools/qscxmlc/scxmlcppdumper.cpp