Skip to content

Commit

Permalink
fixed clang-tidy warnings for Qt5
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Apr 2, 2023
1 parent dbec0d1 commit 908c718
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/orm/tiny/tinybuilder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,11 @@ namespace Orm::Tiny
progress.reserve(names.size());

for (auto &&segment : names) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
progress << segment;
#else
progress << std::move(segment);
#endif

auto last = progress.join(DOT);
const auto containsRelation = [&last](const auto &relation)
Expand Down
6 changes: 5 additions & 1 deletion include/orm/utils/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ namespace Orm::Utils
queryString.replace(queryString.indexOf(QLatin1Char('?')), 1, bindingValue);

if (simpleBindings)
simpleBindingsList << std::move(bindingValue); // clazy:exclude=reserve-candidates
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
simpleBindingsList << bindingValue;
#else
simpleBindingsList << std::move(bindingValue);
#endif
}

return {std::move(queryString), std::move(simpleBindingsList)};
Expand Down
12 changes: 12 additions & 0 deletions src/orm/exceptions/sqlerror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,25 @@ QString SqlError::formatMessage(const char *message, const QSqlError &error)
errorText.reserve(3);

if (!nativeErrorCode.isEmpty())
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
errorText << nativeErrorCode;
#else
errorText << std::move(nativeErrorCode);
#endif

if (!driverText.isEmpty())
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
errorText << driverText;
#else
errorText << std::move(driverText);
#endif

if (!databaseText.isEmpty())
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
errorText << databaseText;
#else
errorText << std::move(databaseText);
#endif

result += errorText.join(COMMA);

Expand Down
4 changes: 4 additions & 0 deletions src/orm/schema/blueprint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ QVector<QString> Blueprint::toSql(const DatabaseConnection &connection,
if (auto sql = grammar.invokeCompileMethod(*command, connection, *this);
!sql.isEmpty()
)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
statements << sql;
#else
statements << std::move(sql);
#endif

return statements;
}
Expand Down
4 changes: 4 additions & 0 deletions src/orm/types/sqlquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ SqlQuery::SqlQuery(QSqlQuery &&other, const QtTimeZoneConfig &qtTimeZone, // NOL
const QueryGrammar &queryGrammar,
const std::optional<bool> returnQDateTime
)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
: QSqlQuery(other)
#else
: QSqlQuery(std::move(other))
#endif
, m_qtTimeZone(qtTimeZone)
, m_isConvertingTimeZone(m_qtTimeZone.type != QtTimeZoneType::DontConvert)
, m_isSQLiteDb(driver()->dbmsType() == QSqlDriver::DbmsType::SQLite)
Expand Down
4 changes: 4 additions & 0 deletions tom/src/tom/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,11 @@ void Application::prependOptions(QList<CommandLineOption> &&options)
m_options = std::move(options);

// Common options after Command options
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
m_options << commonOptions;
#else
m_options << std::move(commonOptions);
#endif
}

/* Run command */
Expand Down
4 changes: 4 additions & 0 deletions tom/src/tom/commands/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ QStringList Command::values(const QString &name) const
// Support passing more values delimited by comma
for (auto &&value : values) {
if (!value.contains(regex)) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
valuesSplitted << value;
#else
valuesSplitted << std::move(value);
#endif

continue;
}
Expand Down
12 changes: 12 additions & 0 deletions tom/src/tom/commands/completecommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,12 @@ int CompleteCommand::printGuessedCommands(
#ifdef _MSC_VER
guessedCommands << QStringLiteral("%1;%2;%3").arg(commandName, commandName,
command->description());
#else
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
guessedCommands << commandName;
#else
guessedCommands << std::move(commandName);
#endif
#endif
}

Expand Down Expand Up @@ -414,8 +418,12 @@ int CompleteCommand::printGuessedLongOptions(
#ifdef _MSC_VER
options << QStringLiteral("%1;%2;%3").arg(longOption, longOption,
option.description());
#else
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
options << longOption;
#else
options << std::move(longOption);
#endif
#endif
}
// With a value
Expand All @@ -431,8 +439,12 @@ int CompleteCommand::printGuessedLongOptions(
.arg(longOption, longOptionList,
option.description(),
getOptionDefaultValue(option));
#else
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
options << longOption;
#else
options << std::move(longOption);
#endif
#endif
}
}
Expand Down
4 changes: 4 additions & 0 deletions tom/src/tom/concerns/callscommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ CallsCommands::createCommandLineArguments(
newArguments.reserve(currentArguments.size() + arguments.size());

// Absolute path of the exe name
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
newArguments << currentArguments.constFirst();
#else
newArguments << std::move(currentArguments.first());
#endif
// Command name
newArguments << command;

Expand Down
4 changes: 4 additions & 0 deletions tom/src/tom/concerns/interactswithio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,11 @@ QString InteractsWithIO::errorWallInternal(const QString &string) const
// Split lines by the given width
for (const auto &lineNl : splitted)
for (auto &&line : StringUtils::splitStringByWidth(lineNl, maxLineWidth))
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
lines << line;
#else
lines << std::move(line);
#endif
}

QString output;
Expand Down
4 changes: 4 additions & 0 deletions tom/src/tom/tomutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ Utils::convertToQCommandLineOptionList(QList<CommandLineOption> &&options)
result.reserve(options.size());

for (auto &&option : options)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
result << option;
#else
result << std::move(option);
#endif

return result;
}
Expand Down

0 comments on commit 908c718

Please sign in to comment.