summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2019-02-26 14:38:54 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2019-02-26 15:52:26 +0000
commit4fd17d627106fde01284075038e15cc0680611bc (patch)
tree25c5b7e8ec774d362ad97e86d0ecd1d8527fbac5 /src
parent0b8f0b771080e51a59664782ced6b3a1cc5111ca (diff)
downloadqbs-4fd17d627106fde01284075038e15cc0680611bc.tar.gz
Return initializer list where it is possible
This fixes this clang-tidy warning: warning: avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list] Change-Id: I421e1e47462fe0e97788672684d47943af7df850 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/app/qbs-setup-android/android-setup.cpp7
-rw-r--r--src/app/qbs-setup-qt/setupqt.cpp14
-rw-r--r--src/app/qbs-setup-toolchains/msvcprobe.cpp4
-rw-r--r--src/app/qbs-setup-toolchains/probe.cpp28
-rw-r--r--src/app/qbs-setup-toolchains/xcodeprobe.cpp2
-rw-r--r--src/app/qbs/parser/commandlineoption.h36
-rw-r--r--src/app/qbs/parser/commandlineparser.cpp27
-rw-r--r--src/app/qbs/parser/parsercommand.cpp94
-rw-r--r--src/lib/corelib/api/changeset.cpp2
-rw-r--r--src/lib/corelib/api/project.cpp36
-rw-r--r--src/lib/corelib/api/projectdata.cpp10
-rw-r--r--src/lib/corelib/api/qmljsrewriter.cpp4
-rw-r--r--src/lib/corelib/api/rulecommand.cpp10
-rw-r--r--src/lib/corelib/api/runenvironment.cpp10
-rw-r--r--src/lib/corelib/buildgraph/buildgraph.cpp4
-rw-r--r--src/lib/corelib/buildgraph/buildgraphloader.cpp2
-rw-r--r--src/lib/corelib/buildgraph/dependencyparametersscriptvalue.cpp2
-rw-r--r--src/lib/corelib/buildgraph/depscanner.cpp6
-rw-r--r--src/lib/corelib/buildgraph/productinstaller.cpp2
-rw-r--r--src/lib/corelib/buildgraph/qtmocscanner.cpp4
-rw-r--r--src/lib/corelib/buildgraph/rulecommands.cpp2
-rw-r--r--src/lib/corelib/buildgraph/rulecommands.h6
-rw-r--r--src/lib/corelib/buildgraph/transformer.cpp6
-rw-r--r--src/lib/corelib/buildgraph/transformerchangetracking.cpp8
-rw-r--r--src/lib/corelib/generators/generator.cpp4
-rw-r--r--src/lib/corelib/jsextensions/binaryfile.cpp4
-rw-r--r--src/lib/corelib/jsextensions/domxml.cpp22
-rw-r--r--src/lib/corelib/jsextensions/jsextensions.cpp2
-rw-r--r--src/lib/corelib/jsextensions/moduleproperties.cpp2
-rw-r--r--src/lib/corelib/jsextensions/propertylist.mm4
-rw-r--r--src/lib/corelib/jsextensions/textfile.cpp6
-rw-r--r--src/lib/corelib/jsextensions/utilitiesextension.cpp36
-rw-r--r--src/lib/corelib/language/asttools.cpp2
-rw-r--r--src/lib/corelib/language/builtindeclarations.cpp6
-rw-r--r--src/lib/corelib/language/evaluator.cpp4
-rw-r--r--src/lib/corelib/language/evaluatorscriptclass.cpp12
-rw-r--r--src/lib/corelib/language/language.cpp4
-rw-r--r--src/lib/corelib/language/moduleloader.cpp20
-rw-r--r--src/lib/corelib/language/projectresolver.cpp6
-rw-r--r--src/lib/corelib/language/propertymapinternal.cpp4
-rw-r--r--src/lib/corelib/language/scriptengine.cpp2
-rw-r--r--src/lib/corelib/language/value.h2
-rw-r--r--src/lib/corelib/logging/ilogsink.cpp4
-rw-r--r--src/lib/corelib/parser/qmlerror.cpp4
-rw-r--r--src/lib/corelib/parser/qmljslexer.cpp4
-rw-r--r--src/lib/corelib/tools/applecodesignutils.cpp12
-rw-r--r--src/lib/corelib/tools/commandechomode.cpp2
-rw-r--r--src/lib/corelib/tools/fileinfo.cpp10
-rw-r--r--src/lib/corelib/tools/id.cpp12
-rw-r--r--src/lib/corelib/tools/msvcinfo.cpp2
-rw-r--r--src/lib/corelib/tools/processutils.cpp12
-rw-r--r--src/lib/corelib/tools/profile.cpp4
-rw-r--r--src/lib/corelib/tools/scannerpluginmanager.cpp2
-rw-r--r--src/lib/corelib/tools/settings.cpp2
-rw-r--r--src/lib/corelib/tools/settings.h2
-rw-r--r--src/lib/corelib/tools/settingsmodel.cpp24
-rw-r--r--src/lib/corelib/tools/setupprojectparameters.cpp2
-rw-r--r--src/lib/corelib/tools/shellutils.cpp2
-rw-r--r--src/lib/corelib/tools/version.cpp4
-rw-r--r--src/lib/corelib/tools/vsenvironmentdetector.cpp6
-rw-r--r--src/plugins/generator/visualstudio/msbuildfiltersproject.cpp24
-rw-r--r--src/plugins/generator/visualstudio/msbuildtargetproject.cpp2
-rw-r--r--src/shared/json/json.cpp60
63 files changed, 319 insertions, 345 deletions
diff --git a/src/app/qbs-setup-android/android-setup.cpp b/src/app/qbs-setup-android/android-setup.cpp
index 0a95dfd68..4a3c8aef9 100644
--- a/src/app/qbs-setup-android/android-setup.cpp
+++ b/src/app/qbs-setup-android/android-setup.cpp
@@ -64,11 +64,8 @@ static QString qls(const char *s) { return QLatin1String(s); }
static QStringList expectedArchs()
{
- return QStringList()
- << QStringLiteral("arm64")
- << QStringLiteral("armv7a")
- << QStringLiteral("x86")
- << QStringLiteral("x86_64");
+ return {QStringLiteral("arm64"), QStringLiteral("armv7a"),
+ QStringLiteral("x86"), QStringLiteral("x86_64")};
}
diff --git a/src/app/qbs-setup-qt/setupqt.cpp b/src/app/qbs-setup-qt/setupqt.cpp
index 498b73d99..7905d0823 100644
--- a/src/app/qbs-setup-qt/setupqt.cpp
+++ b/src/app/qbs-setup-qt/setupqt.cpp
@@ -122,14 +122,14 @@ std::vector<QtEnvironment> SetupQt::fetchEnvironments()
static QStringList qbsToolchainFromDirName(const QString &dir)
{
if (dir.startsWith(QLatin1String("msvc")))
- return QStringList(QStringLiteral("msvc"));
+ return {QStringLiteral("msvc")};
if (dir.startsWith(QLatin1String("mingw")))
- return QStringList{QStringLiteral("mingw"), QStringLiteral("gcc")};
+ return {QStringLiteral("mingw"), QStringLiteral("gcc")};
if (dir.startsWith(QLatin1String("clang")))
- return QStringList{QStringLiteral("clang"), QStringLiteral("llvm"), QStringLiteral("gcc")};
+ return {QStringLiteral("clang"), QStringLiteral("llvm"), QStringLiteral("gcc")};
if (dir.startsWith(QLatin1String("gcc")))
- return QStringList(QStringLiteral("gcc"));
- return QStringList();
+ return {QStringLiteral("gcc")};
+ return {};
}
static Version msvcVersionFromDirName(const QString &dir)
@@ -138,7 +138,7 @@ static Version msvcVersionFromDirName(const QString &dir)
std::smatch match;
const std::string dirString = dir.toStdString();
if (!std::regex_match(dirString, match, regexp))
- return Version();
+ return Version{};
QMap<std::string, std::string> mapping{
std::make_pair("2005", "14"), std::make_pair("2008", "15"), std::make_pair("2010", "16"),
std::make_pair("2012", "17"), std::make_pair("2013", "18"), std::make_pair("2015", "19"),
@@ -153,7 +153,7 @@ static QString archFromDirName(const QString &dir)
std::smatch match;
const std::string dirString = dir.toStdString();
if (!std::regex_match(dirString, match, regexp))
- return QString();
+ return {};
const QString arch = QString::fromStdString(match[1]);
if (arch == QLatin1String("32"))
return QStringLiteral("x86");
diff --git a/src/app/qbs-setup-toolchains/msvcprobe.cpp b/src/app/qbs-setup-toolchains/msvcprobe.cpp
index 267f9628d..3bb99fd22 100644
--- a/src/app/qbs-setup-toolchains/msvcprobe.cpp
+++ b/src/app/qbs-setup-toolchains/msvcprobe.cpp
@@ -156,7 +156,7 @@ static QString wow6432Key()
#ifdef Q_OS_WIN64
return QStringLiteral("\\Wow6432Node");
#else
- return QString();
+ return {};
#endif
}
@@ -176,7 +176,7 @@ static QString vswhereFilePath()
if (QFileInfo(cmd).exists())
return cmd;
}
- return QString();
+ return {};
}
enum class ProductType { VisualStudio, BuildTools };
diff --git a/src/app/qbs-setup-toolchains/probe.cpp b/src/app/qbs-setup-toolchains/probe.cpp
index 9ae8eac94..e90bafec2 100644
--- a/src/app/qbs-setup-toolchains/probe.cpp
+++ b/src/app/qbs-setup-toolchains/probe.cpp
@@ -80,7 +80,7 @@ static QString findExecutable(const QString &fileName)
if (QFileInfo::exists(fullPath))
return QDir::cleanPath(fullPath);
}
- return QString();
+ return {};
}
static QString qsystem(const QString &exe, const QStringList &args = QStringList())
@@ -100,17 +100,16 @@ static QString qsystem(const QString &exe, const QStringList &args = QStringList
static QStringList validMinGWMachines()
{
// List of MinGW machine names (gcc -dumpmachine) recognized by Qbs
- return QStringList()
- << QStringLiteral("mingw32") << QStringLiteral("mingw64")
- << QStringLiteral("i686-w64-mingw32") << QStringLiteral("x86_64-w64-mingw32")
- << QStringLiteral("i686-w64-mingw32.shared") << QStringLiteral("x86_64-w64-mingw32.shared")
- << QStringLiteral("i686-w64-mingw32.static") << QStringLiteral("x86_64-w64-mingw32.static")
- << QStringLiteral("i586-mingw32msvc") << QStringLiteral("amd64-mingw32msvc");
+ return {QStringLiteral("mingw32"), QStringLiteral("mingw64"),
+ QStringLiteral("i686-w64-mingw32"), QStringLiteral("x86_64-w64-mingw32"),
+ QStringLiteral("i686-w64-mingw32.shared"), QStringLiteral("x86_64-w64-mingw32.shared"),
+ QStringLiteral("i686-w64-mingw32.static"), QStringLiteral("x86_64-w64-mingw32.static"),
+ QStringLiteral("i586-mingw32msvc"), QStringLiteral("amd64-mingw32msvc")};
}
static QStringList knownIarCompilerNames()
{
- return { QStringLiteral("icc8051"), QStringLiteral("iccarm"), QStringLiteral("iccavr") };
+ return {QStringLiteral("icc8051"), QStringLiteral("iccarm"), QStringLiteral("iccavr")};
}
static bool isIarCompiler(const QString &compilerName)
@@ -122,7 +121,7 @@ static bool isIarCompiler(const QString &compilerName)
static QStringList knownKeilCompilerNames()
{
- return { QStringLiteral("c51"), QStringLiteral("armcc") };
+ return {QStringLiteral("c51"), QStringLiteral("armcc")};
}
static bool isKeilCompiler(const QString &compilerName)
@@ -148,7 +147,7 @@ static QStringList toolchainTypeFromCompilerName(const QString &compilerName)
return canonicalToolchain(QStringLiteral("iar"));
if (isKeilCompiler(compilerName))
return canonicalToolchain(QStringLiteral("keil"));
- return QStringList();
+ return {};
}
static QString gccMachineName(const QString &compilerFilePath)
@@ -158,11 +157,10 @@ static QString gccMachineName(const QString &compilerFilePath)
static QStringList standardCompilerFileNames()
{
- return QStringList()
- << HostOsInfo::appendExecutableSuffix(QStringLiteral("gcc"))
- << HostOsInfo::appendExecutableSuffix(QStringLiteral("g++"))
- << HostOsInfo::appendExecutableSuffix(QStringLiteral("clang"))
- << HostOsInfo::appendExecutableSuffix(QStringLiteral("clang++"));
+ return {HostOsInfo::appendExecutableSuffix(QStringLiteral("gcc")),
+ HostOsInfo::appendExecutableSuffix(QStringLiteral("g++")),
+ HostOsInfo::appendExecutableSuffix(QStringLiteral("clang")),
+ HostOsInfo::appendExecutableSuffix(QStringLiteral("clang++"))};
}
static void setCommonProperties(Profile &profile, const QString &compilerFilePath,
diff --git a/src/app/qbs-setup-toolchains/xcodeprobe.cpp b/src/app/qbs-setup-toolchains/xcodeprobe.cpp
index 277d14d0a..227dc00f3 100644
--- a/src/app/qbs-setup-toolchains/xcodeprobe.cpp
+++ b/src/app/qbs-setup-toolchains/xcodeprobe.cpp
@@ -139,7 +139,7 @@ static QString targetOS(const QString &applePlatformName)
return QStringLiteral("watchos");
if (applePlatformName == QStringLiteral("watchsimulator"))
return QStringLiteral("watchos-simulator");
- return QString();
+ return {};
}
static QStringList archList(const QString &applePlatformName)
diff --git a/src/app/qbs/parser/commandlineoption.h b/src/app/qbs/parser/commandlineoption.h
index 414f90489..f8ec1c735 100644
--- a/src/app/qbs/parser/commandlineoption.h
+++ b/src/app/qbs/parser/commandlineoption.h
@@ -219,14 +219,14 @@ class DryRunOption : public OnOffOption
class ForceProbesOption : public OnOffOption
{
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
class NoInstallOption : public OnOffOption
{
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -234,28 +234,28 @@ class ShowProgressOption : public OnOffOption
{
public:
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
class ForceTimeStampCheckOption : public OnOffOption
{
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
class ForceOutputCheckOption : public OnOffOption
{
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
class BuildNonDefaultOption : public OnOffOption
{
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -274,7 +274,7 @@ private:
class ChangedFilesOption : public StringListOption
{
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -289,7 +289,7 @@ public:
class RunEnvConfigOption : public StringListOption
{
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -301,7 +301,7 @@ public:
private:
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
void doParse(const QString &representation, QStringList &input) override;
@@ -317,7 +317,7 @@ public:
bool useSysroot() const { return m_useSysroot; }
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
private:
@@ -331,7 +331,7 @@ class RemoveFirstOption : public OnOffOption
{
public:
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -339,7 +339,7 @@ class NoBuildOption : public OnOffOption
{
public:
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -357,7 +357,7 @@ public:
CommandEchoModeOption();
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
CommandEchoMode commandEchoMode() const;
@@ -375,7 +375,7 @@ public:
QString settingsDir() const { return m_settingsDir; }
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
private:
@@ -390,7 +390,7 @@ public:
JobLimits jobLimits() const { return m_jobLimits; }
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
private:
@@ -403,7 +403,7 @@ class RespectProjectJobLimitsOption : public OnOffOption
{
public:
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -411,7 +411,7 @@ class WaitLockOption : public OnOffOption
{
public:
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
@@ -419,7 +419,7 @@ class DisableFallbackProviderOption : public OnOffOption
{
public:
QString description(CommandType command) const override;
- QString shortRepresentation() const override { return QString(); }
+ QString shortRepresentation() const override { return {}; }
QString longRepresentation() const override;
};
diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp
index cd74210c7..3c25c51e2 100644
--- a/src/app/qbs/parser/commandlineparser.cpp
+++ b/src/app/qbs/parser/commandlineparser.cpp
@@ -374,20 +374,19 @@ Command *CommandLineParser::CommandLineParserPrivate::commandFromString(const QS
QList<Command *> CommandLineParser::CommandLineParserPrivate::allCommands() const
{
- return QList<Command *>()
- << commandPool.getCommand(GenerateCommandType)
- << commandPool.getCommand(ResolveCommandType)
- << commandPool.getCommand(BuildCommandType)
- << commandPool.getCommand(CleanCommandType)
- << commandPool.getCommand(RunCommandType)
- << commandPool.getCommand(ShellCommandType)
- << commandPool.getCommand(StatusCommandType)
- << commandPool.getCommand(UpdateTimestampsCommandType)
- << commandPool.getCommand(InstallCommandType)
- << commandPool.getCommand(DumpNodesTreeCommandType)
- << commandPool.getCommand(ListProductsCommandType)
- << commandPool.getCommand(VersionCommandType)
- << commandPool.getCommand(HelpCommandType);
+ return {commandPool.getCommand(GenerateCommandType),
+ commandPool.getCommand(ResolveCommandType),
+ commandPool.getCommand(BuildCommandType),
+ commandPool.getCommand(CleanCommandType),
+ commandPool.getCommand(RunCommandType),
+ commandPool.getCommand(ShellCommandType),
+ commandPool.getCommand(StatusCommandType),
+ commandPool.getCommand(UpdateTimestampsCommandType),
+ commandPool.getCommand(InstallCommandType),
+ commandPool.getCommand(DumpNodesTreeCommandType),
+ commandPool.getCommand(ListProductsCommandType),
+ commandPool.getCommand(VersionCommandType),
+ commandPool.getCommand(HelpCommandType)};
}
static QString extractToolDescription(const QString &tool, const QString &output)
diff --git a/src/app/qbs/parser/parsercommand.cpp b/src/app/qbs/parser/parsercommand.cpp
index 22e49b8d7..9485b0878 100644
--- a/src/app/qbs/parser/parsercommand.cpp
+++ b/src/app/qbs/parser/parsercommand.cpp
@@ -201,17 +201,16 @@ QString ResolveCommand::representation() const
static QList<CommandLineOption::Type> resolveOptions()
{
- return QList<CommandLineOption::Type>()
- << CommandLineOption::FileOptionType
- << CommandLineOption::BuildDirectoryOptionType
- << CommandLineOption::LogLevelOptionType
- << CommandLineOption::VerboseOptionType
- << CommandLineOption::QuietOptionType
- << CommandLineOption::ShowProgressOptionType
- << CommandLineOption::DryRunOptionType
- << CommandLineOption::ForceProbesOptionType
- << CommandLineOption::LogTimeOptionType
- << CommandLineOption::DisableFallbackProviderType;
+ return {CommandLineOption::FileOptionType,
+ CommandLineOption::BuildDirectoryOptionType,
+ CommandLineOption::LogLevelOptionType,
+ CommandLineOption::VerboseOptionType,
+ CommandLineOption::QuietOptionType,
+ CommandLineOption::ShowProgressOptionType,
+ CommandLineOption::DryRunOptionType,
+ CommandLineOption::ForceProbesOptionType,
+ CommandLineOption::LogTimeOptionType,
+ CommandLineOption::DisableFallbackProviderType};
}
QList<CommandLineOption::Type> ResolveCommand::supportedOptions() const
@@ -240,16 +239,15 @@ QString GenerateCommand::representation() const
QList<CommandLineOption::Type> GenerateCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>()
- << CommandLineOption::FileOptionType
- << CommandLineOption::BuildDirectoryOptionType
- << CommandLineOption::LogLevelOptionType
- << CommandLineOption::VerboseOptionType
- << CommandLineOption::QuietOptionType
- << CommandLineOption::ShowProgressOptionType
- << CommandLineOption::InstallRootOptionType
- << CommandLineOption::LogTimeOptionType
- << CommandLineOption::GeneratorOptionType;
+ return {CommandLineOption::FileOptionType,
+ CommandLineOption::BuildDirectoryOptionType,
+ CommandLineOption::LogLevelOptionType,
+ CommandLineOption::VerboseOptionType,
+ CommandLineOption::QuietOptionType,
+ CommandLineOption::ShowProgressOptionType,
+ CommandLineOption::InstallRootOptionType,
+ CommandLineOption::LogTimeOptionType,
+ CommandLineOption::GeneratorOptionType};
}
QString BuildCommand::shortDescription() const
@@ -317,17 +315,15 @@ QString CleanCommand::representation() const
QList<CommandLineOption::Type> CleanCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>{
- CommandLineOption::BuildDirectoryOptionType,
- CommandLineOption::DryRunOptionType,
- CommandLineOption::KeepGoingOptionType,
- CommandLineOption::LogTimeOptionType,
- CommandLineOption::ProductsOptionType,
- CommandLineOption::QuietOptionType,
- CommandLineOption::SettingsDirOptionType,
- CommandLineOption::ShowProgressOptionType,
- CommandLineOption::VerboseOptionType,
- };
+ return {CommandLineOption::BuildDirectoryOptionType,
+ CommandLineOption::DryRunOptionType,
+ CommandLineOption::KeepGoingOptionType,
+ CommandLineOption::LogTimeOptionType,
+ CommandLineOption::ProductsOptionType,
+ CommandLineOption::QuietOptionType,
+ CommandLineOption::SettingsDirOptionType,
+ CommandLineOption::ShowProgressOptionType,
+ CommandLineOption::VerboseOptionType};
}
QString InstallCommand::shortDescription() const
@@ -429,10 +425,9 @@ QString ShellCommand::representation() const
QList<CommandLineOption::Type> ShellCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>()
- << CommandLineOption::FileOptionType
- << CommandLineOption::BuildDirectoryOptionType
- << CommandLineOption::ProductsOptionType;
+ return {CommandLineOption::FileOptionType,
+ CommandLineOption::BuildDirectoryOptionType,
+ CommandLineOption::ProductsOptionType};
}
QString StatusCommand::shortDescription() const
@@ -456,7 +451,7 @@ QString StatusCommand::representation() const
QList<CommandLineOption::Type> StatusCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>({CommandLineOption::BuildDirectoryOptionType});
+ return {CommandLineOption::BuildDirectoryOptionType};
}
QString UpdateTimestampsCommand::shortDescription() const
@@ -485,12 +480,11 @@ QString UpdateTimestampsCommand::representation() const
QList<CommandLineOption::Type> UpdateTimestampsCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>()
- << CommandLineOption::BuildDirectoryOptionType
- << CommandLineOption::LogLevelOptionType
- << CommandLineOption::VerboseOptionType
- << CommandLineOption::QuietOptionType
- << CommandLineOption::ProductsOptionType;
+ return {CommandLineOption::BuildDirectoryOptionType,
+ CommandLineOption::LogLevelOptionType,
+ CommandLineOption::VerboseOptionType,
+ CommandLineOption::QuietOptionType,
+ CommandLineOption::ProductsOptionType};
}
QString DumpNodesTreeCommand::shortDescription() const
@@ -513,9 +507,8 @@ QString DumpNodesTreeCommand::representation() const
QList<CommandLineOption::Type> DumpNodesTreeCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>()
- << CommandLineOption::BuildDirectoryOptionType
- << CommandLineOption::ProductsOptionType;
+ return {CommandLineOption::BuildDirectoryOptionType,
+ CommandLineOption::ProductsOptionType};
}
QString ListProductsCommand::shortDescription() const
@@ -537,9 +530,8 @@ QString ListProductsCommand::representation() const
QList<CommandLineOption::Type> ListProductsCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>()
- << CommandLineOption::FileOptionType
- << CommandLineOption::BuildDirectoryOptionType;
+ return {CommandLineOption::FileOptionType,
+ CommandLineOption::BuildDirectoryOptionType};
}
QString HelpCommand::shortDescription() const
@@ -561,7 +553,7 @@ QString HelpCommand::representation() const
QList<CommandLineOption::Type> HelpCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>();
+ return {};
}
void HelpCommand::parseNext(QStringList &input)
@@ -592,7 +584,7 @@ QString VersionCommand::representation() const
QList<CommandLineOption::Type> VersionCommand::supportedOptions() const
{
- return QList<CommandLineOption::Type>();
+ return {};
}
void VersionCommand::parseNext(QStringList &input)
diff --git a/src/lib/corelib/api/changeset.cpp b/src/lib/corelib/api/changeset.cpp
index 0f69ca047..5d375fd65 100644
--- a/src/lib/corelib/api/changeset.cpp
+++ b/src/lib/corelib/api/changeset.cpp
@@ -364,7 +364,7 @@ QString ChangeSet::textAt(int pos, int length)
m_cursor->setPosition(pos + length, QTextCursor::KeepAnchor);
return m_cursor->selectedText();
}
- return QString();
+ return {};
}
void ChangeSet::apply_helper()
diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp
index 3527d2e8b..abb053991 100644
--- a/src/lib/corelib/api/project.cpp
+++ b/src/lib/corelib/api/project.cpp
@@ -223,7 +223,7 @@ static ResolvedProductPtr internalProductForProject(const ResolvedProjectConstPt
if (p)
return p;
}
- return ResolvedProductPtr();
+ return {};
}
ResolvedProductPtr ProjectPrivate::internalProduct(const ProductData &product) const
@@ -240,7 +240,7 @@ ProductData ProjectPrivate::findProductData(const ProductData &product) const
return p;
}
}
- return ProductData();
+ return {};
}
QList<ProductData> ProjectPrivate::findProductsByName(const QString &name) const
@@ -259,7 +259,7 @@ GroupData ProjectPrivate::findGroupData(const ProductData &product, const QStrin
if (g.name() == groupName)
return g;
}
- return GroupData();
+ return {};
}
GroupData ProjectPrivate::createGroupDataFromGroup(const GroupPtr &resolvedGroup,
@@ -942,7 +942,7 @@ bool Project::isValid() const
*/
QString Project::profile() const
{
- QBS_ASSERT(isValid(), return QString());
+ QBS_ASSERT(isValid(), return {});
return d->internalProject->profile();
}
@@ -997,7 +997,7 @@ Project::Project()
*/
ProjectData Project::projectData() const
{
- QBS_ASSERT(isValid(), return ProjectData());
+ QBS_ASSERT(isValid(), return {});
return d->projectData();
}
@@ -1149,47 +1149,47 @@ void Project::updateTimestamps(const QList<ProductData> &products)
QStringList Project::generatedFiles(const ProductData &product, const QString &file,
bool recursive, const QStringList &tags) const
{
- QBS_ASSERT(isValid(), return QStringList());
+ QBS_ASSERT(isValid(), return {});
const ResolvedProductConstPtr internalProduct = d->internalProduct(product);
return internalProduct->generatedFiles(file, recursive, FileTags::fromStringList(tags));
}
QVariantMap Project::projectConfiguration() const
{
- QBS_ASSERT(isValid(), return QVariantMap());
+ QBS_ASSERT(isValid(), return {});
return d->internalProject->buildConfiguration();
}
std::set<QString> Project::buildSystemFiles() const
{
- QBS_ASSERT(isValid(), return std::set<QString>());
+ QBS_ASSERT(isValid(), return {});
return d->internalProject->buildSystemFiles.toStdSet();
}
RuleCommandList Project::ruleCommands(const ProductData &product,
const QString &inputFilePath, const QString &outputFileTag, ErrorInfo *error) const
{
- QBS_ASSERT(isValid(), return RuleCommandList());
- QBS_ASSERT(product.isValid(), return RuleCommandList());
+ QBS_ASSERT(isValid(), return {});
+ QBS_ASSERT(product.isValid(), return {});
try {
return d->ruleCommands(product, inputFilePath, outputFileTag);
} catch (const ErrorInfo &e) {
if (error)
*error = e;
- return RuleCommandList();
+ return {};
}
}
ProjectTransformerData Project::transformerData(ErrorInfo *error) const
{
- QBS_ASSERT(isValid(), return ProjectTransformerData());
+ QBS_ASSERT(isValid(), return {});
try {
return d->transformerData();
} catch (const ErrorInfo &e) {
if (error)
*error = e;
- return ProjectTransformerData();
+ return {};
}
}
@@ -1200,7 +1200,7 @@ ErrorInfo Project::dumpNodesTree(QIODevice &outDevice, const QList<ProductData>
} catch (const ErrorInfo &e) {
return e;
}
- return ErrorInfo();
+ return {};
}
Project::BuildGraphInfo Project::getBuildGraphInfo(const QString &bgFilePath,
@@ -1258,7 +1258,7 @@ ErrorInfo Project::addGroup(const ProductData &product, const QString &groupName
d->addGroup(product, groupName);
d->internalProject->lastStartResolveTime = FileTime::currentTime();
d->internalProject->store(d->logger);
- return ErrorInfo();
+ return {};
} catch (ErrorInfo errorInfo) {
errorInfo.prepend(Tr::tr("Failure adding group '%1' to product '%2'.")
.arg(groupName, product.name()));
@@ -1285,7 +1285,7 @@ ErrorInfo Project::addFiles(const ProductData &product, const GroupData &group,
d->addFiles(product, group, filePaths);
d->internalProject->lastStartResolveTime = FileTime::currentTime();
d->internalProject->store(d->logger);
- return ErrorInfo();
+ return {};
} catch (ErrorInfo errorInfo) {
errorInfo.prepend(Tr::tr("Failure adding files to product."));
return errorInfo;
@@ -1311,7 +1311,7 @@ ErrorInfo Project::removeFiles(const ProductData &product, const GroupData &grou
d->removeFiles(product, group, filePaths);
d->internalProject->lastStartResolveTime = FileTime::currentTime();
d->internalProject->store(d->logger);
- return ErrorInfo();
+ return {};
} catch (ErrorInfo errorInfo) {
errorInfo.prepend(Tr::tr("Failure removing files from product '%1'.").arg(product.name()));
return errorInfo;
@@ -1332,7 +1332,7 @@ ErrorInfo Project::removeGroup(const ProductData &product, const GroupData &grou
d->removeGroup(product, group);
d->internalProject->lastStartResolveTime = FileTime::currentTime();
d->internalProject->store(d->logger);
- return ErrorInfo();
+ return {};
} catch (ErrorInfo errorInfo) {
errorInfo.prepend(Tr::tr("Failure removing group '%1' from product '%2'.")
.arg(group.name(), product.name()));
diff --git a/src/lib/corelib/api/projectdata.cpp b/src/lib/corelib/api/projectdata.cpp
index 04c04ad25..a3e6eac25 100644
--- a/src/lib/corelib/api/projectdata.cpp
+++ b/src/lib/corelib/api/projectdata.cpp
@@ -359,7 +359,7 @@ bool InstallData::isInstallable() const
*/
QString InstallData::installDir() const
{
- QBS_ASSERT(isValid(), return QString());
+ QBS_ASSERT(isValid(), return {});
return Internal::FileInfo::path(installFilePath());
}
@@ -368,7 +368,7 @@ QString InstallData::installDir() const
*/
QString InstallData::installFilePath() const
{
- QBS_ASSERT(isValid(), return QString());
+ QBS_ASSERT(isValid(), return {});
return d->installFilePath;
}
@@ -377,7 +377,7 @@ QString InstallData::installFilePath() const
*/
QString InstallData::installRoot() const
{
- QBS_ASSERT(isValid(), return QString());
+ QBS_ASSERT(isValid(), return {});
return d->installRoot;
}
@@ -557,7 +557,7 @@ QList<ArtifactData> ProductData::installableArtifacts() const
*/
QString ProductData::targetExecutable() const
{
- QBS_ASSERT(isValid(), return QString());
+ QBS_ASSERT(isValid(), return {});
if (d->moduleProperties.getModuleProperty(QStringLiteral("bundle"),
QStringLiteral("isBundle")).toBool()) {
for (const ArtifactData &ta : targetArtifacts()) {
@@ -575,7 +575,7 @@ QString ProductData::targetExecutable() const
return ta.filePath();
}
}
- return QString();
+ return {};
}
/*!
diff --git a/src/lib/corelib/api/qmljsrewriter.cpp b/src/lib/corelib/api/qmljsrewriter.cpp
index 6ddd7d5a6..16817d682 100644
--- a/src/lib/corelib/api/qmljsrewriter.cpp
+++ b/src/lib/corelib/api/qmljsrewriter.cpp
@@ -160,7 +160,7 @@ Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast,
m_changeSet->insert(endOfPreviousMember.end(),
newPropertyTemplate.arg(propertyName, propertyValue));
- return Range(endOfPreviousMember.end(), endOfPreviousMember.end());
+ return {int(endOfPreviousMember.end()), int(endOfPreviousMember.end())};
}
UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *members,
@@ -342,7 +342,7 @@ void Rewriter::replaceMemberValue(UiObjectMember *propertyMember,
endOffset = startOffset;
if (publicMember->semicolonToken.isValid())
startOffset = publicMember->semicolonToken.offset;
- replacement.prepend(QLatin1String(": "));
+ replacement.prepend(QStringLiteral(": "));
}
} else {
return;
diff --git a/src/lib/corelib/api/rulecommand.cpp b/src/lib/corelib/api/rulecommand.cpp
index 12c1c1536..bc12140f3 100644
--- a/src/lib/corelib/api/rulecommand.cpp
+++ b/src/lib/corelib/api/rulecommand.cpp
@@ -109,7 +109,7 @@ QString RuleCommand::extendedDescription() const
*/
QString RuleCommand::sourceCode() const
{
- QBS_ASSERT(type() == JavaScriptCommandType, return QString());
+ QBS_ASSERT(type() == JavaScriptCommandType, return {});
return d->sourceCode;
}
@@ -120,7 +120,7 @@ QString RuleCommand::sourceCode() const
*/
QString RuleCommand::executable() const
{
- QBS_ASSERT(type() == ProcessCommandType, return QString());
+ QBS_ASSERT(type() == ProcessCommandType, return {});
return d->executable;
}
@@ -131,7 +131,7 @@ QString RuleCommand::executable() const
*/
QStringList RuleCommand::arguments() const
{
- QBS_ASSERT(type() == ProcessCommandType, return QStringList());
+ QBS_ASSERT(type() == ProcessCommandType, return {});
return d->arguments;
}
@@ -142,7 +142,7 @@ QStringList RuleCommand::arguments() const
*/
QString RuleCommand::workingDirectory() const
{
- QBS_ASSERT(type() == ProcessCommandType, return QString());
+ QBS_ASSERT(type() == ProcessCommandType, return {});
return d->workingDir;
}
@@ -153,7 +153,7 @@ QString RuleCommand::workingDirectory() const
*/
QProcessEnvironment RuleCommand::environment() const
{
- QBS_ASSERT(type() == ProcessCommandType, return QProcessEnvironment());
+ QBS_ASSERT(type() == ProcessCommandType, return {});
return d->environment;
}
diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp
index 3e0d045ec..989918207 100644
--- a/src/lib/corelib/api/runenvironment.cpp
+++ b/src/lib/corelib/api/runenvironment.cpp
@@ -149,7 +149,7 @@ const QProcessEnvironment RunEnvironment::runEnvironment(ErrorInfo *error) const
} catch (const ErrorInfo &e) {
if (error)
*error = e;
- return QProcessEnvironment();
+ return {};
}
}
@@ -160,7 +160,7 @@ const QProcessEnvironment RunEnvironment::buildEnvironment(ErrorInfo *error) con
} catch (const ErrorInfo &e) {
if (error)
*error = e;
- return QProcessEnvironment();
+ return {};
}
}
@@ -238,7 +238,7 @@ static QString findExecutable(const QStringList &fileNames)
return QDir::cleanPath(fullPath);
}
}
- return QString();
+ return {};
}
static std::string readAaptBadgingAttribute(const std::string &line)
@@ -247,7 +247,7 @@ static std::string readAaptBadgingAttribute(const std::string &line)
std::smatch match;
if (std::regex_match(line, match, re))
return match[1];
- return { };
+ return {};
}
static QString findMainIntent(const QString &aapt, const QString &apkFilePath)
@@ -270,7 +270,7 @@ static QString findMainIntent(const QString &aapt, const QString &apkFilePath)
if (!packageId.isEmpty() && !activity.isEmpty())
return packageId + QStringLiteral("/") + activity;
- return QString();
+ return {};
}
void RunEnvironment::printStartInfo(const QProcess &proc, bool dryRun)
diff --git a/src/lib/corelib/buildgraph/buildgraph.cpp b/src/lib/corelib/buildgraph/buildgraph.cpp
index e3afb7216..616658a18 100644
--- a/src/lib/corelib/buildgraph/buildgraph.cpp
+++ b/src/lib/corelib/buildgraph/buildgraph.cpp
@@ -118,14 +118,14 @@ private:
}
getProduct(object);
- QBS_ASSERT(m_product, return QueryFlags());
+ QBS_ASSERT(m_product, {});
const auto it = m_product->productProperties.find(name);
// It is important that we reject unknown property names. Otherwise QtScript will forward
// *everything* to us, including built-in stuff like the hasOwnProperty function.
if (it == m_product->productProperties.cend())
- return QueryFlags();
+ return {};
qbsEngine()->addPropertyRequestedInScript(Property(m_product->uniqueName(), QString(), name,
it.value(), Property::PropertyInProduct));
diff --git a/src/lib/corelib/buildgraph/buildgraphloader.cpp b/src/lib/corelib/buildgraph/buildgraphloader.cpp
index 51f7403b0..fc0492ef3 100644
--- a/src/lib/corelib/buildgraph/buildgraphloader.cpp
+++ b/src/lib/corelib/buildgraph/buildgraphloader.cpp
@@ -280,7 +280,7 @@ static void updateProductAndRulePointers(const ResolvedProductPtr &newProduct)
}
}
QBS_CHECK(false);
- return RuleConstPtr();
+ return {};
};
if (node->type() == BuildGraphNode::RuleNodeType) {
const auto ruleNode = static_cast<RuleNode *>(node);
diff --git a/src/lib/corelib/buildgraph/dependencyparametersscriptvalue.cpp b/src/lib/corelib/buildgraph/dependencyparametersscriptvalue.cpp
index bc62c901c..f1bf8db13 100644
--- a/src/lib/corelib/buildgraph/dependencyparametersscriptvalue.cpp
+++ b/src/lib/corelib/buildgraph/dependencyparametersscriptvalue.cpp
@@ -72,7 +72,7 @@ static QScriptValue toScriptValue(ScriptEngine *engine, const QString &productNa
static QScriptValue toScriptValue(ScriptEngine *scriptEngine, const QString &productName,
const QVariantMap &v, const QString &depName)
{
- return toScriptValue(scriptEngine, productName, v, depName, QualifiedId());
+ return toScriptValue(scriptEngine, productName, v, depName, {});
}
QScriptValue dependencyParametersValue(const QString &productName, const QString &dependencyName,
diff --git a/src/lib/corelib/buildgraph/depscanner.cpp b/src/lib/corelib/buildgraph/depscanner.cpp
index 90c00c70d..a2a39e4b2 100644
--- a/src/lib/corelib/buildgraph/depscanner.cpp
+++ b/src/lib/corelib/buildgraph/depscanner.cpp
@@ -97,7 +97,7 @@ QStringList PluginDependencyScanner::collectSearchPaths(Artifact *artifact)
{
if (m_plugin->flags & ScannerUsesCppIncludePaths)
return collectCppIncludePaths(artifact->properties->value());
- return QStringList();
+ return {};
}
QStringList PluginDependencyScanner::collectDependencies(Artifact *artifact, FileResourceBase *file,
@@ -109,7 +109,7 @@ QStringList PluginDependencyScanner::collectDependencies(Artifact *artifact, Fil
const QString &filepath = file->filePath();
void *scannerHandle = m_plugin->open(filepath.utf16(), fileTags, ScanForDependenciesFlag);
if (!scannerHandle)
- return QStringList();
+ return {};
forever {
int flags = 0;
int length = 0;
@@ -127,7 +127,7 @@ QStringList PluginDependencyScanner::collectDependencies(Artifact *artifact, Fil
result += outFilePath;
}
m_plugin->close(scannerHandle);
- return QStringList(result.toList());
+ return result.toList();
}
bool PluginDependencyScanner::recursive() const
diff --git a/src/lib/corelib/buildgraph/productinstaller.cpp b/src/lib/corelib/buildgraph/productinstaller.cpp
index eee418dc0..cfd74c205 100644
--- a/src/lib/corelib/buildgraph/productinstaller.cpp
+++ b/src/lib/corelib/buildgraph/productinstaller.cpp
@@ -117,7 +117,7 @@ QString ProductInstaller::targetFilePath(const TopLevelProject *project,
InstallOptions &options)
{
if (!properties->qbsPropertyValue(StringConstants::installProperty()).toBool())
- return QString();
+ return {};
const QString relativeInstallDir
= properties->qbsPropertyValue(StringConstants::installDirProperty()).toString();
const QString installPrefix
diff --git a/src/lib/corelib/buildgraph/qtmocscanner.cpp b/src/lib/corelib/buildgraph/qtmocscanner.cpp
index dcdbd82a8..c834c60e6 100644
--- a/src/lib/corelib/buildgraph/qtmocscanner.cpp
+++ b/src/lib/corelib/buildgraph/qtmocscanner.cpp
@@ -82,10 +82,10 @@ public:
: m_id(QStringLiteral("qt") + actualScanner.id()) {}
private:
- QStringList collectSearchPaths(Artifact *) override { return QStringList(); }
+ QStringList collectSearchPaths(Artifact *) override { return {}; }
QStringList collectDependencies(Artifact *, FileResourceBase *, const char *) override
{
- return QStringList();
+ return {};
}
bool recursive() const override { return false; }
const void *key() const override { return nullptr; }
diff --git a/src/lib/corelib/buildgraph/rulecommands.cpp b/src/lib/corelib/buildgraph/rulecommands.cpp
index a15047290..ecbc54292 100644
--- a/src/lib/corelib/buildgraph/rulecommands.cpp
+++ b/src/lib/corelib/buildgraph/rulecommands.cpp
@@ -358,7 +358,7 @@ static QString currentImportScopeName(QScriptContext *context)
if (v.isString())
return v.toString();
}
- return QString();
+ return {};
}
static QScriptValue js_JavaScriptCommand(QScriptContext *context, QScriptEngine *engine)
diff --git a/src/lib/corelib/buildgraph/rulecommands.h b/src/lib/corelib/buildgraph/rulecommands.h
index 4e56359f4..d9d561454 100644
--- a/src/lib/corelib/buildgraph/rulecommands.h
+++ b/src/lib/corelib/buildgraph/rulecommands.h
@@ -65,9 +65,9 @@ public:
JavaScriptCommandType
};
- static QString defaultDescription() { return QString(); }
- static QString defaultExtendedDescription() { return QString(); }
- static QString defaultHighLight() { return QString(); }
+ static QString defaultDescription() { return {}; }
+ static QString defaultExtendedDescription() { return {}; }
+ static QString defaultHighLight() { return {}; }
static bool defaultIgnoreDryRun() { return false; }
static bool defaultIsSilent() { return false; }
diff --git a/src/lib/corelib/buildgraph/transformer.cpp b/src/lib/corelib/buildgraph/transformer.cpp
index e828260c1..cf632463d 100644
--- a/src/lib/corelib/buildgraph/transformer.cpp
+++ b/src/lib/corelib/buildgraph/transformer.cpp
@@ -71,7 +71,7 @@ static QScriptValue js_baseName(QScriptContext *ctx, QScriptEngine *engine,
{
Q_UNUSED(ctx);
Q_UNUSED(engine);
- return QScriptValue(FileInfo::baseName(artifact->filePath()));
+ return {FileInfo::baseName(artifact->filePath())};
}
static QScriptValue js_completeBaseName(QScriptContext *ctx, QScriptEngine *engine,
@@ -79,7 +79,7 @@ static QScriptValue js_completeBaseName(QScriptContext *ctx, QScriptEngine *engi
{
Q_UNUSED(ctx);
Q_UNUSED(engine);
- return QScriptValue(FileInfo::completeBaseName(artifact->filePath()));
+ return {FileInfo::completeBaseName(artifact->filePath())};
}
static QScriptValue js_baseDir(QScriptContext *ctx, QScriptEngine *engine,
@@ -175,7 +175,7 @@ QScriptValue Transformer::translateInOutputs(ScriptEngine *scriptEngine,
ResolvedProductPtr Transformer::product() const
{
if (outputs.empty())
- return ResolvedProductPtr();
+ return {};
return (*outputs.cbegin())->product.lock();
}
diff --git a/src/lib/corelib/buildgraph/transformerchangetracking.cpp b/src/lib/corelib/buildgraph/transformerchangetracking.cpp
index 551d2b1b1..08875b742 100644
--- a/src/lib/corelib/buildgraph/transformerchangetracking.cpp
+++ b/src/lib/corelib/buildgraph/transformerchangetracking.cpp
@@ -91,7 +91,7 @@ template<typename T> static QVariantMap getParameterValue(
if (it.key()->name == depName)
return it.value();
}
- return QVariantMap();
+ return {};
}
QVariantMap TrafoChangeTracker::propertyMapByKind(const Property &property) const
@@ -111,14 +111,14 @@ QVariantMap TrafoChangeTracker::propertyMapByKind(const Property &property) cons
const auto it = m_projectsByName.find(property.productName);
if (it != m_projectsByName.cend())
return it->second->projectProperties();
- return QVariantMap();
+ return {};
}
case Property::PropertyInParameters: {
const int sepIndex = property.moduleName.indexOf(QLatin1Char(':'));
const QString depName = property.moduleName.left(sepIndex);
const ResolvedProduct * const p = getProduct(property.productName);
if (!p)
- return QVariantMap();
+ return {};
QVariantMap v = getParameterValue(p->dependencyParameters, depName);
if (!v.empty())
return v;
@@ -128,7 +128,7 @@ QVariantMap TrafoChangeTracker::propertyMapByKind(const Property &property) cons
default:
QBS_CHECK(false);
}
- return QVariantMap();
+ return {};
}
bool TrafoChangeTracker::checkForPropertyChange(const Property &restoredProperty,
diff --git a/src/lib/corelib/generators/generator.cpp b/src/lib/corelib/generators/generator.cpp
index e4a0ee51e..24da95e41 100644
--- a/src/lib/corelib/generators/generator.cpp
+++ b/src/lib/corelib/generators/generator.cpp
@@ -101,7 +101,7 @@ ErrorInfo ProjectGenerator::generate(const QList<Project> &projects,
} catch (const ErrorInfo &e) {
return e;
}
- return ErrorInfo();
+ return {};
}
QList<Project> ProjectGenerator::projects() const
@@ -118,7 +118,7 @@ QVariantMap ProjectGenerator::buildConfiguration(const Project &project) const
{
int idx = d->projects.indexOf(project);
if (idx < 0)
- return QVariantMap();
+ return {};
return d->buildConfigurations.at(idx);
}
diff --git a/src/lib/corelib/jsextensions/binaryfile.cpp b/src/lib/corelib/jsextensions/binaryfile.cpp
index f91274317..92f07d88d 100644
--- a/src/lib/corelib/jsextensions/binaryfile.cpp
+++ b/src/lib/corelib/jsextensions/binaryfile.cpp
@@ -167,7 +167,7 @@ void BinaryFile::close()
QString BinaryFile::filePath()
{
if (checkForClosed())
- return QString();
+ return {};
return QFileInfo(*m_file).absoluteFilePath();
}
@@ -215,7 +215,7 @@ void BinaryFile::seek(qint64 pos)
QVariantList BinaryFile::read(qint64 size)
{
if (checkForClosed())
- return QVariantList();
+ return {};
const QByteArray bytes = m_file->read(size);
if (Q_UNLIKELY(bytes.size() == 0 && m_file->error() != QFile::NoError)) {
context()->throwError(Tr::tr("Could not read from '%1': %2")
diff --git a/src/lib/corelib/jsextensions/domxml.cpp b/src/lib/corelib/jsextensions/domxml.cpp
index c6c34b3d3..118e8d5e1 100644
--- a/src/lib/corelib/jsextensions/domxml.cpp
+++ b/src/lib/corelib/jsextensions/domxml.cpp
@@ -268,7 +268,7 @@ QString XmlDomNode::tagName() const
QDomElement el = m_domNode.toElement();
if (el.isNull()) {
context()->throwError(QStringLiteral("Node '%1' is not an element node").arg(m_domNode.nodeName()));
- return QString();
+ return {};
}
return el.tagName();
}
@@ -288,7 +288,7 @@ QString XmlDomNode::text() const
QDomElement el = m_domNode.toElement();
if (el.isNull()) {
context()->throwError(QStringLiteral("Node '%1' is not an element node").arg(m_domNode.nodeName()));
- return QString();
+ return {};
}
return el.text();
}
@@ -302,7 +302,7 @@ QString XmlDomNode::data() const
if (m_domNode.isCharacterData())
return m_domNode.toCharacterData().data();
context()->throwError(QStringLiteral("Node '%1' is not a character data node").arg(m_domNode.nodeName()));
- return QString();
+ return {};
}
void XmlDomNode::setData(const QString &v) const
@@ -370,7 +370,7 @@ QScriptValue XmlDomNode::appendChild(QScriptValue newChild)
auto newNode = qobject_cast<XmlDomNode*>(newChild.toQObject());
if (!newNode) {
context()->throwError(QStringLiteral("First argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
return engine()->newQObject(new XmlDomNode(m_domNode.appendChild(newNode->m_domNode)), QScriptEngine::ScriptOwnership);
}
@@ -380,13 +380,13 @@ QScriptValue XmlDomNode::insertBefore(const QScriptValue &newChild, const QScrip
auto newNode = qobject_cast<XmlDomNode*>(newChild.toQObject());
if (!newNode) {
context()->throwError(QStringLiteral("First argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
auto refNode = qobject_cast<XmlDomNode*>(refChild.toQObject());
if (!refNode) {
context()->throwError(QStringLiteral("Second argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
return engine()->newQObject(new XmlDomNode(m_domNode.insertBefore(newNode->m_domNode, refNode->m_domNode)), QScriptEngine::ScriptOwnership);
@@ -397,13 +397,13 @@ QScriptValue XmlDomNode::insertAfter(const QScriptValue &newChild, const QScript
auto newNode = qobject_cast<XmlDomNode*>(newChild.toQObject());
if (!newNode) {
context()->throwError(QStringLiteral("First argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
auto refNode = qobject_cast<XmlDomNode*>(refChild.toQObject());
if (!refNode) {
context()->throwError(QStringLiteral("Second argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
return engine()->newQObject(new XmlDomNode(m_domNode.insertAfter(newNode->m_domNode, refNode->m_domNode)), QScriptEngine::ScriptOwnership);
@@ -414,13 +414,13 @@ QScriptValue XmlDomNode::replaceChild(const QScriptValue &newChild, const QScrip
auto newNode = qobject_cast<XmlDomNode*>(newChild.toQObject());
if (!newNode) {
context()->throwError(QStringLiteral("First argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
auto oldNode = qobject_cast<XmlDomNode*>(oldChild.toQObject());
if (!oldNode) {
context()->throwError(QStringLiteral("Second argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
return engine()->newQObject(new XmlDomNode(m_domNode.replaceChild(newNode->m_domNode, oldNode->m_domNode)), QScriptEngine::ScriptOwnership);
@@ -431,7 +431,7 @@ QScriptValue XmlDomNode::removeChild(const QScriptValue &oldChild)
auto oldNode = qobject_cast<XmlDomNode*>(oldChild.toQObject());
if (!oldNode) {
context()->throwError(QStringLiteral("First argument is not a XmlDomNode object"));
- return QScriptValue();
+ return {};
}
return engine()->newQObject(new XmlDomNode(m_domNode.removeChild(oldNode->m_domNode)), QScriptEngine::ScriptOwnership);
diff --git a/src/lib/corelib/jsextensions/jsextensions.cpp b/src/lib/corelib/jsextensions/jsextensions.cpp
index 0b888d3aa..e5fbd3de8 100644
--- a/src/lib/corelib/jsextensions/jsextensions.cpp
+++ b/src/lib/corelib/jsextensions/jsextensions.cpp
@@ -84,7 +84,7 @@ void JsExtensions::setupExtensions(const QStringList &names, QScriptValue scope)
QScriptValue JsExtensions::loadExtension(QScriptEngine *engine, const QString &name)
{
if (!hasExtension(name))
- return QScriptValue();
+ return {};
QScriptValue extensionObj = engine->newObject();
initializers().value(name)(extensionObj);
diff --git a/src/lib/corelib/jsextensions/moduleproperties.cpp b/src/lib/corelib/jsextensions/moduleproperties.cpp
index 4634d1ff6..91169d24b 100644
--- a/src/lib/corelib/jsextensions/moduleproperties.cpp
+++ b/src/lib/corelib/jsextensions/moduleproperties.cpp
@@ -130,7 +130,7 @@ private:
}
setup(object);
- QBS_ASSERT(m_product || m_artifact, return QueryFlags());
+ QBS_ASSERT(m_product || m_artifact, return {});
bool isPresent;
m_result = getModuleProperty(m_product, m_artifact, static_cast<ScriptEngine *>(engine()),
m_moduleName, name, &isPresent);
diff --git a/src/lib/corelib/jsextensions/propertylist.mm b/src/lib/corelib/jsextensions/propertylist.mm
index eed1fec9b..d73cd742d 100644
--- a/src/lib/corelib/jsextensions/propertylist.mm
+++ b/src/lib/corelib/jsextensions/propertylist.mm
@@ -232,13 +232,13 @@ QString PropertyList::toString(const QString &plistFormat) const
p->context()->throwError(QStringLiteral("Property list object cannot be converted to a "
"string in the binary1 format; this format can only "
"be written directly to a file"));
- return QString();
+ return {};
}
if (!isEmpty())
return QString::fromUtf8(p->d->writeToData(p->context(), plistFormat));
- return QString();
+ return {};
}
QString PropertyList::toXMLString() const
diff --git a/src/lib/corelib/jsextensions/textfile.cpp b/src/lib/corelib/jsextensions/textfile.cpp
index e4e65531b..51688677f 100644
--- a/src/lib/corelib/jsextensions/textfile.cpp
+++ b/src/lib/corelib/jsextensions/textfile.cpp
@@ -173,7 +173,7 @@ void TextFile::close()
QString TextFile::filePath()
{
if (checkForClosed())
- return QString();
+ return {};
return QFileInfo(*m_file).absoluteFilePath();
}
@@ -187,14 +187,14 @@ void TextFile::setCodec(const QString &codec)
QString TextFile::readLine()
{
if (checkForClosed())
- return QString();
+ return {};
return m_stream->readLine();
}
QString TextFile::readAll()
{
if (checkForClosed())
- return QString();
+ return {};
return m_stream->readAll();
}
diff --git a/src/lib/corelib/jsextensions/utilitiesextension.cpp b/src/lib/corelib/jsextensions/utilitiesextension.cpp
index 0c5313e3c..5abaccad9 100644
--- a/src/lib/corelib/jsextensions/utilitiesextension.cpp
+++ b/src/lib/corelib/jsextensions/utilitiesextension.cpp
@@ -567,7 +567,7 @@ static QString archName(cpu_type_t cputype, cpu_subtype_t cpusubtype)
case CPU_SUBTYPE_X86_ALL:
return QStringLiteral("i386");
default:
- return QString();
+ return {};
}
case CPU_TYPE_X86_64:
switch (cpusubtype) {
@@ -576,7 +576,7 @@ static QString archName(cpu_type_t cputype, cpu_subtype_t cpusubtype)
case CPU_SUBTYPE_X86_64_H:
return QStringLiteral("x86_64h");
default:
- return QString();
+ return {};
}
case CPU_TYPE_ARM:
switch (cpusubtype) {
@@ -587,17 +587,17 @@ static QString archName(cpu_type_t cputype, cpu_subtype_t cpusubtype)
case CPU_SUBTYPE_ARM_V7K:
return QStringLiteral("armv7k");
default:
- return QString();
+ return {};
}
case CPU_TYPE_ARM64:
switch (cpusubtype) {
case CPU_SUBTYPE_ARM64_ALL:
return QStringLiteral("arm64");
default:
- return QString();
+ return {};
}
default:
- return QString();
+ return {};
}
}
@@ -615,7 +615,7 @@ static QStringList detectMachOArchs(QIODevice *device)
ar_hdr header;
if (device->read(reinterpret_cast<char *>(&header),
sizeof(ar_hdr)) != sizeof(ar_hdr))
- return { };
+ return {};
// If the file name is stored in the "extended format" manner,
// the real filename is prepended to the data section, so skip that many bytes
@@ -626,7 +626,7 @@ static QStringList detectMachOArchs(QIODevice *device)
sizeof(header.ar_name) - (sizeof(AR_EFMT1) - 1) - 1);
filenameLength = strtoul(arName, nullptr, 10);
if (device->read(filenameLength).size() != filenameLength)
- return { };
+ return {};
}
switch (readInt(device, nullptr, false, true)) {
@@ -646,7 +646,7 @@ static QStringList detectMachOArchs(QIODevice *device)
sz -= filenameLength;
const auto data = device->read(sz);
if (data.size() != sz)
- return { };
+ return {};
}
}
@@ -658,7 +658,7 @@ static QStringList detectMachOArchs(QIODevice *device)
// Wasn't an archive file, so try a fat file
if (!foundMachO && !device->seek(pos))
- return QStringList();
+ return {};
pos = device->pos();
@@ -670,7 +670,7 @@ static QStringList detectMachOArchs(QIODevice *device)
const bool is64bit = fatheader.magic == FAT_MAGIC_64 || fatheader.magic == FAT_CIGAM_64;
fatheader.nfat_arch = readInt(device, &ok, swap);
if (!ok)
- return QStringList();
+ return {};
QStringList archs;
@@ -680,7 +680,7 @@ static QStringList detectMachOArchs(QIODevice *device)
static_assert(sizeof(fat_arch) == 20, "sizeof(fat_arch) != 20");
const qint64 expectedBytes = is64bit ? sizeof(fat_arch_64) : sizeof(fat_arch);
if (device->read(reinterpret_cast<char *>(&fatarch), expectedBytes) != expectedBytes)
- return QStringList();
+ return {};
if (swap) {
fatarch.cputype = qbswap(fatarch.cputype);
@@ -691,7 +691,7 @@ static QStringList detectMachOArchs(QIODevice *device)
if (name.isEmpty()) {
qWarning("Unknown cputype %d and cpusubtype %d",
fatarch.cputype, fatarch.cpusubtype);
- return QStringList();
+ return {};
}
archs.push_back(name);
}
@@ -702,7 +702,7 @@ static QStringList detectMachOArchs(QIODevice *device)
// Wasn't a fat file, so we just read a thin Mach-O from the original offset
if (!device->seek(pos))
- return QStringList();
+ return {};
bool swap = false;
mach_header header;
@@ -716,24 +716,24 @@ static QStringList detectMachOArchs(QIODevice *device)
case MH_MAGIC_64:
break;
default:
- return QStringList();
+ return {};
}
header.cputype = static_cast<cpu_type_t>(readInt(device, &ok, swap));
if (!ok)
- return QStringList();
+ return {};
header.cpusubtype = static_cast<cpu_subtype_t>(readInt(device, &ok, swap));
if (!ok)
- return QStringList();
+ return {};
const QString name = archName(header.cputype, header.cpusubtype);
if (name.isEmpty()) {
qWarning("Unknown cputype %d and cpusubtype %d",
header.cputype, header.cpusubtype);
- return { };
+ return {};
}
- return { name };
+ return {name};
}
#endif
diff --git a/src/lib/corelib/language/asttools.cpp b/src/lib/corelib/language/asttools.cpp
index a46e2c554..617c8b95b 100644
--- a/src/lib/corelib/language/asttools.cpp
+++ b/src/lib/corelib/language/asttools.cpp
@@ -59,7 +59,7 @@ CodeLocation toCodeLocation(const QString &filePath, const QbsQmlJS::AST::Source
QString textOf(const QString &source, QbsQmlJS::AST::Node *node)
{
if (!node)
- return QString();
+ return {};
return source.mid(node->firstSourceLocation().begin(),
node->lastSourceLocation().end() - node->firstSourceLocation().begin());
}
diff --git a/src/lib/corelib/language/builtindeclarations.cpp b/src/lib/corelib/language/builtindeclarations.cpp
index 34cd497da..ee1b2d56e 100644
--- a/src/lib/corelib/language/builtindeclarations.cpp
+++ b/src/lib/corelib/language/builtindeclarations.cpp
@@ -143,7 +143,7 @@ QString BuiltinDeclarations::nameForType(ItemType itemType) const
return it.key();
}
QBS_CHECK(false);
- return QString();
+ return {};
}
QStringList BuiltinDeclarations::argumentNamesForScriptFunction(ItemType itemType,
@@ -155,7 +155,7 @@ QStringList BuiltinDeclarations::argumentNamesForScriptFunction(ItemType itemTyp
return propDecl.functionArgumentNames();
}
QBS_CHECK(false);
- return QStringList();
+ return {};
}
void BuiltinDeclarations::insert(const ItemDeclaration &decl)
@@ -201,7 +201,7 @@ static PropertyDeclaration prepareScriptProperty()
static PropertyDeclaration priorityProperty()
{
- return PropertyDeclaration(StringConstants::priorityProperty(), PropertyDeclaration::Integer);
+ return {StringConstants::priorityProperty(), PropertyDeclaration::Integer};
}
void BuiltinDeclarations::addArtifactItem()
diff --git a/src/lib/corelib/language/evaluator.cpp b/src/lib/corelib/language/evaluator.cpp
index 22dc06cdd..5ea506d6a 100644
--- a/src/lib/corelib/language/evaluator.cpp
+++ b/src/lib/corelib/language/evaluator.cpp
@@ -118,7 +118,7 @@ QString Evaluator::stringValue(const Item *item, const QString &name,
static QStringList toStringList(const QScriptValue &scriptValue)
{
if (scriptValue.isString()) {
- return QStringList(scriptValue.toString());
+ return {scriptValue.toString()};
} else if (scriptValue.isArray()) {
QStringList lst;
int i = 0;
@@ -130,7 +130,7 @@ static QStringList toStringList(const QScriptValue &scriptValue)
}
return lst;
}
- return QStringList();
+ return {};
}
QStringList Evaluator::stringListValue(const Item *item, const QString &name, bool *propertyWasSet)
diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp
index c0e140d0b..55a9e1aac 100644
--- a/src/lib/corelib/language/evaluatorscriptclass.cpp
+++ b/src/lib/corelib/language/evaluatorscriptclass.cpp
@@ -376,7 +376,7 @@ QScriptClass::QueryFlags EvaluatorScriptClass::queryProperty(const QScriptValue
// We assume that it's safe to save the result of the query in a member of the scriptclass.
// It must be cleared in the property method before doing any further lookup.
- QBS_ASSERT(m_queryResult.isNull(), return QueryFlags());
+ QBS_ASSERT(m_queryResult.isNull(), return {});
if (debugProperties)
qDebug() << "[SC] queryProperty " << object.objectId() << " " << name;
@@ -393,7 +393,7 @@ QScriptClass::QueryFlags EvaluatorScriptClass::queryProperty(const QScriptValue
if (!data) {
if (debugProperties)
qDebug() << "[SC] queryProperty: no data attached";
- return QScriptClass::QueryFlags();
+ return {};
}
return queryItemProperty(data, nameString);
@@ -427,7 +427,7 @@ QScriptClass::QueryFlags EvaluatorScriptClass::queryItemProperty(const Evaluatio
if (debugProperties)
qDebug() << "[SC] queryProperty: no such property";
- return QScriptClass::QueryFlags();
+ return {};
}
QString EvaluatorScriptClass::resultToString(const QScriptValue &scriptValue)
@@ -652,7 +652,7 @@ QScriptValue EvaluatorScriptClass::property(const QScriptValue &object, const QS
m_queryResult.foundInParent = false;
m_queryResult.data = nullptr;
m_queryResult.itemOfProperty = nullptr;
- QBS_ASSERT(data, return QScriptValue());
+ QBS_ASSERT(data, {});
const auto qpt = static_cast<QueryPropertyType>(id);
if (qpt == QPTParentProperty) {
@@ -663,8 +663,8 @@ QScriptValue EvaluatorScriptClass::property(const QScriptValue &object, const QS
ValuePtr value;
m_queryResult.value.swap(value);
- QBS_ASSERT(value, return QScriptValue());
- QBS_ASSERT(m_queryResult.isNull(), return QScriptValue());
+ QBS_ASSERT(value, return {});
+ QBS_ASSERT(m_queryResult.isNull(), return {});
if (debugProperties)
qDebug() << "[SC] property " << name;
diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp
index 86056f2a6..239eddf1f 100644
--- a/src/lib/corelib/language/language.cpp
+++ b/src/lib/corelib/language/language.cpp
@@ -468,13 +468,13 @@ QStringList ResolvedProduct::generatedFiles(const QString &baseFile, bool recurs
{
ProductBuildData *data = buildData.get();
if (!data)
- return QStringList();
+ return {};
for (const Artifact *art : filterByType<Artifact>(data->allNodes())) {
if (art->filePath() == baseFile)
return findGeneratedFiles(art, recursive, tags);
}
- return QStringList();
+ return {};
}
QString ResolvedProduct::deriveBuildDirectoryName(const QString &name,
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index abe10bf24..d7fb9b75d 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -108,7 +108,7 @@ static QString probeGlobalId(Item *probe)
}
if (id.isEmpty())
- return QString();
+ return {};
QBS_CHECK(probe->file());
return id + QLatin1Char('_') + probe->file()->filePath();
@@ -1773,14 +1773,14 @@ ProbeConstPtr ModuleLoader::findOldProjectProbe(
const QString &sourceCode) const
{
if (m_parameters.forceProbeExecution())
- return ProbeConstPtr();
+ return {};
for (const ProbeConstPtr &oldProbe : m_oldProjectProbes.value(globalId)) {
if (probeMatches(oldProbe, condition, initialProperties, sourceCode, CompareScript::Yes))
return oldProbe;
}
- return ProbeConstPtr();
+ return {};
}
ProbeConstPtr ModuleLoader::findOldProductProbe(
@@ -1790,14 +1790,14 @@ ProbeConstPtr ModuleLoader::findOldProductProbe(
const QString &sourceCode) const
{
if (m_parameters.forceProbeExecution())
- return ProbeConstPtr();
+ return {};
for (const ProbeConstPtr &oldProbe : m_oldProductProbes.value(productName)) {
if (probeMatches(oldProbe, condition, initialProperties, sourceCode, CompareScript::Yes))
return oldProbe;
}
- return ProbeConstPtr();
+ return {};
}
ProbeConstPtr ModuleLoader::findCurrentProbe(
@@ -1810,7 +1810,7 @@ ProbeConstPtr ModuleLoader::findCurrentProbe(
if (probeMatches(probe, condition, initialProperties, QString(), CompareScript::No))
return probe;
}
- return ProbeConstPtr();
+ return {};
}
bool ModuleLoader::probeMatches(const ProbeConstPtr &probe, bool condition,
@@ -3679,7 +3679,7 @@ QString ModuleLoader::findExistingModulePath(const QString &searchPath,
for (const QString &moduleNamePart : moduleName) {
dirPath = FileInfo::resolvePath(dirPath, moduleNamePart);
if (!FileInfo::exists(dirPath) || !FileInfo::isFileCaseCorrect(dirPath))
- return QString();
+ return {};
}
return dirPath;
}
@@ -3810,7 +3810,7 @@ ModuleLoader::ModuleProviderResult ModuleLoader::findModuleProvider(const Qualif
qCDebug(lcModuleLoader) << "Module provider did run, but did not set up "
"any modules.";
addToGlobalInfo();
- return ModuleProviderResult(true, false);
+ return {true, false};
}
qCDebug(lcModuleLoader) << "Module provider added" << searchPaths.size()
<< "new search path(s)";
@@ -3824,9 +3824,9 @@ ModuleLoader::ModuleProviderResult ModuleLoader::findModuleProvider(const Qualif
product.searchPaths << searchPaths; // (2)
product.newlyAddedModuleProviderSearchPaths.push_back(searchPaths); // (3)
addToGlobalInfo(); // (4)
- return ModuleProviderResult(true, true);
+ return {true, true};
}
- return ModuleProviderResult();
+ return {};
}
void ModuleLoader::setScopeForDescendants(Item *item, Item *scope)
diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp
index 6d5435899..0bbf8d37a 100644
--- a/src/lib/corelib/language/projectresolver.cpp
+++ b/src/lib/corelib/language/projectresolver.cpp
@@ -612,7 +612,7 @@ SourceArtifactPtr ProjectResolver::createSourceArtifact(const ResolvedProductPtr
if (errorInfo)
errorInfo->append(Tr::tr("File '%1' does not exist.").arg(absFilePath), filesLocation);
rproduct->missingSourceFiles << absFilePath;
- return SourceArtifactPtr();
+ return {};
}
if (group->enabled && fileLocations) {
CodeLocation &loc = (*fileLocations)[std::make_pair(group->targetOfModule, absFilePath)];
@@ -622,7 +622,7 @@ SourceArtifactPtr ProjectResolver::createSourceArtifact(const ResolvedProductPtr
errorInfo->append(Tr::tr("First occurrence is here."), loc);
errorInfo->append(Tr::tr("Next occurrence is here."), filesLocation);
}
- return SourceArtifactPtr();
+ return {};
}
loc = filesLocation;
}
@@ -660,7 +660,7 @@ QVariantMap ProjectResolver::resolveAdditionalModuleProperties(const Item *group
.modulePropertiesSetInGroups;
const auto it = mp.find(group);
if (it == mp.end())
- return QVariantMap();
+ return {};
const QualifiedIdSet &propsSetInGroup = it->second;
// Step 2: Gather all properties that depend on these properties.
diff --git a/src/lib/corelib/language/propertymapinternal.cpp b/src/lib/corelib/language/propertymapinternal.cpp
index 6162f5c3c..2a35e2a6a 100644
--- a/src/lib/corelib/language/propertymapinternal.cpp
+++ b/src/lib/corelib/language/propertymapinternal.cpp
@@ -94,14 +94,14 @@ QVariant moduleProperty(const QVariantMap &properties, const QString &moduleName
if (moduleIt == properties.end()) {
if (isPresent)
*isPresent = false;
- return QVariant();
+ return {};
}
const QVariantMap &moduleMap = moduleIt.value().toMap();
const auto propertyIt = moduleMap.find(key);
if (propertyIt == moduleMap.end()) {
if (isPresent)
*isPresent = false;
- return QVariant();
+ return {};
}
if (isPresent)
*isPresent = true;
diff --git a/src/lib/corelib/language/scriptengine.cpp b/src/lib/corelib/language/scriptengine.cpp
index 973501bc3..1c6d0cb0d 100644
--- a/src/lib/corelib/language/scriptengine.cpp
+++ b/src/lib/corelib/language/scriptengine.cpp
@@ -397,7 +397,7 @@ static QString findExtensionDir(const QStringList &searchPaths, const QString &e
if (fi.exists() && fi.isDir())
return dirPath;
}
- return QString();
+ return {};
}
static QScriptValue mergeExtensionObjects(const QScriptValueList &lst)
diff --git a/src/lib/corelib/language/value.h b/src/lib/corelib/language/value.h
index fde8e79e4..b9a869d73 100644
--- a/src/lib/corelib/language/value.h
+++ b/src/lib/corelib/language/value.h
@@ -68,7 +68,7 @@ public:
Type type() const { return m_type; }
virtual void apply(ValueHandler *) = 0;
virtual ValuePtr clone() const = 0;
- virtual CodeLocation location() const { return CodeLocation(); }
+ virtual CodeLocation location() const { return {}; }
Item *definingItem() const;
virtual void setDefiningItem(Item *item);
diff --git a/src/lib/corelib/logging/ilogsink.cpp b/src/lib/corelib/logging/ilogsink.cpp
index ba5b68f71..bc2f36e61 100644
--- a/src/lib/corelib/logging/ilogsink.cpp
+++ b/src/lib/corelib/logging/ilogsink.cpp
@@ -49,7 +49,7 @@ namespace qbs {
QString logLevelTag(LoggerLevel level)
{
if (level == LoggerInfo)
- return QString();
+ return {};
QString str = logLevelName(level).toUpper();
if (!str.isEmpty())
str.append(QLatin1String(": "));
@@ -72,7 +72,7 @@ QString logLevelName(LoggerLevel level)
default:
break;
}
- return QString();
+ return {};
}
class ILogSink::ILogSinkPrivate
diff --git a/src/lib/corelib/parser/qmlerror.cpp b/src/lib/corelib/parser/qmlerror.cpp
index 2a951df12..e72e79f87 100644
--- a/src/lib/corelib/parser/qmlerror.cpp
+++ b/src/lib/corelib/parser/qmlerror.cpp
@@ -147,7 +147,7 @@ bool QmlError::isValid() const
QUrl QmlError::url() const
{
if (d) return d->url;
- else return QUrl();
+ else return {};
}
/*!
@@ -165,7 +165,7 @@ void QmlError::setUrl(const QUrl &url)
QString QmlError::description() const
{
if (d) return d->description;
- else return QString();
+ else return {};
}
/*!
diff --git a/src/lib/corelib/parser/qmljslexer.cpp b/src/lib/corelib/parser/qmljslexer.cpp
index 2c96aa8cf..ef57ab84a 100644
--- a/src/lib/corelib/parser/qmljslexer.cpp
+++ b/src/lib/corelib/parser/qmljslexer.cpp
@@ -73,7 +73,7 @@ static unsigned char convertHex(ushort c)
static QChar convertHex(QChar c1, QChar c2)
{
- return QChar((convertHex(c1.unicode()) << 4) + convertHex(c2.unicode()));
+ return {(convertHex(c1.unicode()) << 4) + convertHex(c2.unicode())};
}
static QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4)
@@ -267,7 +267,7 @@ QChar Lexer::decodeUnicodeEscapeCharacter(bool *ok)
}
*ok = false;
- return QChar();
+ return {};
}
int Lexer::scanToken()
diff --git a/src/lib/corelib/tools/applecodesignutils.cpp b/src/lib/corelib/tools/applecodesignutils.cpp
index f89fc7732..67c4f5238 100644
--- a/src/lib/corelib/tools/applecodesignutils.cpp
+++ b/src/lib/corelib/tools/applecodesignutils.cpp
@@ -58,17 +58,17 @@ QByteArray smimeMessageContent(const QByteArray &data)
{
QCFType<CMSDecoderRef> decoder = NULL;
if (CMSDecoderCreate(&decoder) != noErr)
- return QByteArray();
+ return {};
if (CMSDecoderUpdateMessage(decoder, data.constData(), data.size()) != noErr)
- return QByteArray();
+ return {};
if (CMSDecoderFinalizeMessage(decoder) != noErr)
- return QByteArray();
+ return {};
QCFType<CFDataRef> content = NULL;
if (CMSDecoderCopyContent(decoder, &content) != noErr)
- return QByteArray();
+ return {};
return QByteArray::fromCFData(content);
}
@@ -83,7 +83,7 @@ QVariantMap certificateInfo(const QByteArray &data)
for (const auto &extension : cert.extensions()) {
if (extension.name() == QStringLiteral("extendedKeyUsage")) {
if (!extension.value().toStringList().contains(QStringLiteral("Code Signing")))
- return QVariantMap();
+ return {};
}
}
@@ -120,7 +120,7 @@ QVariantMap identitiesProperties()
&kCFTypeDictionaryValueCallBacks);
QCFType<CFTypeRef> result = NULL;
if (SecItemCopyMatching(query, &result) != errSecSuccess)
- return QVariantMap();
+ return {};
QVariantMap items;
const auto tryAppend = [&](SecIdentityRef identity) {
diff --git a/src/lib/corelib/tools/commandechomode.cpp b/src/lib/corelib/tools/commandechomode.cpp
index aef9faa11..c47ddb5bc 100644
--- a/src/lib/corelib/tools/commandechomode.cpp
+++ b/src/lib/corelib/tools/commandechomode.cpp
@@ -74,7 +74,7 @@ QString commandEchoModeName(CommandEchoMode mode)
default:
break;
}
- return QString();
+ return {};
}
CommandEchoMode commandEchoModeFromName(const QString &name)
diff --git a/src/lib/corelib/tools/fileinfo.cpp b/src/lib/corelib/tools/fileinfo.cpp
index eb24fdd37..cec6b2660 100644
--- a/src/lib/corelib/tools/fileinfo.cpp
+++ b/src/lib/corelib/tools/fileinfo.cpp
@@ -107,7 +107,7 @@ QString FileInfo::completeSuffix(const QString &fp)
QString FileInfo::path(const QString &fp, HostOsInfo::HostOs hostOs)
{
if (fp.isEmpty())
- return QString();
+ return {};
int last = fp.lastIndexOf(QLatin1Char('/'));
if (last < 0)
return StringConstants::dot();
@@ -207,7 +207,7 @@ QString FileInfo::resolvePath(const QString &base, const QString &rel, HostOsInf
{
QBS_ASSERT(isAbsolute(base, hostOs) && !isCurrentDrivePath(rel, hostOs),
qDebug("base: %s, rel: %s", qPrintable(base), qPrintable(rel));
- return QString());
+ return {});
if (isAbsolute(rel, hostOs))
return rel;
if (rel.size() == 1 && rel.at(0) == QLatin1Char('.'))
@@ -324,7 +324,7 @@ FileTime FileInfo::lastModified() const
{
const FileTime::InternalType* ft_it;
ft_it = reinterpret_cast<const FileTime::InternalType*>(&z(m_stat)->ftLastWriteTime);
- return FileTime(*ft_it);
+ return {*ft_it};
}
FileTime FileInfo::lastStatusChange() const
@@ -453,7 +453,7 @@ static QByteArray storedLinkTarget(const QString &filePath)
if (lstat(nativeFilePath.constData(), &sb)) {
qWarning("storedLinkTarget: lstat for %s failed with error code %d",
nativeFilePath.constData(), errno);
- return QByteArray();
+ return {};
}
result.resize(sb.st_size);
@@ -461,7 +461,7 @@ static QByteArray storedLinkTarget(const QString &filePath)
if (len < 0) {
qWarning("storedLinkTarget: readlink for %s failed with error code %d",
nativeFilePath.constData(), errno);
- return QByteArray();
+ return {};
}
if (len < sb.st_size) {
diff --git a/src/lib/corelib/tools/id.cpp b/src/lib/corelib/tools/id.cpp
index 1c61792e6..9d31d3776 100644
--- a/src/lib/corelib/tools/id.cpp
+++ b/src/lib/corelib/tools/id.cpp
@@ -214,7 +214,7 @@ QString Id::toString() const
QVariant Id::toSetting() const
{
- return QVariant(QString::fromUtf8(getStringFromId(m_id)));
+ return QString::fromUtf8(getStringFromId(m_id));
}
/*!
@@ -227,8 +227,8 @@ Id Id::fromSetting(const QVariant &variant)
{
const QByteArray ba = variant.toString().toUtf8();
if (ba.isEmpty())
- return Id();
- return Id(theId(ba));
+ return {};
+ return {theId(ba)};
}
/*!
@@ -242,7 +242,7 @@ Id Id::fromSetting(const QVariant &variant)
Id Id::withSuffix(int suffix) const
{
const QByteArray ba = name() + QByteArray::number(suffix);
- return Id(ba.constData());
+ return {ba.constData()};
}
/*!
@@ -252,7 +252,7 @@ Id Id::withSuffix(int suffix) const
Id Id::withSuffix(const char *suffix) const
{
const QByteArray ba = name() + suffix;
- return Id(ba.constData());
+ return {ba.constData()};
}
/*!
@@ -266,7 +266,7 @@ Id Id::withSuffix(const char *suffix) const
Id Id::withPrefix(const char *prefix) const
{
const QByteArray ba = prefix + name();
- return Id(ba.constData());
+ return {ba.constData()};
}
bool Id::operator==(const char *name) const
diff --git a/src/lib/corelib/tools/msvcinfo.cpp b/src/lib/corelib/tools/msvcinfo.cpp
index 313cf802c..f51ba8ba2 100644
--- a/src/lib/corelib/tools/msvcinfo.cpp
+++ b/src/lib/corelib/tools/msvcinfo.cpp
@@ -192,7 +192,7 @@ static QVariantMap getMsvcDefines(const QString &compilerFilePath,
Q_UNUSED(compilerFilePath);
Q_UNUSED(compilerEnv);
Q_UNUSED(language);
- return QVariantMap();
+ return {};
#endif
}
diff --git a/src/lib/corelib/tools/processutils.cpp b/src/lib/corelib/tools/processutils.cpp
index 58a082fa5..060a0577e 100644
--- a/src/lib/corelib/tools/processutils.cpp
+++ b/src/lib/corelib/tools/processutils.cpp
@@ -69,12 +69,12 @@ QString processNameByPid(qint64 pid)
#if defined(Q_OS_WIN)
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, DWORD(pid));
if (!hProcess)
- return QString();
+ return {};
wchar_t buf[UNICODE_STRING_MAX_CHARS];
const DWORD length = GetModuleFileNameEx(hProcess, NULL, buf, sizeof(buf) / sizeof(wchar_t));
CloseHandle(hProcess);
if (!length)
- return QString();
+ return {};
QString name = QString::fromWCharArray(buf, length);
int i = name.lastIndexOf(QLatin1Char('\\'));
if (i >= 0)
@@ -109,22 +109,22 @@ QString processNameByPid(qint64 pid)
u_int mib_len = sizeof(mib)/sizeof(u_int);
if (sysctl(mib, mib_len, &kp, &len, NULL, 0) < 0)
- return QString();
+ return {};
# if defined(Q_OS_OPENBSD) || defined(Q_OS_NETBSD)
if (kp.p_pid != pid)
- return QString();
+ return {};
QString name = QFile::decodeName(kp.p_comm);
# else
if (kp.ki_pid != pid)
- return QString();
+ return {};
QString name = QFile::decodeName(kp.ki_comm);
# endif
return name;
#else
Q_UNUSED(pid);
- return QString();
+ return {};
#endif
}
diff --git a/src/lib/corelib/tools/profile.cpp b/src/lib/corelib/tools/profile.cpp
index 3ace77d4d..7e594fd2d 100644
--- a/src/lib/corelib/tools/profile.cpp
+++ b/src/lib/corelib/tools/profile.cpp
@@ -88,7 +88,7 @@ QVariant Profile::value(const QString &key, const QVariant &defaultValue, ErrorI
} catch (const ErrorInfo &e) {
if (error)
*error = e;
- return QVariant();
+ return {};
}
}
@@ -132,7 +132,7 @@ QStringList Profile::allKeys(KeySelection selection, ErrorInfo *error) const
} catch (const ErrorInfo &e) {
if (error)
*error = e;
- return QStringList();
+ return {};
}
}
diff --git a/src/lib/corelib/tools/scannerpluginmanager.cpp b/src/lib/corelib/tools/scannerpluginmanager.cpp
index e4f39b26f..d6b564832 100644
--- a/src/lib/corelib/tools/scannerpluginmanager.cpp
+++ b/src/lib/corelib/tools/scannerpluginmanager.cpp
@@ -71,7 +71,7 @@ std::vector<ScannerPlugin *> ScannerPluginManager::scannersForFileTag(const File
auto it = instance()->d->scannerPlugins.find(fileTag);
if (it != instance()->d->scannerPlugins.cend())
return it->second;
- return { };
+ return {};
}
void ScannerPluginManager::registerPlugins(ScannerPlugin **plugins)
diff --git a/src/lib/corelib/tools/settings.cpp b/src/lib/corelib/tools/settings.cpp
index 3b3d173f8..f2902aed4 100644
--- a/src/lib/corelib/tools/settings.cpp
+++ b/src/lib/corelib/tools/settings.cpp
@@ -69,7 +69,7 @@ static QString defaultSystemSettingsBaseDir()
case HostOsInfo::HostOsOtherUnix:
return QStringLiteral("/etc/xdg");
default:
- return QString();
+ return {};
}
}
diff --git a/src/lib/corelib/tools/settings.h b/src/lib/corelib/tools/settings.h
index d0676a072..2748e6890 100644
--- a/src/lib/corelib/tools/settings.h
+++ b/src/lib/corelib/tools/settings.h
@@ -63,7 +63,7 @@ public:
enum Scope { UserScope = 0x1, SystemScope = 0x2 };
Q_DECLARE_FLAGS(Scopes, Scope)
- static Scopes allScopes() { return Scopes{UserScope, SystemScope}; }
+ static Scopes allScopes() { return {UserScope, SystemScope}; }
QVariant value(const QString &key, Scopes scopes,
const QVariant &defaultValue = QVariant()) const;
diff --git a/src/lib/corelib/tools/settingsmodel.cpp b/src/lib/corelib/tools/settingsmodel.cpp
index bbfa71ead..4a90773eb 100644
--- a/src/lib/corelib/tools/settingsmodel.cpp
+++ b/src/lib/corelib/tools/settingsmodel.cpp
@@ -207,7 +207,7 @@ void SettingsModel::setAdditionalProperties(const QVariantMap &properties)
Qt::ItemFlags SettingsModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
- return Qt::ItemFlags();
+ return Qt::NoItemFlags;
const Qt::ItemFlags flags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
if (index.column() == keyColumn()) {
if (d->editable)
@@ -217,25 +217,25 @@ Qt::ItemFlags SettingsModel::flags(const QModelIndex &index) const
if (index.column() == valueColumn()) {
const Node * const node = d->indexToNode(index);
if (!node)
- return Qt::ItemFlags();
+ return Qt::NoItemFlags;
// Only leaf nodes have values.
return d->editable && node->children.empty() ? flags | Qt::ItemIsEditable : flags;
}
- return Qt::ItemFlags();
+ return {};
}
QVariant SettingsModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation != Qt::Horizontal)
- return QVariant();
+ return {};
if (role != Qt::DisplayRole)
- return QVariant();
+ return {};
if (section == keyColumn())
return tr("Key");
if (section == valueColumn())
return tr("Value");
- return QVariant();
+ return {};
}
int SettingsModel::columnCount(const QModelIndex &parent) const
@@ -256,22 +256,22 @@ int SettingsModel::rowCount(const QModelIndex &parent) const
QVariant SettingsModel::data(const QModelIndex &index, int role) const
{
if (role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::ForegroundRole)
- return QVariant();
+ return {};
const Node * const node = d->indexToNode(index);
if (!node)
- return QVariant();
+ return {};
if (role == Qt::ForegroundRole) {
#ifdef QT_GUI_LIB
if (index.column() == valueColumn() && !node->isFromSettings)
return QBrush(Qt::red);
#endif
- return QVariant();
+ return {};
}
if (index.column() == keyColumn())
return node->name;
if (index.column() == valueColumn() && node->children.empty())
return node->value;
- return QVariant();
+ return {};
}
bool SettingsModel::setData(const QModelIndex &index, const QVariant &value, int role)
@@ -306,7 +306,7 @@ QModelIndex SettingsModel::index(int row, int column, const QModelIndex &parent)
const Node * const parentNode = d->indexToNode(parent);
Q_ASSERT(parentNode);
if (parentNode->children.size() <= row)
- return QModelIndex();
+ return {};
return createIndex(row, column, parentNode->children.at(row));
}
@@ -316,7 +316,7 @@ QModelIndex SettingsModel::parent(const QModelIndex &child) const
Q_ASSERT(childNode);
Node * const parentNode = childNode->parent;
if (parentNode == &d->rootNode)
- return QModelIndex();
+ return {};
const Node * const grandParentNode = parentNode->parent;
Q_ASSERT(grandParentNode);
return createIndex(grandParentNode->children.indexOf(parentNode), 0, parentNode);
diff --git a/src/lib/corelib/tools/setupprojectparameters.cpp b/src/lib/corelib/tools/setupprojectparameters.cpp
index 4d3271f98..6b13570d7 100644
--- a/src/lib/corelib/tools/setupprojectparameters.cpp
+++ b/src/lib/corelib/tools/setupprojectparameters.cpp
@@ -378,7 +378,7 @@ QVariantMap SetupProjectParameters::expandedBuildConfiguration(const Profile &pr
} catch (const ErrorInfo &err) {
if (errorInfo)
*errorInfo = err;
- return QVariantMap();
+ return {};
}
}
diff --git a/src/lib/corelib/tools/shellutils.cpp b/src/lib/corelib/tools/shellutils.cpp
index 233d2ef34..01c177cce 100644
--- a/src/lib/corelib/tools/shellutils.cpp
+++ b/src/lib/corelib/tools/shellutils.cpp
@@ -58,7 +58,7 @@ QString shellInterpreter(const QString &filePath) {
}
}
- return QString();
+ return {};
}
// isSpecialChar, hasSpecialChars, shellQuoteUnix, shellQuoteWin:
diff --git a/src/lib/corelib/tools/version.cpp b/src/lib/corelib/tools/version.cpp
index 264c44c29..ccc9dd799 100644
--- a/src/lib/corelib/tools/version.cpp
+++ b/src/lib/corelib/tools/version.cpp
@@ -97,12 +97,12 @@ Version Version::fromString(const QString &versionString, bool buildNumberAllowe
pattern += QStringLiteral("(?:-(\\d+))?"); // And possibly a dash followed by the build number.
QRegExp rex(pattern);
if (!rex.exactMatch(versionString))
- return Version();
+ return Version{};
const int majorNr = rex.cap(1).toInt();
const int minorNr = rex.captureCount() >= 2 ? rex.cap(2).toInt() : 0;
const int patchNr = rex.captureCount() >= 3 ? rex.cap(3).toInt() : 0;
const int buildNr = rex.captureCount() >= 4 ? rex.cap(4).toInt() : 0;
- return Version(majorNr, minorNr, patchNr, buildNr);
+ return Version{majorNr, minorNr, patchNr, buildNr};
}
QString Version::toString() const
diff --git a/src/lib/corelib/tools/vsenvironmentdetector.cpp b/src/lib/corelib/tools/vsenvironmentdetector.cpp
index 08a9cb1e6..b91a8ff74 100644
--- a/src/lib/corelib/tools/vsenvironmentdetector.cpp
+++ b/src/lib/corelib/tools/vsenvironmentdetector.cpp
@@ -66,7 +66,7 @@ static QString windowsSystem32Path()
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_SYSTEM, NULL, 0, str)))
return QString::fromUtf16(reinterpret_cast<ushort*>(str));
#endif
- return QString();
+ return {};
}
VsEnvironmentDetector::VsEnvironmentDetector()
@@ -114,7 +114,7 @@ QString VsEnvironmentDetector::findVcVarsAllBat(const MSVC &msvc,
QDir dir(msvc.vcInstallPath);
for (;;) {
if (!dir.cdUp())
- return QString();
+ return {};
if (dir.dirName() == QLatin1String("VC"))
break;
}
@@ -131,7 +131,7 @@ QString VsEnvironmentDetector::findVcVarsAllBat(const MSVC &msvc,
return fullPath;
else
searchedPaths.push_back(fullPath);
- return QString();
+ return {};
}
bool VsEnvironmentDetector::startDetection(const std::vector<MSVC *> &compatibleMSVCs)
diff --git a/src/plugins/generator/visualstudio/msbuildfiltersproject.cpp b/src/plugins/generator/visualstudio/msbuildfiltersproject.cpp
index 98ada0e01..7d633ca44 100644
--- a/src/plugins/generator/visualstudio/msbuildfiltersproject.cpp
+++ b/src/plugins/generator/visualstudio/msbuildfiltersproject.cpp
@@ -49,28 +49,16 @@ namespace {
static QStringList sourceFileExtensions()
{
- return QStringList()
- << QStringLiteral("c")
- << QStringLiteral("C")
- << QStringLiteral("cpp")
- << QStringLiteral("cxx")
- << QStringLiteral("c++")
- << QStringLiteral("cc")
- << QStringLiteral("cs")
- << QStringLiteral("def")
- << QStringLiteral("java")
- << QStringLiteral("m")
- << QStringLiteral("mm");
+ return {QStringLiteral("c"), QStringLiteral("C"), QStringLiteral("cpp"),
+ QStringLiteral("cxx"), QStringLiteral("c++"), QStringLiteral("cc"),
+ QStringLiteral("cs"), QStringLiteral("def"), QStringLiteral("java"),
+ QStringLiteral("m"), QStringLiteral("mm")};
}
static QStringList headerFileExtensions()
{
- return QStringList()
- << QStringLiteral("h")
- << QStringLiteral("H")
- << QStringLiteral("hpp")
- << QStringLiteral("hxx")
- << QStringLiteral("h++");
+ return {QStringLiteral("h"), QStringLiteral("H"), QStringLiteral("hpp"),
+ QStringLiteral("hxx"), QStringLiteral("h++")};
}
static std::vector<MSBuildFilter *> defaultItemGroupFilters(IMSBuildItemGroup *parent = nullptr)
diff --git a/src/plugins/generator/visualstudio/msbuildtargetproject.cpp b/src/plugins/generator/visualstudio/msbuildtargetproject.cpp
index 8e3eb4e5a..08315cc08 100644
--- a/src/plugins/generator/visualstudio/msbuildtargetproject.cpp
+++ b/src/plugins/generator/visualstudio/msbuildtargetproject.cpp
@@ -94,7 +94,7 @@ const Internal::VisualStudioVersionInfo &MSBuildTargetProject::versionInfo() con
QUuid MSBuildTargetProject::guid() const
{
- return QUuid(d->projectGuidProperty->value().toString());
+ return {d->projectGuidProperty->value().toString()};
}
void MSBuildTargetProject::setGuid(const QUuid &guid)
diff --git a/src/shared/json/json.cpp b/src/shared/json/json.cpp
index 17c87a8e3..82b7467c8 100644
--- a/src/shared/json/json.cpp
+++ b/src/shared/json/json.cpp
@@ -406,7 +406,7 @@ public:
String shallowKey() const
{
- return String((const char *)this + sizeof(Entry));
+ return {(const char *)this + sizeof(Entry)};
}
std::string key() const
@@ -1032,7 +1032,7 @@ JsonObject JsonValue::toObject(const JsonObject &defaultValue) const
*/
JsonObject JsonValue::toObject() const
{
- return toObject(JsonObject());
+ return toObject({});
}
/*!
@@ -1384,9 +1384,9 @@ bool JsonArray::isEmpty() const
JsonValue JsonArray::at(int i) const
{
if (!a || i < 0 || i >= (int)a->length)
- return JsonValue(JsonValue::Undefined);
+ return {JsonValue::Undefined};
- return JsonValue(d, a, a->at(i));
+ return {d, a, a->at(i)};
}
/*!
@@ -1484,7 +1484,7 @@ void JsonArray::removeAt(int i)
JsonValue JsonArray::takeAt(int i)
{
if (!a || i < 0 || i >= (int)a->length)
- return JsonValue(JsonValue::Undefined);
+ return {JsonValue::Undefined};
JsonValue v(d, a, a->at(i));
removeAt(i); // detaches
@@ -1606,7 +1606,7 @@ bool JsonArray::contains(const JsonValue &value) const
JsonValueRef JsonArray::operator[](int i)
{
// assert(a && i >= 0 && i < (int)a->length);
- return JsonValueRef(this, i);
+ return {this, i};
}
/*!
@@ -2415,13 +2415,13 @@ bool JsonObject::isEmpty() const
JsonValue JsonObject::value(const std::string &key) const
{
if (!d)
- return JsonValue(JsonValue::Undefined);
+ return {JsonValue::Undefined};
bool keyExists;
int i = o->indexOf(key, &keyExists);
if (!keyExists)
- return JsonValue(JsonValue::Undefined);
- return JsonValue(d, o, o->entryAt(i)->value);
+ return {JsonValue::Undefined};
+ return {d, o, o->entryAt(i)->value};
}
/*!
@@ -2458,7 +2458,7 @@ JsonValueRef JsonObject::operator[](const std::string &key)
iterator i = insert(key, JsonValue());
index = i.i;
}
- return JsonValueRef(this, index);
+ return {this, index};
}
/*!
@@ -2514,7 +2514,7 @@ JsonObject::iterator JsonObject::insert(const std::string &key, const JsonValue
if (d->compactionCounter > 32u && d->compactionCounter >= unsigned(o->length) / 2u)
compact();
- return iterator(this, pos);
+ return {this, pos};
}
/*!
@@ -2551,12 +2551,12 @@ void JsonObject::remove(const std::string &key)
JsonValue JsonObject::take(const std::string &key)
{
if (!o)
- return JsonValue(JsonValue::Undefined);
+ return {JsonValue::Undefined};
bool keyExists;
int index = o->indexOf(key, &keyExists);
if (!keyExists)
- return JsonValue(JsonValue::Undefined);
+ return {JsonValue::Undefined};
JsonValue v(d, o, o->entryAt(index)->value);
detach();
@@ -2627,7 +2627,7 @@ JsonObject::iterator JsonObject::erase(JsonObject::iterator it)
{
// assert(d && d->ref.load() == 1);
if (it.o != this || it.i < 0 || it.i >= (int)o->length)
- return iterator(this, o->length);
+ return {this, int(o->length)};
int index = it.i;
@@ -2654,7 +2654,7 @@ JsonObject::iterator JsonObject::find(const std::string &key)
if (!keyExists)
return end();
detach();
- return iterator(this, index);
+ return {this, index};
}
/*! \fn JsonObject::const_iterator JsonObject::find(const QString &key) const
@@ -2675,7 +2675,7 @@ JsonObject::const_iterator JsonObject::constFind(const std::string &key) const
int index = o ? o->indexOf(key, &keyExists) : 0;
if (!keyExists)
return end();
- return const_iterator(this, index);
+ return {this, index};
}
/*! \fn int JsonObject::count() const
@@ -3191,10 +3191,10 @@ std::string JsonObject::keyAt(int i) const
JsonValue JsonObject::valueAt(int i) const
{
if (!o || i < 0 || i >= (int)o->length)
- return JsonValue(JsonValue::Undefined);
+ return {JsonValue::Undefined};
Internal::Entry *e = o->entryAt(i);
- return JsonValue(d, o, e->value);
+ return {d, o, e->value};
}
/*!
@@ -3344,7 +3344,7 @@ JsonDocument JsonDocument::fromRawData(const char *data, int size, DataValidatio
{
if (std::uintptr_t(data) & 3) {
std::cerr <<"JsonDocument::fromRawData: data has to have 4 byte alignment\n";
- return JsonDocument();
+ return {};
}
const auto d = new Internal::Data((char *)data, size);
@@ -3352,10 +3352,10 @@ JsonDocument JsonDocument::fromRawData(const char *data, int size, DataValidatio
if (validation != BypassValidation && !d->valid()) {
delete d;
- return JsonDocument();
+ return {};
}
- return JsonDocument(d);
+ return {d};
}
/*!
@@ -3387,7 +3387,7 @@ const char *JsonDocument::rawData(int *size) const
JsonDocument JsonDocument::fromBinaryData(const std::string &data, DataValidation validation)
{
if (data.size() < (int)(sizeof(Internal::Header) + sizeof(Internal::Base)))
- return JsonDocument();
+ return {};
Internal::Header h;
memcpy(&h, data.data(), sizeof(Internal::Header));
@@ -3397,22 +3397,22 @@ JsonDocument JsonDocument::fromBinaryData(const std::string &data, DataValidatio
// do basic checks here, so we don't try to allocate more memory than we can.
if (h.tag != JsonDocument::BinaryFormatTag || h.version != 1u ||
sizeof(Internal::Header) + root.size > (uint32_t)data.size())
- return JsonDocument();
+ return {};
const uint32_t size = sizeof(Internal::Header) + root.size;
char *raw = (char *)malloc(size);
if (!raw)
- return JsonDocument();
+ return {};
memcpy(raw, data.data(), size);
const auto d = new Internal::Data(raw, size);
if (validation != BypassValidation && !d->valid()) {
delete d;
- return JsonDocument();
+ return {};
}
- return JsonDocument(d);
+ return {d};
}
/*!
@@ -3554,7 +3554,7 @@ JsonObject JsonDocument::object() const
if (b->isObject())
return JsonObject(d, static_cast<Internal::Object *>(b));
}
- return JsonObject();
+ return {};
}
/*!
@@ -3572,7 +3572,7 @@ JsonArray JsonDocument::array() const
if (b->isArray())
return JsonArray(d, static_cast<Internal::Array *>(b));
}
- return JsonArray();
+ return {};
}
/*!
@@ -4047,7 +4047,7 @@ JsonDocument Parser::parse(JsonParseError *error)
error->error = JsonParseError::NoError;
}
const auto d = new Data(data, current);
- return JsonDocument(d);
+ return {d};
}
error:
@@ -4059,7 +4059,7 @@ error:
error->error = lastError;
}
free(data);
- return JsonDocument();
+ return {};
}