aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/qbs
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/app/qbs
parent0b8f0b771080e51a59664782ced6b3a1cc5111ca (diff)
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/app/qbs')
-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
3 files changed, 74 insertions, 83 deletions
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)