forked from qt-creator/qt-creator
CMakePM: clang-tidy fix for 'performance-implicit-conversion-in-loop'
Change-Id: I67e5adad19a3454986381c5548bbe96cf1cc1e6a Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1521,7 +1521,7 @@ void CMakeBuildSystem::runCTest()
|
||||
const QJsonArray nodes = btGraph.value("nodes").toArray();
|
||||
const QJsonArray tests = jsonObj.value("tests").toArray();
|
||||
int counter = 0;
|
||||
for (const QJsonValue &testVal : tests) {
|
||||
for (const auto &testVal : tests) {
|
||||
++counter;
|
||||
const QJsonObject test = testVal.toObject();
|
||||
QTC_ASSERT(!test.isEmpty(), continue);
|
||||
|
||||
@@ -91,7 +91,7 @@ std::vector<int> indexList(const QJsonValue &v)
|
||||
std::vector<int> result;
|
||||
result.reserve(static_cast<size_t>(indexList.count()));
|
||||
|
||||
for (const QJsonValue &v : indexList) {
|
||||
for (const auto &v : indexList) {
|
||||
result.push_back(v.toInt(-1));
|
||||
}
|
||||
return result;
|
||||
@@ -139,7 +139,7 @@ static ReplyFileContents readReplyFile(const FilePath &filePath, QString &errorM
|
||||
bool hadInvalidObject = false;
|
||||
{
|
||||
const QJsonArray objects = rootObject.value("objects").toArray();
|
||||
for (const QJsonValue &v : objects) {
|
||||
for (const auto &v : objects) {
|
||||
const QJsonObject object = v.toObject();
|
||||
{
|
||||
ReplyObject r;
|
||||
@@ -178,7 +178,7 @@ static CMakeConfig readCacheFile(const FilePath &cacheFile, QString &errorMessag
|
||||
}
|
||||
|
||||
const QJsonArray entries = root.value("entries").toArray();
|
||||
for (const QJsonValue &v : entries) {
|
||||
for (const auto &v : entries) {
|
||||
CMakeConfigItem item;
|
||||
|
||||
const QJsonObject entry = v.toObject();
|
||||
@@ -190,7 +190,7 @@ static CMakeConfig readCacheFile(const FilePath &cacheFile, QString &errorMessag
|
||||
|
||||
{
|
||||
const QJsonArray properties = entry.value("properties").toArray();
|
||||
for (const QJsonValue &v : properties) {
|
||||
for (const auto &v : properties) {
|
||||
const QJsonObject prop = v.toObject();
|
||||
auto nv = nameValue(prop);
|
||||
if (nv.first == "ADVANCED") {
|
||||
@@ -223,7 +223,7 @@ static std::vector<CMakeFileInfo> readCMakeFilesFile(const FilePath &cmakeFilesF
|
||||
}
|
||||
|
||||
const QJsonArray inputs = root.value("inputs").toArray();
|
||||
for (const QJsonValue &v : inputs) {
|
||||
for (const auto &v : inputs) {
|
||||
CMakeFileInfo info;
|
||||
const QJsonObject input = v.toObject();
|
||||
info.path = cmakeFilesFile.withNewPath(input.value("path").toString());
|
||||
@@ -253,7 +253,7 @@ std::vector<Directory> extractDirectories(const QJsonArray &directories, QString
|
||||
}
|
||||
|
||||
std::vector<Directory> result;
|
||||
for (const QJsonValue &v : directories) {
|
||||
for (const auto &v : directories) {
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
errorMessage = Tr::tr(
|
||||
@@ -283,7 +283,7 @@ static std::vector<Project> extractProjects(const QJsonArray &projects, QString
|
||||
}
|
||||
|
||||
std::vector<Project> result;
|
||||
for (const QJsonValue &v : projects) {
|
||||
for (const auto &v : projects) {
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
qCDebug(cmakeFileApi) << "Empty project skipped!";
|
||||
@@ -314,7 +314,7 @@ static std::vector<Project> extractProjects(const QJsonArray &projects, QString
|
||||
static std::vector<Target> extractTargets(const QJsonArray &targets, QString &errorMessage)
|
||||
{
|
||||
std::vector<Target> result;
|
||||
for (const QJsonValue &v : targets) {
|
||||
for (const auto &v : targets) {
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
errorMessage = Tr::tr(
|
||||
@@ -436,7 +436,7 @@ static std::vector<Configuration> extractConfigurations(const QJsonArray &config
|
||||
}
|
||||
|
||||
std::vector<FileApiDetails::Configuration> result;
|
||||
for (const QJsonValue &v : configs) {
|
||||
for (const auto &v : configs) {
|
||||
const QJsonObject obj = v.toObject();
|
||||
if (obj.isEmpty()) {
|
||||
errorMessage = Tr::tr(
|
||||
|
||||
@@ -44,7 +44,7 @@ std::optional<QStringList> parseInclude(const QJsonValue &jsonValue)
|
||||
if (jsonValue.isArray()) {
|
||||
includes = QStringList();
|
||||
const QJsonArray includeArray = jsonValue.toArray();
|
||||
for (const QJsonValue &includeValue : includeArray)
|
||||
for (const auto &includeValue : includeArray)
|
||||
includes.value() << includeValue.toString();
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ std::optional<PresetsDetails::Condition> parseCondition(const QJsonValue &jsonVa
|
||||
if (object.value("list").isArray()) {
|
||||
condition->list = QStringList();
|
||||
const QJsonArray listArray = object.value("list").toArray();
|
||||
for (const QJsonValue &listValue : listArray)
|
||||
for (const auto &listValue : listArray)
|
||||
condition->list.value() << listValue.toString();
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ std::optional<PresetsDetails::Condition> parseCondition(const QJsonValue &jsonVa
|
||||
if (object.value("conditions").isArray()) {
|
||||
condition->conditions = std::vector<PresetsDetails::Condition::ConditionPtr>();
|
||||
const QJsonArray conditionsArray = object.value("conditions").toArray();
|
||||
for (const QJsonValue &conditionsValue : conditionsArray) {
|
||||
for (const auto &conditionsValue : conditionsArray) {
|
||||
condition->conditions.value().emplace_back(
|
||||
std::make_shared<PresetsDetails::Condition>(
|
||||
parseCondition(conditionsValue).value()));
|
||||
@@ -160,7 +160,7 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
|
||||
return false;
|
||||
|
||||
const QJsonArray configurePresetsArray = jsonValue.toArray();
|
||||
for (const QJsonValue &presetJson : configurePresetsArray) {
|
||||
for (const auto &presetJson : configurePresetsArray) {
|
||||
if (!presetJson.isObject())
|
||||
continue;
|
||||
|
||||
@@ -176,7 +176,7 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
|
||||
preset.inherits = QStringList();
|
||||
if (inherits.isArray()) {
|
||||
const QJsonArray inheritsArray = inherits.toArray();
|
||||
for (const QJsonValue &inheritsValue : inheritsArray)
|
||||
for (const auto &inheritsValue : inheritsArray)
|
||||
preset.inherits.value() << inheritsValue.toString();
|
||||
} else {
|
||||
QString inheritsValue = inherits.toString();
|
||||
@@ -350,7 +350,7 @@ bool parseBuildPresets(const QJsonValue &jsonValue,
|
||||
return false;
|
||||
|
||||
const QJsonArray buildPresetsArray = jsonValue.toArray();
|
||||
for (const QJsonValue &presetJson : buildPresetsArray) {
|
||||
for (const auto &presetJson : buildPresetsArray) {
|
||||
if (!presetJson.isObject())
|
||||
continue;
|
||||
|
||||
@@ -366,7 +366,7 @@ bool parseBuildPresets(const QJsonValue &jsonValue,
|
||||
preset.inherits = QStringList();
|
||||
if (inherits.isArray()) {
|
||||
const QJsonArray inheritsArray = inherits.toArray();
|
||||
for (const QJsonValue &inheritsValue : inheritsArray)
|
||||
for (const auto &inheritsValue : inheritsArray)
|
||||
preset.inherits.value() << inheritsValue.toString();
|
||||
} else {
|
||||
QString inheritsValue = inherits.toString();
|
||||
@@ -404,7 +404,7 @@ bool parseBuildPresets(const QJsonValue &jsonValue,
|
||||
preset.targets = QStringList();
|
||||
if (targets.isArray()) {
|
||||
const QJsonArray targetsArray = targets.toArray();
|
||||
for (const QJsonValue &targetsValue : targetsArray)
|
||||
for (const auto &targetsValue : targetsArray)
|
||||
preset.targets.value() << targetsValue.toString();
|
||||
} else {
|
||||
QString targetsValue = targets.toString();
|
||||
@@ -424,7 +424,7 @@ bool parseBuildPresets(const QJsonValue &jsonValue,
|
||||
if (nativeToolOptions.isArray()) {
|
||||
preset.nativeToolOptions = QStringList();
|
||||
const QJsonArray toolOptionsArray = nativeToolOptions.toArray();
|
||||
for (const QJsonValue &toolOptionsValue : toolOptionsArray)
|
||||
for (const auto &toolOptionsValue : toolOptionsArray)
|
||||
preset.nativeToolOptions.value() << toolOptionsValue.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user