aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/api
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2017-11-19 17:34:27 +0300
committerJake Petroules <jake.petroules@qt.io>2017-11-30 06:08:50 +0000
commit4f6ec935e3abe5c918c320501a75786cce5d2ed0 (patch)
treeab22024081f6e4d693ad988efa136eefe4410c41 /src/lib/corelib/api
parenta3c85aa9f267c156cd9b71a389eb4efe460439c8 (diff)
Modernize variable declarations
Use 'const' and 'auto' keywords more where static_cast is used. Change-Id: I60152b90fe5e44aa1ca513b43f133e604ed6417f Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src/lib/corelib/api')
-rw-r--r--src/lib/corelib/api/jobs.cpp2
-rw-r--r--src/lib/corelib/api/projectfileupdater.cpp26
2 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/corelib/api/jobs.cpp b/src/lib/corelib/api/jobs.cpp
index 85c0d2399..82c10e1a6 100644
--- a/src/lib/corelib/api/jobs.cpp
+++ b/src/lib/corelib/api/jobs.cpp
@@ -308,7 +308,7 @@ BuildJob::BuildJob(const Logger &logger, QObject *parent)
{
connect(&LauncherInterface::instance(), &LauncherInterface::errorOccurred,
this, &BuildJob::handleLauncherError);
- InternalBuildJob *job = static_cast<InternalBuildJob *>(internalJob());
+ auto job = static_cast<InternalBuildJob *>(internalJob());
connect(job, &BuildGraphTouchingJob::reportCommandDescription,
this, &BuildJob::reportCommandDescription);
connect(job, &BuildGraphTouchingJob::reportProcessResult,
diff --git a/src/lib/corelib/api/projectfileupdater.cpp b/src/lib/corelib/api/projectfileupdater.cpp
index 8d5a704eb..836aa6abe 100644
--- a/src/lib/corelib/api/projectfileupdater.cpp
+++ b/src/lib/corelib/api/projectfileupdater.cpp
@@ -333,12 +333,12 @@ void ProjectFileFilesAdder::doApply(QString &fileContent, UiProgram *ast)
QString filesRepresentation;
if (filesBinding->statement->kind != QbsQmlJS::AST::Node::Kind_ExpressionStatement)
throw ErrorInfo(Tr::tr("JavaScript construct in source file is too complex.")); // TODO: rename, add new and concat.
- const ExpressionStatement * const exprStatement
- = static_cast<ExpressionStatement *>(filesBinding->statement);
+ const auto exprStatement
+ = static_cast<const ExpressionStatement *>(filesBinding->statement);
switch (exprStatement->expression->kind) {
case QbsQmlJS::AST::Node::Kind_ArrayLiteral: {
- const ElementList *elem
- = static_cast<ArrayLiteral *>(exprStatement->expression)->elements;
+ const auto elem
+ = static_cast<const ArrayLiteral *>(exprStatement->expression)->elements;
QStringList oldFileReprs;
while (elem) {
oldFileReprs << getNodeRepresentation(fileContent, elem->expression);
@@ -359,8 +359,8 @@ void ProjectFileFilesAdder::doApply(QString &fileContent, UiProgram *ast)
break;
}
case QbsQmlJS::AST::Node::Kind_StringLiteral: {
- const QString existingElement
- = static_cast<StringLiteral *>(exprStatement->expression)->value.toString();
+ const auto existingElement
+ = static_cast<const StringLiteral *>(exprStatement->expression)->value.toString();
sortedFiles << existingElement;
sortedFiles.sort();
addToFilesRepr(filesRepresentation, sortedFiles, arrayElemIndentation);
@@ -447,20 +447,20 @@ void ProjectFileFilesRemover::doApply(QString &fileContent, UiProgram *ast)
const int bindingIndentation = itemIndentation + 4;
const int arrayElemIndentation = bindingIndentation + 4;
- const ExpressionStatement * const exprStatement
- = static_cast<ExpressionStatement *>(bindingFinder.binding()->statement);
+ const auto exprStatement
+ = static_cast<const ExpressionStatement *>(bindingFinder.binding()->statement);
switch (exprStatement->expression->kind) {
case QbsQmlJS::AST::Node::Kind_ArrayLiteral: {
QStringList filesToRemove = m_files;
QStringList newFilesList;
- const ElementList *elem = static_cast<ArrayLiteral *>(exprStatement->expression)->elements;
+ const auto elem = static_cast<const ArrayLiteral *>(exprStatement->expression)->elements;
while (elem) {
if (elem->expression->kind != QbsQmlJS::AST::Node::Kind_StringLiteral) {
throw ErrorInfo(Tr::tr("JavaScript construct in source file is too complex."),
bindingLocation);
}
- const QString existingFile
- = static_cast<StringLiteral *>(elem->expression)->value.toString();
+ const auto existingFile
+ = static_cast<const StringLiteral *>(elem->expression)->value.toString();
if (!filesToRemove.removeOne(existingFile))
newFilesList << existingFile;
elem = elem->next;
@@ -485,8 +485,8 @@ void ProjectFileFilesRemover::doApply(QString &fileContent, UiProgram *ast)
throw ErrorInfo(Tr::tr("Was requested to remove %1 files, but there is only "
"one in the list.").arg(m_files.size()), bindingLocation);
}
- const QString existingFile
- = static_cast<StringLiteral *>(exprStatement->expression)->value.toString();
+ const auto existingFile
+ = static_cast<const StringLiteral *>(exprStatement->expression)->value.toString();
if (existingFile != m_files.front()) {
throw ErrorInfo(Tr::tr("File '%1' could not be found in the 'files' list.")
.arg(m_files.front()), bindingLocation);