diff options
author | Marc Mutz <[email protected]> | 2023-03-10 18:38:14 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <[email protected]> | 2023-03-16 06:35:00 +0000 |
commit | c83a7d96bf758e78518011ade30b5fb2ca588c09 (patch) | |
tree | 14594cf4ebe5be015d8864c213ecb5c8d4e6834d | |
parent | a2bb062044b78058e6e4abec5ae17fe004a9d2b7 (diff) |
tracepointgen: fix inefficient loops, add a const
Take the loop variable by cref.
Make one loop variable const that was ok to be taken by value.
Coverity-Id: 404395
Coverity-Id: 404396
Coverity-Id: 404397
Coverity-Id: 404398
Coverity-Id: 404399
Change-Id: Ib90a8f12b98c892314f10a9a3cb2f3c5c19a5d78
Reviewed-by: Antti Määttä <[email protected]>
(cherry picked from commit 3e1108aa7fbc69244254e128b97eac528e35d03d)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
-rw-r--r-- | src/tools/tracepointgen/parser.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/tracepointgen/parser.cpp b/src/tools/tracepointgen/parser.cpp index b7857592713..93adc139997 100644 --- a/src/tools/tracepointgen/parser.cpp +++ b/src/tools/tracepointgen/parser.cpp @@ -131,7 +131,7 @@ static QString preprocessMetadata(const QString &in) int Parser::lineNumber(qsizetype offset) const { DEBUGPRINTF(printf("tracepointgen: lineNumber: offset %u, line count: %u\n", offset , m_offsets.size())); - for (auto line : m_offsets) { + for (const auto line : m_offsets) { DEBUGPRINTF(printf("tracepointgen: lineNumber: %d %d %d\n", line.begin, line.end, line.line)); if (offset >= line.begin && offset <= line.end) return line.line; @@ -585,16 +585,16 @@ void Parser::write(QIODevice &input) const QTextStream out(&input); if (m_prefixes.size() > 0) { out << QStringLiteral("{\n"); - for (auto prefix : m_prefixes) + for (const auto &prefix : m_prefixes) out << prefix << "\n"; out << QStringLiteral("}\n"); } - for (auto m : m_metadata) + for (const auto &m : m_metadata) out << m << "\n"; - for (auto func : m_functions) { + for (const auto &func : m_functions) { out << func.className << "_" << func.functionName << "_entry(" << func.functionParameters << ")\n"; out << func.className << "_" << func.functionName << "_exit()\n"; } - for (auto point : m_points) + for (const auto &point : m_points) out << point.name << "(" << point.parameters << ")\n"; } |