diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-05 07:29:16 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-07 23:38:48 +0200 |
commit | 958cd3ee1094a068b6d0ff27c73a4b3caff088ad (patch) | |
tree | 6d3816fedf5dab2307675fd6ef70d39758e246f5 /src/qml/qml/qqmlirloader.cpp | |
parent | e8e03215654ca730243336a80453cf9396cbdf58 (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: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlirloader.cpp')
-rw-r--r-- | src/qml/qml/qqmlirloader.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlirloader.cpp b/src/qml/qml/qqmlirloader.cpp index 4ead4d05cb..5c322ab021 100644 --- a/src/qml/qml/qqmlirloader.cpp +++ b/src/qml/qml/qqmlirloader.cpp @@ -98,7 +98,7 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali object->bindings->append(b); if (b->type() == QV4::CompiledData::Binding::Type_Script) { functionIndices.append(b->value.compiledScriptIndex); - b->value.compiledScriptIndex = functionIndices.count() - 1; + b->value.compiledScriptIndex = functionIndices.size() - 1; QmlIR::CompiledFunctionOrExpression *foe = pool->New<QmlIR::CompiledFunctionOrExpression>(); foe->nameIndex = 0; @@ -106,9 +106,9 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali QQmlJS::AST::ExpressionNode *expr; if (b->stringIndex != quint32(0)) { - const int start = output->code.length(); + const int start = output->code.size(); const QString script = output->stringAt(b->stringIndex); - const int length = script.length(); + const int length = script.size(); output->code.append(script); expr = new (pool) FakeExpression(start, length); } else @@ -118,7 +118,7 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali } } - Q_ASSERT(object->functionsAndExpressions->count == functionIndices.count()); + Q_ASSERT(object->functionsAndExpressions->count == functionIndices.size()); for (uint i = 0; i < serializedObject->nSignals; ++i) { const QV4::CompiledData::Signal *serializedSignal = serializedObject->signalAt(i); @@ -174,7 +174,7 @@ QmlIR::Object *QQmlIRLoader::loadObject(const QV4::CompiledData::Object *seriali const QV4::CompiledData::Function *compiledFunction = unit->functionAt(*functionIdx); functionIndices.append(*functionIdx); - f->index = functionIndices.count() - 1; + f->index = functionIndices.size() - 1; f->location = compiledFunction->location; f->nameIndex = compiledFunction->nameIndex; f->returnType = compiledFunction->returnType; |