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 /tools/qmlprofiler/qmlprofilerdata.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 'tools/qmlprofiler/qmlprofilerdata.cpp')
| -rw-r--r-- | tools/qmlprofiler/qmlprofilerdata.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/qmlprofiler/qmlprofilerdata.cpp b/tools/qmlprofiler/qmlprofilerdata.cpp index 51ac32f2d5..cac1364b87 100644 --- a/tools/qmlprofiler/qmlprofilerdata.cpp +++ b/tools/qmlprofiler/qmlprofilerdata.cpp @@ -248,7 +248,7 @@ bool compareStartTimes(const QQmlProfilerEvent &t1, const QQmlProfilerEvent &t2) void QmlProfilerData::sortStartTimes() { - if (d->events.count() < 2) + if (d->events.size() < 2) return; // assuming startTimes is partially sorted @@ -523,7 +523,7 @@ bool QmlProfilerData::save(const QString &filename) } case RangeEnd: { QStack<qint64> &ends = rangeEnds[type.rangeType()]; - if (starts.length() > ends.length()) { + if (starts.size() > ends.size()) { ends.push(event.timestamp()); if (--level == 0) sendPending(); @@ -542,7 +542,7 @@ bool QmlProfilerData::save(const QString &filename) } for (int i = 0; i < MaximumRangeType; ++i) { - while (rangeEnds[i].length() < rangeStarts[i].length()) { + while (rangeEnds[i].size() < rangeStarts[i].size()) { rangeEnds[i].push(d->traceEndTime); --level; } @@ -597,7 +597,7 @@ void QmlProfilerData::setState(QmlProfilerData::State state) int QmlProfilerData::numLoadedEventTypes() const { - return d->eventTypes.length(); + return d->eventTypes.size(); } #include "moc_qmlprofilerdata.cpp" |
