aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2024-02-23 16:06:17 +0100
committerIvan Komissarov <ABBAPOH@gmail.com>2024-02-23 23:02:42 +0000
commitae8f941e7e69e6939352c96bba351d75073a0b19 (patch)
treeeb90609719685ce18778a01ab969188f8efa62af
parentc59665eebda0e18995432e55b43d7a3beadcb913 (diff)
clang-tidy: fix 'modernize-return-braced-init-list'
Change-Id: Ie7eccb76937b6dfbf754ea30710be5825168d50d Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--src/app/qbs/session.cpp9
-rw-r--r--src/lib/corelib/api/jobs.cpp2
-rw-r--r--src/lib/corelib/api/project.cpp10
-rw-r--r--src/lib/corelib/api/projectdata.cpp2
-rw-r--r--src/lib/corelib/buildgraph/nodetreedumper.cpp2
-rw-r--r--src/lib/corelib/language/builtindeclarations.cpp17
-rw-r--r--src/lib/corelib/language/item.cpp6
-rw-r--r--src/lib/corelib/language/qualifiedid.cpp2
-rw-r--r--src/lib/corelib/language/scriptengine.cpp2
-rw-r--r--src/lib/corelib/loader/astpropertiesitemhandler.cpp5
-rw-r--r--src/lib/corelib/logging/logger.cpp2
-rw-r--r--src/lib/corelib/tools/scripttools.cpp2
12 files changed, 35 insertions, 26 deletions
diff --git a/src/app/qbs/session.cpp b/src/app/qbs/session.cpp
index ebc9015b2..2cdcf2b63 100644
--- a/src/app/qbs/session.cpp
+++ b/src/app/qbs/session.cpp
@@ -623,10 +623,11 @@ Session::ProductSelection Session::getProductSelection(const QJsonObject &reques
{
const QJsonValue productSelection = request.value(StringConstants::productsKey());
if (productSelection.isArray())
- return ProductSelection(getProductsByName(fromJson<QStringList>(productSelection)));
- return ProductSelection(productSelection.toString() == QLatin1String("all")
- ? Project::ProductSelectionWithNonDefault
- : Project::ProductSelectionDefaultOnly);
+ return {getProductsByName(fromJson<QStringList>(productSelection))};
+ return {
+ productSelection.toString() == QLatin1String("all")
+ ? Project::ProductSelectionWithNonDefault
+ : Project::ProductSelectionDefaultOnly};
}
Session::FileUpdateData Session::prepareFileUpdate(const QJsonObject &request)
diff --git a/src/lib/corelib/api/jobs.cpp b/src/lib/corelib/api/jobs.cpp
index 7a845b0ac..10c96bfee 100644
--- a/src/lib/corelib/api/jobs.cpp
+++ b/src/lib/corelib/api/jobs.cpp
@@ -231,7 +231,7 @@ Project SetupProjectJob::project() const
{
auto const wrapper = qobject_cast<const InternalJobThreadWrapper *>(internalJob());
auto const job = qobject_cast<const InternalSetupProjectJob *>(wrapper->synchronousJob());
- return Project(job->project(), job->logger());
+ return {job->project(), job->logger()};
}
void SetupProjectJob::resolve(const Project &existingProject,
diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp
index 0588b822c..53c711b49 100644
--- a/src/lib/corelib/api/project.cpp
+++ b/src/lib/corelib/api/project.cpp
@@ -797,8 +797,14 @@ RunEnvironment Project::getRunEnvironment(const ProductData &product,
const QStringList &setupRunEnvConfig, Settings *settings) const
{
const ResolvedProductPtr resolvedProduct = d->internalProduct(product);
- return RunEnvironment(resolvedProduct, d->internalProject, installOptions, environment,
- setupRunEnvConfig, settings, d->logger);
+ return {
+ resolvedProduct,
+ d->internalProject,
+ installOptions,
+ environment,
+ setupRunEnvConfig,
+ settings,
+ d->logger};
}
/*!
diff --git a/src/lib/corelib/api/projectdata.cpp b/src/lib/corelib/api/projectdata.cpp
index 34e679d6d..628fe2a5d 100644
--- a/src/lib/corelib/api/projectdata.cpp
+++ b/src/lib/corelib/api/projectdata.cpp
@@ -75,7 +75,7 @@ static QVariant getModuleProperty(const PropertyMap &properties, const QString &
{
const int lastDotIndex = fullPropertyName.lastIndexOf(QLatin1Char('.'));
if (lastDotIndex == -1)
- return QVariant();
+ return {};
return properties.getModuleProperty(fullPropertyName.left(lastDotIndex),
fullPropertyName.mid(lastDotIndex + 1));
}
diff --git a/src/lib/corelib/buildgraph/nodetreedumper.cpp b/src/lib/corelib/buildgraph/nodetreedumper.cpp
index 8475a46cf..6ad597c70 100644
--- a/src/lib/corelib/buildgraph/nodetreedumper.cpp
+++ b/src/lib/corelib/buildgraph/nodetreedumper.cpp
@@ -120,7 +120,7 @@ bool NodeTreeDumper::doVisit(BuildGraphNode *node, const QString &nodeRepr)
QByteArray NodeTreeDumper::indentation() const
{
- return QByteArray(m_indentation, ' ');
+ return {m_indentation, ' '};
}
} // namespace Internal
diff --git a/src/lib/corelib/language/builtindeclarations.cpp b/src/lib/corelib/language/builtindeclarations.cpp
index 4a83279a8..491b005e8 100644
--- a/src/lib/corelib/language/builtindeclarations.cpp
+++ b/src/lib/corelib/language/builtindeclarations.cpp
@@ -166,25 +166,28 @@ void BuiltinDeclarations::insert(const ItemDeclaration &decl)
static PropertyDeclaration conditionProperty()
{
- return PropertyDeclaration(StringConstants::conditionProperty(), PropertyDeclaration::Boolean,
- StringConstants::trueValue());
+ return {
+ StringConstants::conditionProperty(),
+ PropertyDeclaration::Boolean,
+ StringConstants::trueValue()};
}
static PropertyDeclaration alwaysRunProperty()
{
- return PropertyDeclaration(StringConstants::alwaysRunProperty(), PropertyDeclaration::Boolean,
- StringConstants::falseValue());
+ return {
+ StringConstants::alwaysRunProperty(),
+ PropertyDeclaration::Boolean,
+ StringConstants::falseValue()};
}
static PropertyDeclaration nameProperty()
{
- return PropertyDeclaration(StringConstants::nameProperty(), PropertyDeclaration::String);
+ return {StringConstants::nameProperty(), PropertyDeclaration::String};
}
static PropertyDeclaration buildDirProperty()
{
- return PropertyDeclaration(StringConstants::buildDirectoryProperty(),
- PropertyDeclaration::Path);
+ return {StringConstants::buildDirectoryProperty(), PropertyDeclaration::Path};
}
static PropertyDeclaration prepareScriptProperty()
diff --git a/src/lib/corelib/language/item.cpp b/src/lib/corelib/language/item.cpp
index 29fa1417d..cabfefb0b 100644
--- a/src/lib/corelib/language/item.cpp
+++ b/src/lib/corelib/language/item.cpp
@@ -172,7 +172,7 @@ ItemValuePtr Item::itemProperty(const QString &name, const Item *itemTemplate,
if (v && v->type() == Value::ItemValueType)
return std::static_pointer_cast<ItemValue>(v);
if (!itemTemplate)
- return ItemValuePtr();
+ return {};
const bool createdByPropertiesBlock = itemValue && itemValue->createdByPropertiesBlock();
ItemValuePtr result = ItemValue::create(Item::create(&pool, itemTemplate->type()),
createdByPropertiesBlock);
@@ -184,7 +184,7 @@ JSSourceValuePtr Item::sourceProperty(const QString &name) const
{
ValuePtr v = property(name);
if (!v || v->type() != Value::JSSourceValueType)
- return JSSourceValuePtr();
+ return {};
return std::static_pointer_cast<JSSourceValue>(v);
}
@@ -192,7 +192,7 @@ VariantValuePtr Item::variantProperty(const QString &name) const
{
ValuePtr v = property(name);
if (!v || v->type() != Value::VariantValueType)
- return VariantValuePtr();
+ return {};
return std::static_pointer_cast<VariantValue>(v);
}
diff --git a/src/lib/corelib/language/qualifiedid.cpp b/src/lib/corelib/language/qualifiedid.cpp
index 9eb0e9463..87248ac21 100644
--- a/src/lib/corelib/language/qualifiedid.cpp
+++ b/src/lib/corelib/language/qualifiedid.cpp
@@ -58,7 +58,7 @@ QualifiedId::QualifiedId(const QStringList &nameParts)
QualifiedId QualifiedId::fromString(const QString &str)
{
- return QualifiedId(str.split(QLatin1Char('.')));
+ return {str.split(QLatin1Char('.'))};
}
QString QualifiedId::toString() const
diff --git a/src/lib/corelib/language/scriptengine.cpp b/src/lib/corelib/language/scriptengine.cpp
index 7847cb24d..e4793ca41 100644
--- a/src/lib/corelib/language/scriptengine.cpp
+++ b/src/lib/corelib/language/scriptengine.cpp
@@ -829,7 +829,7 @@ ScopedJsValueList ScriptEngine::argumentList(const QStringList &argumentNames,
JSValueList result;
for (const auto &name : argumentNames)
result.push_back(getJsProperty(m_context, context, name));
- return ScopedJsValueList(m_context, result);
+ return {m_context, result};
}
JSClassID ScriptEngine::registerClass(const char *name, JSClassCall *constructor,
diff --git a/src/lib/corelib/loader/astpropertiesitemhandler.cpp b/src/lib/corelib/loader/astpropertiesitemhandler.cpp
index cd6a32908..8183e6b79 100644
--- a/src/lib/corelib/loader/astpropertiesitemhandler.cpp
+++ b/src/lib/corelib/loader/astpropertiesitemhandler.cpp
@@ -159,8 +159,7 @@ static JSSourceValue::AltProperty getPropertyData(const Item *propertiesItem, co
throw ErrorInfo(Tr::tr("Properties.condition must be provided."),
propertiesItem->location());
}
- return JSSourceValue::AltProperty(StringConstants::falseValue(),
- propertiesItem->location());
+ return {StringConstants::falseValue(), propertiesItem->location()};
}
if (Q_UNLIKELY(value->type() != Value::JSSourceValueType)) {
throw ErrorInfo(Tr::tr("Properties.%1 must be a value binding.").arg(name),
@@ -180,7 +179,7 @@ static JSSourceValue::AltProperty getPropertyData(const Item *propertiesItem, co
}
const JSSourceValuePtr srcval = std::static_pointer_cast<JSSourceValue>(value);
- return JSSourceValue::AltProperty(srcval->sourceCodeForEvaluation(), srcval->location());
+ return {srcval->sourceCodeForEvaluation(), srcval->location()};
}
void ASTPropertiesItemHandler::handlePropertiesBlock(const Item *propertiesItem)
diff --git a/src/lib/corelib/logging/logger.cpp b/src/lib/corelib/logging/logger.cpp
index d4f51cd30..65d0cc27f 100644
--- a/src/lib/corelib/logging/logger.cpp
+++ b/src/lib/corelib/logging/logger.cpp
@@ -231,7 +231,7 @@ void Logger::printWarning(const ErrorInfo &warning)
LogWriter Logger::qbsLog(LoggerLevel level, bool force) const
{
- return LogWriter(m_logSink, level, force);
+ return {m_logSink, level, force};
}
} // namespace Internal
diff --git a/src/lib/corelib/tools/scripttools.cpp b/src/lib/corelib/tools/scripttools.cpp
index 6262e7cf7..e89e4a0ad 100644
--- a/src/lib/corelib/tools/scripttools.cpp
+++ b/src/lib/corelib/tools/scripttools.cpp
@@ -123,7 +123,7 @@ ErrorInfo JsException::toErrorInfo() const
ErrorInfo e(msg, stackTrace());
if (e.hasLocation() || !m_fallbackLocation.isValid())
return e;
- return ErrorInfo(msg, m_fallbackLocation);
+ return {msg, m_fallbackLocation};
}
void defineJsProperty(JSContext *ctx, JSValueConst obj, const QString &prop, JSValue val)