From 7494bf59c28570dcc6ed6019f979e5625956c8af Mon Sep 17 00:00:00 2001 From: Denis Shienkov Date: Sat, 18 Nov 2017 19:07:25 +0300 Subject: Use nullptr to initialize the pointers Change-Id: I59d743f585410cb5c00d36a7b6f9a3e9d696d19e Reviewed-by: Oswald Buddenhagen Reviewed-by: Christian Kandeler --- src/lib/corelib/api/changeset.cpp | 12 ++--- src/lib/corelib/api/internaljobs.cpp | 8 ++-- src/lib/corelib/api/internaljobs.h | 10 ++--- src/lib/corelib/api/projectfileupdater.cpp | 4 +- src/lib/corelib/api/qmljsrewriter.cpp | 32 ++++++------- .../corelib/buildgraph/abstractcommandexecutor.cpp | 6 +-- .../corelib/buildgraph/abstractcommandexecutor.h | 2 +- src/lib/corelib/buildgraph/buildgraph.cpp | 2 +- src/lib/corelib/buildgraph/cycledetector.cpp | 2 +- src/lib/corelib/buildgraph/depscanner.cpp | 4 +- src/lib/corelib/buildgraph/executor.cpp | 4 +- src/lib/corelib/buildgraph/executor.h | 2 +- src/lib/corelib/buildgraph/executorjob.cpp | 4 +- .../corelib/buildgraph/inputartifactscanner.cpp | 6 +-- src/lib/corelib/buildgraph/jscommandexecutor.cpp | 2 +- src/lib/corelib/buildgraph/jscommandexecutor.h | 2 +- src/lib/corelib/buildgraph/nodeset.cpp | 2 +- .../corelib/buildgraph/processcommandexecutor.h | 2 +- src/lib/corelib/buildgraph/qtmocscanner.cpp | 6 +-- src/lib/corelib/buildgraph/rulesapplicator.cpp | 4 +- .../corelib/buildgraph/rulesevaluationcontext.cpp | 2 +- src/lib/corelib/jsextensions/domxml.cpp | 2 +- src/lib/corelib/jsextensions/moduleproperties.cpp | 2 +- src/lib/corelib/jsextensions/process.cpp | 4 +- src/lib/corelib/jsextensions/textfile.cpp | 6 +-- src/lib/corelib/language/evaluatorscriptclass.cpp | 4 +- src/lib/corelib/language/evaluatorscriptclass.h | 2 +- src/lib/corelib/language/filecontext.cpp | 2 +- src/lib/corelib/language/item.cpp | 12 ++--- src/lib/corelib/language/item.h | 2 +- .../corelib/language/itemreadervisitorstate.cpp | 2 +- src/lib/corelib/language/language.cpp | 4 +- src/lib/corelib/language/loader.cpp | 2 +- src/lib/corelib/language/moduleloader.cpp | 14 +++--- src/lib/corelib/language/moduleloader.h | 4 +- src/lib/corelib/language/modulemerger.cpp | 2 +- src/lib/corelib/language/projectresolver.cpp | 6 +-- src/lib/corelib/language/scriptengine.h | 2 +- src/lib/corelib/language/value.cpp | 2 +- src/lib/corelib/parser/qmlerror.cpp | 10 ++--- src/lib/corelib/parser/qmljsast.cpp | 8 ++-- src/lib/corelib/parser/qmljsast_p.h | 50 ++++++++++----------- src/lib/corelib/parser/qmljsengine_p.cpp | 2 +- src/lib/corelib/parser/qmljslexer.cpp | 12 ++--- src/lib/corelib/parser/qmljsmemorypool_p.h | 10 ++--- src/lib/corelib/parser/qmljsparser.cpp | 52 +++++++++++----------- src/lib/corelib/parser/qmljsparser_p.h | 6 +-- src/lib/corelib/tools/id.cpp | 2 +- src/lib/corelib/tools/persistence.cpp | 2 +- src/lib/corelib/tools/persistence.h | 4 +- src/lib/corelib/tools/profiling.cpp | 4 +- src/lib/corelib/tools/qbsprocess.h | 2 +- src/lib/corelib/tools/scannerpluginmanager.cpp | 2 +- src/lib/corelib/tools/settingsmodel.cpp | 6 +-- src/lib/corelib/tools/settingsmodel.h | 2 +- src/lib/corelib/tools/vsenvironmentdetector.cpp | 2 +- 56 files changed, 184 insertions(+), 184 deletions(-) (limited to 'src/lib/corelib') diff --git a/src/lib/corelib/api/changeset.cpp b/src/lib/corelib/api/changeset.cpp index f5d60df80..699270b39 100644 --- a/src/lib/corelib/api/changeset.cpp +++ b/src/lib/corelib/api/changeset.cpp @@ -44,12 +44,12 @@ namespace QbsQmlJS { ChangeSet::ChangeSet() - : m_string(0), m_cursor(0), m_error(false) + : m_string(nullptr), m_cursor(nullptr), m_error(false) { } ChangeSet::ChangeSet(const QList &operations) - : m_string(0), m_cursor(0), m_operationList(operations), m_error(false) + : m_string(nullptr), m_cursor(nullptr), m_operationList(operations), m_error(false) { } @@ -130,8 +130,8 @@ QList ChangeSet::operationList() const void ChangeSet::clear() { - m_string = 0; - m_cursor = 0; + m_string = nullptr; + m_cursor = nullptr; m_operationList.clear(); m_error = false; } @@ -345,14 +345,14 @@ void ChangeSet::apply(QString *s) { m_string = s; apply_helper(); - m_string = 0; + m_string = nullptr; } void ChangeSet::apply(QTextCursor *textCursor) { m_cursor = textCursor; apply_helper(); - m_cursor = 0; + m_cursor = nullptr; } QString ChangeSet::textAt(int pos, int length) diff --git a/src/lib/corelib/api/internaljobs.cpp b/src/lib/corelib/api/internaljobs.cpp index 61acab258..2a2731331 100644 --- a/src/lib/corelib/api/internaljobs.cpp +++ b/src/lib/corelib/api/internaljobs.cpp @@ -70,7 +70,7 @@ namespace Internal { class JobObserver : public ProgressObserver { public: - JobObserver(InternalJob *job) : m_canceled(false), m_job(job), m_timedLogger(0) { } + JobObserver(InternalJob *job) : m_canceled(false), m_job(job), m_timedLogger(nullptr) { } ~JobObserver() { delete m_timedLogger; } void cancel() @@ -103,7 +103,7 @@ private: m_value = value; if (value == m_maximum) { delete m_timedLogger; - m_timedLogger = 0; + m_timedLogger = nullptr; } emit m_job->taskProgress(value, m_job); } @@ -266,7 +266,7 @@ void InternalSetupProjectJob::start() } execute(); if (m_existingProject) - m_existingProject->bgLocker = 0; + m_existingProject->bgLocker = nullptr; m_newProject->bgLocker = bgLocker; deleteLocker = false; } catch (const ErrorInfo &error) { @@ -362,7 +362,7 @@ void BuildGraphTouchingJob::storeBuildGraph() } InternalBuildJob::InternalBuildJob(const Logger &logger, QObject *parent) - : BuildGraphTouchingJob(logger, parent), m_executor(0) + : BuildGraphTouchingJob(logger, parent), m_executor(nullptr) { } diff --git a/src/lib/corelib/api/internaljobs.h b/src/lib/corelib/api/internaljobs.h index f0260cc98..4ed6bf1f4 100644 --- a/src/lib/corelib/api/internaljobs.h +++ b/src/lib/corelib/api/internaljobs.h @@ -80,7 +80,7 @@ public: void shareObserverWith(InternalJob *otherJob); protected: - explicit InternalJob(const Logger &logger, QObject *parent = 0); + explicit InternalJob(const Logger &logger, QObject *parent = nullptr); JobObserver *observer() const { return m_observer; } void setTimed(bool timed) { m_timed = timed; } @@ -105,7 +105,7 @@ class InternalJobThreadWrapper : public InternalJob { Q_OBJECT public: - InternalJobThreadWrapper(InternalJob *synchronousJob, QObject *parent = 0); + InternalJobThreadWrapper(InternalJob *synchronousJob, QObject *parent = nullptr); ~InternalJobThreadWrapper(); void start() override; @@ -159,7 +159,7 @@ signals: void reportProcessResult(const qbs::ProcessResult &result); protected: - BuildGraphTouchingJob(const Logger &logger, QObject *parent = 0); + BuildGraphTouchingJob(const Logger &logger, QObject *parent = nullptr); ~BuildGraphTouchingJob(); void setup(const TopLevelProjectPtr &project, const QList &products, @@ -177,7 +177,7 @@ class InternalBuildJob : public BuildGraphTouchingJob { Q_OBJECT public: - InternalBuildJob(const Logger &logger, QObject *parent = 0); + InternalBuildJob(const Logger &logger, QObject *parent = nullptr); void build(const TopLevelProjectPtr &project, const QList &products, const BuildOptions &buildOptions); @@ -194,7 +194,7 @@ class InternalCleanJob : public BuildGraphTouchingJob { Q_OBJECT public: - InternalCleanJob(const Logger &logger, QObject *parent = 0); + InternalCleanJob(const Logger &logger, QObject *parent = nullptr); void init(const TopLevelProjectPtr &project, const QList &products, const CleanOptions &options); diff --git a/src/lib/corelib/api/projectfileupdater.cpp b/src/lib/corelib/api/projectfileupdater.cpp index 37dfb7688..648235731 100644 --- a/src/lib/corelib/api/projectfileupdater.cpp +++ b/src/lib/corelib/api/projectfileupdater.cpp @@ -65,7 +65,7 @@ namespace Internal { class ItemFinder : public Visitor { public: - ItemFinder(const CodeLocation &cl) : m_cl(cl), m_item(0) { } + ItemFinder(const CodeLocation &cl) : m_cl(cl), m_item(nullptr) { } UiObjectDefinition *item() const { return m_item; } @@ -87,7 +87,7 @@ class FilesBindingFinder : public Visitor { public: FilesBindingFinder(const UiObjectDefinition *startItem) - : m_startItem(startItem), m_binding(0) + : m_startItem(startItem), m_binding(nullptr) { } diff --git a/src/lib/corelib/api/qmljsrewriter.cpp b/src/lib/corelib/api/qmljsrewriter.cpp index 8d8d071a9..ebcc00b07 100644 --- a/src/lib/corelib/api/qmljsrewriter.cpp +++ b/src/lib/corelib/api/qmljsrewriter.cpp @@ -93,7 +93,7 @@ Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast, SourceLocation endOfPreviousMember; SourceLocation startOfNextMember; - if (insertAfter == 0 || insertAfter->member == 0) { + if (insertAfter == nullptr || insertAfter->member == nullptr) { // insert as first member endOfPreviousMember = ast->lbraceToken; @@ -114,7 +114,7 @@ Rewriter::Range Rewriter::addBinding(AST::UiObjectInitializer *ast, bool needsTrailingSemicolon = false; if (isOneLiner) { - if (insertAfter == 0) { // we're inserting after an lbrace + if (insertAfter == nullptr) { // we're inserting after an lbrace if (ast->members) { // we're inserting before a member (and not the rbrace) needsTrailingSemicolon = bindingType == ScriptBinding; } @@ -168,8 +168,8 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb { const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString()); - UiObjectMemberList *lastObjectDef = 0; - UiObjectMemberList *lastNonObjectDef = 0; + UiObjectMemberList *lastObjectDef = nullptr; + UiObjectMemberList *lastNonObjectDef = nullptr; for (UiObjectMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; @@ -201,8 +201,8 @@ UiArrayMemberList *Rewriter::searchMemberToInsertAfter(UiArrayMemberList *member { const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString()); - UiArrayMemberList *lastObjectDef = 0; - UiArrayMemberList *lastNonObjectDef = 0; + UiArrayMemberList *lastObjectDef = nullptr; + UiArrayMemberList *lastNonObjectDef = nullptr; for (UiArrayMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; @@ -234,7 +234,7 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb const QStringList &propertyOrder) { if (!members) - return 0; // empty members + return nullptr; // empty members QHash orderedMembers; @@ -266,7 +266,7 @@ UiObjectMemberList *Rewriter::searchMemberToInsertAfter(UiObjectMemberList *memb return candidate; } - return 0; + return nullptr; } void Rewriter::changeBinding(UiObjectInitializer *ast, @@ -382,7 +382,7 @@ void Rewriter::insertIntoArray(UiArrayBinding *ast, const QString &newValue) if (!ast) return; - UiObjectMember *lastMember = 0; + UiObjectMember *lastMember = nullptr; for (UiArrayMemberList *iter = ast->members; iter; iter = iter->next) { lastMember = iter->member; } @@ -426,7 +426,7 @@ void Rewriter::removeGroupedProperty(UiObjectDefinition *ast, const QString propName = propertyName.mid(dotIdx + 1); - UiObjectMember *wanted = 0; + UiObjectMember *wanted = nullptr; unsigned memberCount = 0; for (UiObjectMemberList *it = ast->initializer->members; it; it = it->next) { ++memberCount; @@ -545,8 +545,8 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m { const int objectDefinitionInsertionPoint = propertyOrder.indexOf(QString::null); - UiObjectMemberList *lastObjectDef = 0; - UiObjectMemberList *lastNonObjectDef = 0; + UiObjectMemberList *lastObjectDef = nullptr; + UiObjectMemberList *lastNonObjectDef = nullptr; for (UiObjectMemberList *iter = members; iter; iter = iter->next) { UiObjectMember *member = iter->member; @@ -576,7 +576,7 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *members, const QString &propertyName, const QStringList &propertyOrder) { if (!members) - return 0; // empty members + return nullptr; // empty members QHash orderedMembers; @@ -608,7 +608,7 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m return candidate; } - return 0; + return nullptr; } #endif @@ -616,7 +616,7 @@ UiObjectMemberList *QMLRewriter::searchMemberToInsertAfter(UiObjectMemberList *m void Rewriter::appendToArrayBinding(UiArrayBinding *arrayBinding, const QString &content) { - UiObjectMember *lastMember = 0; + UiObjectMember *lastMember = nullptr; for (UiArrayMemberList *iter = arrayBinding->members; iter; iter = iter->next) if (iter->member) lastMember = iter->member; @@ -697,7 +697,7 @@ void Rewriter::extendToLeadingOrTrailingComma(UiArrayBinding *parentArray, int &start, int &end) const { - UiArrayMemberList *currentMember = 0; + UiArrayMemberList *currentMember = nullptr; for (UiArrayMemberList *it = parentArray->members; it; it = it->next) { if (it->member == member) { currentMember = it; diff --git a/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp b/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp index 1ed5f21f3..94597e6d3 100644 --- a/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp +++ b/src/lib/corelib/buildgraph/abstractcommandexecutor.cpp @@ -50,9 +50,9 @@ namespace Internal { AbstractCommandExecutor::AbstractCommandExecutor(const Logger &logger, QObject *parent) : QObject(parent) , m_echoMode(defaultCommandEchoMode()) - , m_command(0) - , m_transformer(0) - , m_mainThreadScriptEngine(0) + , m_command(nullptr) + , m_transformer(nullptr) + , m_mainThreadScriptEngine(nullptr) , m_dryRun(false) , m_logger(logger) { diff --git a/src/lib/corelib/buildgraph/abstractcommandexecutor.h b/src/lib/corelib/buildgraph/abstractcommandexecutor.h index 7ff769396..505fd8da0 100644 --- a/src/lib/corelib/buildgraph/abstractcommandexecutor.h +++ b/src/lib/corelib/buildgraph/abstractcommandexecutor.h @@ -58,7 +58,7 @@ class AbstractCommandExecutor : public QObject { Q_OBJECT public: - explicit AbstractCommandExecutor(const Internal::Logger &logger, QObject *parent = 0); + explicit AbstractCommandExecutor(const Internal::Logger &logger, QObject *parent = nullptr); void setMainThreadScriptEngine(ScriptEngine *engine) { m_mainThreadScriptEngine = engine; } void setDryRunEnabled(bool enabled) { m_dryRun = enabled; } diff --git a/src/lib/corelib/buildgraph/buildgraph.cpp b/src/lib/corelib/buildgraph/buildgraph.cpp index 7a87303b1..0baacc27d 100644 --- a/src/lib/corelib/buildgraph/buildgraph.cpp +++ b/src/lib/corelib/buildgraph/buildgraph.cpp @@ -490,7 +490,7 @@ Artifact *lookupArtifact(const ResolvedProductConstPtr &product, : artifact->product == product)) return artifact; } - return 0; + return nullptr; } Artifact *lookupArtifact(const ResolvedProductConstPtr &product, const QString &dirPath, diff --git a/src/lib/corelib/buildgraph/cycledetector.cpp b/src/lib/corelib/buildgraph/cycledetector.cpp index 13d1d85b9..95afba87d 100644 --- a/src/lib/corelib/buildgraph/cycledetector.cpp +++ b/src/lib/corelib/buildgraph/cycledetector.cpp @@ -52,7 +52,7 @@ namespace qbs { namespace Internal { CycleDetector::CycleDetector(const Logger &logger) - : m_parent(0), m_logger(logger) + : m_parent(nullptr), m_logger(logger) { } diff --git a/src/lib/corelib/buildgraph/depscanner.cpp b/src/lib/corelib/buildgraph/depscanner.cpp index 274a848d9..e0fae57c9 100644 --- a/src/lib/corelib/buildgraph/depscanner.cpp +++ b/src/lib/corelib/buildgraph/depscanner.cpp @@ -112,7 +112,7 @@ QStringList PluginDependencyScanner::collectDependencies(FileResourceBase *file, int flags = 0; int length = 0; const char *szOutFilePath = m_plugin->next(scannerHandle, &length, &flags); - if (szOutFilePath == 0) + if (szOutFilePath == nullptr) break; QString outFilePath = QString::fromLocal8Bit(szOutFilePath, length); if (outFilePath.isEmpty()) @@ -157,7 +157,7 @@ UserDependencyScanner::UserDependencyScanner(const ResolvedScannerConstPtr &scan : m_scanner(scanner), m_engine(engine), m_observer(m_engine, UnobserveMode::Enabled), - m_product(0) + m_product(nullptr) { m_global = m_engine->newObject(); m_global.setPrototype(m_engine->globalObject()); diff --git a/src/lib/corelib/buildgraph/executor.cpp b/src/lib/corelib/buildgraph/executor.cpp index b7a069096..6d5cc9f90 100644 --- a/src/lib/corelib/buildgraph/executor.cpp +++ b/src/lib/corelib/buildgraph/executor.cpp @@ -84,9 +84,9 @@ bool Executor::ComparePriority::operator() (const BuildGraphNode *x, const Build Executor::Executor(const Logger &logger, QObject *parent) : QObject(parent) - , m_productInstaller(0) + , m_productInstaller(nullptr) , m_logger(logger) - , m_progressObserver(0) + , m_progressObserver(nullptr) , m_state(ExecutorIdle) , m_cancelationTimer(new QTimer(this)) { diff --git a/src/lib/corelib/buildgraph/executor.h b/src/lib/corelib/buildgraph/executor.h index 849920aee..cdc7e2f1a 100644 --- a/src/lib/corelib/buildgraph/executor.h +++ b/src/lib/corelib/buildgraph/executor.h @@ -74,7 +74,7 @@ class Executor : public QObject, private BuildGraphVisitor public: void build(); - Executor(const Logger &logger, QObject *parent = 0); + Executor(const Logger &logger, QObject *parent = nullptr); ~Executor(); void setProject(const TopLevelProjectPtr &project); diff --git a/src/lib/corelib/buildgraph/executorjob.cpp b/src/lib/corelib/buildgraph/executorjob.cpp index 8fb767d38..0b67f2eee 100644 --- a/src/lib/corelib/buildgraph/executorjob.cpp +++ b/src/lib/corelib/buildgraph/executorjob.cpp @@ -166,8 +166,8 @@ void ExecutorJob::setFinished() void ExecutorJob::reset() { - m_transformer = 0; - m_currentCommandExecutor = 0; + m_transformer = nullptr; + m_currentCommandExecutor = nullptr; m_currentCommandIdx = -1; m_error.clear(); } diff --git a/src/lib/corelib/buildgraph/inputartifactscanner.cpp b/src/lib/corelib/buildgraph/inputartifactscanner.cpp index 78808b531..31e54486e 100644 --- a/src/lib/corelib/buildgraph/inputartifactscanner.cpp +++ b/src/lib/corelib/buildgraph/inputartifactscanner.cpp @@ -74,9 +74,9 @@ static void resolveDepencency(const RawScannedDependency &dependency, absDirPath = QDir::cleanPath(absDirPath); ResolvedProject *project = product->project.get(); - FileDependency *fileDependencyArtifact = 0; - Artifact *dependencyInProduct = 0; - Artifact *dependencyInOtherProduct = 0; + FileDependency *fileDependencyArtifact = nullptr; + Artifact *dependencyInProduct = nullptr; + Artifact *dependencyInOtherProduct = nullptr; for (FileResourceBase *lookupResult : project->topLevelProject() ->buildData->lookupFiles(absDirPath, dependency.fileName())) { if ((fileDependencyArtifact = dynamic_cast(lookupResult))) diff --git a/src/lib/corelib/buildgraph/jscommandexecutor.cpp b/src/lib/corelib/buildgraph/jscommandexecutor.cpp index be71cb6b5..974aa676d 100644 --- a/src/lib/corelib/buildgraph/jscommandexecutor.cpp +++ b/src/lib/corelib/buildgraph/jscommandexecutor.cpp @@ -73,7 +73,7 @@ class JsCommandExecutorThreadObject : public QObject public: JsCommandExecutorThreadObject(const Logger &logger) : m_logger(logger) - , m_scriptEngine(0) + , m_scriptEngine(nullptr) { } diff --git a/src/lib/corelib/buildgraph/jscommandexecutor.h b/src/lib/corelib/buildgraph/jscommandexecutor.h index 929c81fff..f70d54711 100644 --- a/src/lib/corelib/buildgraph/jscommandexecutor.h +++ b/src/lib/corelib/buildgraph/jscommandexecutor.h @@ -55,7 +55,7 @@ class JsCommandExecutor : public AbstractCommandExecutor { Q_OBJECT public: - explicit JsCommandExecutor(const Logger &logger, QObject *parent = 0); + explicit JsCommandExecutor(const Logger &logger, QObject *parent = nullptr); ~JsCommandExecutor(); signals: diff --git a/src/lib/corelib/buildgraph/nodeset.cpp b/src/lib/corelib/buildgraph/nodeset.cpp index d8b662e48..b9ef222eb 100644 --- a/src/lib/corelib/buildgraph/nodeset.cpp +++ b/src/lib/corelib/buildgraph/nodeset.cpp @@ -50,7 +50,7 @@ namespace Internal { BuildGraphNode *loadBuildGraphNode(PersistentPool &pool) { const auto t = pool.load(); - BuildGraphNode *node = 0; + BuildGraphNode *node = nullptr; switch (static_cast(t)) { case BuildGraphNode::ArtifactNodeType: node = pool.load(); diff --git a/src/lib/corelib/buildgraph/processcommandexecutor.h b/src/lib/corelib/buildgraph/processcommandexecutor.h index b96f6a0f1..877c0bffb 100644 --- a/src/lib/corelib/buildgraph/processcommandexecutor.h +++ b/src/lib/corelib/buildgraph/processcommandexecutor.h @@ -56,7 +56,7 @@ class ProcessCommandExecutor : public AbstractCommandExecutor { Q_OBJECT public: - explicit ProcessCommandExecutor(const Internal::Logger &logger, QObject *parent = 0); + explicit ProcessCommandExecutor(const Internal::Logger &logger, QObject *parent = nullptr); void setProcessEnvironment(const QProcessEnvironment &processEnvironment) { m_buildEnvironment = processEnvironment; diff --git a/src/lib/corelib/buildgraph/qtmocscanner.cpp b/src/lib/corelib/buildgraph/qtmocscanner.cpp index df2bfab00..a5f607d8a 100644 --- a/src/lib/corelib/buildgraph/qtmocscanner.cpp +++ b/src/lib/corelib/buildgraph/qtmocscanner.cpp @@ -98,8 +98,8 @@ QtMocScanner::QtMocScanner(const ResolvedProductPtr &product, QScriptValue targe : m_tags(*commonFileTags()) , m_product(product) , m_targetScriptValue(targetScriptValue) - , m_cppScanner(0) - , m_hppScanner(0) + , m_cppScanner(nullptr) + , m_hppScanner(nullptr) { ScriptEngine *engine = static_cast(targetScriptValue.engine()); QScriptValue scannerObj = engine->newObject(); @@ -151,7 +151,7 @@ static RawScanResult runScanner(ScannerPlugin *scanner, const Artifact *artifact forever { int flags = 0; const char *szOutFilePath = scanner->next(opaq, &length, &flags); - if (szOutFilePath == 0) + if (szOutFilePath == nullptr) break; QString includedFilePath = QString::fromLocal8Bit(szOutFilePath, length); if (includedFilePath.isEmpty()) diff --git a/src/lib/corelib/buildgraph/rulesapplicator.cpp b/src/lib/corelib/buildgraph/rulesapplicator.cpp index 674a5a2bb..3430b5204 100644 --- a/src/lib/corelib/buildgraph/rulesapplicator.cpp +++ b/src/lib/corelib/buildgraph/rulesapplicator.cpp @@ -73,7 +73,7 @@ namespace Internal { RulesApplicator::RulesApplicator(const ResolvedProductPtr &product, const Logger &logger) : m_product(product) - , m_mocScanner(0) + , m_mocScanner(nullptr) , m_logger(logger) { } @@ -121,7 +121,7 @@ void RulesApplicator::handleRemovedRuleOutputs(const ArtifactSet &inputArtifacts const ArtifactSet &outputArtifactsToRemove, const Logger &logger) { ArtifactSet artifactsToRemove; - const TopLevelProject *project = 0; + const TopLevelProject *project = nullptr; for (Artifact * const removedArtifact : outputArtifactsToRemove) { qCDebug(lcBuildGraph) << "dynamic rule removed output artifact" << removedArtifact->toString(); diff --git a/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp b/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp index cd4df4d01..0b6774adb 100644 --- a/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp +++ b/src/lib/corelib/buildgraph/rulesevaluationcontext.cpp @@ -56,7 +56,7 @@ namespace Internal { RulesEvaluationContext::RulesEvaluationContext(const Logger &logger) : m_logger(logger), m_engine(new ScriptEngine(m_logger, EvalContext::RuleExecution)), - m_observer(0), + m_observer(nullptr), m_initScopeCalls(0) { m_prepareScriptScope = m_engine->newObject(); diff --git a/src/lib/corelib/jsextensions/domxml.cpp b/src/lib/corelib/jsextensions/domxml.cpp index 6b2cf6bed..b47ac5b05 100644 --- a/src/lib/corelib/jsextensions/domxml.cpp +++ b/src/lib/corelib/jsextensions/domxml.cpp @@ -143,7 +143,7 @@ QBS_JSEXTENSION_REGISTER(Xml, &initializeJsExtensionXml) QScriptValue XmlDomDocument::ctor(QScriptContext *context, QScriptEngine *engine) { - XmlDomDocument *xml = 0; + XmlDomDocument *xml = nullptr; switch (context->argumentCount()) { case 0: xml = new XmlDomDocument(context); diff --git a/src/lib/corelib/jsextensions/moduleproperties.cpp b/src/lib/corelib/jsextensions/moduleproperties.cpp index 47b226e50..b544699fe 100644 --- a/src/lib/corelib/jsextensions/moduleproperties.cpp +++ b/src/lib/corelib/jsextensions/moduleproperties.cpp @@ -229,7 +229,7 @@ QScriptValue ModuleProperties::moduleProperty(QScriptContext *context, QScriptEn const void *ptr = reinterpret_cast(qscriptvalue_cast(ptrScriptValue)); PropertyMapConstPtr properties; - const Artifact *artifact = 0; + const Artifact *artifact = nullptr; if (typeScriptValue.toString() == productType()) { properties = static_cast(ptr)->moduleProperties; } else if (typeScriptValue.toString() == artifactType()) { diff --git a/src/lib/corelib/jsextensions/process.cpp b/src/lib/corelib/jsextensions/process.cpp index fed7e57e7..b38c10aad 100644 --- a/src/lib/corelib/jsextensions/process.cpp +++ b/src/lib/corelib/jsextensions/process.cpp @@ -244,9 +244,9 @@ void Process::close() return; Q_ASSERT(thisObject().engine() == engine()); delete m_textStream; - m_textStream = 0; + m_textStream = nullptr; delete m_qProcess; - m_qProcess = 0; + m_qProcess = nullptr; } bool Process::waitForFinished(int msecs) diff --git a/src/lib/corelib/jsextensions/textfile.cpp b/src/lib/corelib/jsextensions/textfile.cpp index bfa2b12d2..57c928d86 100644 --- a/src/lib/corelib/jsextensions/textfile.cpp +++ b/src/lib/corelib/jsextensions/textfile.cpp @@ -166,7 +166,7 @@ TextFile::TextFile(QScriptContext *context, const QString &filePath, OpenMode mo context->throwError(Tr::tr("Unable to open file '%1': %2") .arg(filePath, m_file->errorString())); delete m_file; - m_file = 0; + m_file = nullptr; } } @@ -175,10 +175,10 @@ void TextFile::close() if (checkForClosed()) return; delete m_stream; - m_stream = 0; + m_stream = nullptr; m_file->close(); delete m_file; - m_file = 0; + m_file = nullptr; } QString TextFile::filePath() diff --git a/src/lib/corelib/language/evaluatorscriptclass.cpp b/src/lib/corelib/language/evaluatorscriptclass.cpp index f416be1b1..533025ff6 100644 --- a/src/lib/corelib/language/evaluatorscriptclass.cpp +++ b/src/lib/corelib/language/evaluatorscriptclass.cpp @@ -586,8 +586,8 @@ QScriptValue EvaluatorScriptClass::property(const QScriptValue &object, const QS const EvaluationData *data = m_queryResult.data; const Item * const itemOfProperty = m_queryResult.itemOfProperty; m_queryResult.foundInParent = false; - m_queryResult.data = 0; - m_queryResult.itemOfProperty = 0; + m_queryResult.data = nullptr; + m_queryResult.itemOfProperty = nullptr; QBS_ASSERT(data, return QScriptValue()); const QueryPropertyType qpt = static_cast(id); diff --git a/src/lib/corelib/language/evaluatorscriptclass.h b/src/lib/corelib/language/evaluatorscriptclass.h index 6968e9d98..ba39e23c9 100755 --- a/src/lib/corelib/language/evaluatorscriptclass.h +++ b/src/lib/corelib/language/evaluatorscriptclass.h @@ -89,7 +89,7 @@ private: struct QueryResult { QueryResult() - : data(0), itemOfProperty(0) + : data(nullptr), itemOfProperty(nullptr) {} bool isNull() const diff --git a/src/lib/corelib/language/filecontext.cpp b/src/lib/corelib/language/filecontext.cpp index 27107ff49..6daf8c871 100644 --- a/src/lib/corelib/language/filecontext.cpp +++ b/src/lib/corelib/language/filecontext.cpp @@ -45,7 +45,7 @@ namespace qbs { namespace Internal { FileContext::FileContext() - : m_idScope(0) + : m_idScope(nullptr) { } diff --git a/src/lib/corelib/language/item.cpp b/src/lib/corelib/language/item.cpp index 4bdee83ea..646d90ff7 100644 --- a/src/lib/corelib/language/item.cpp +++ b/src/lib/corelib/language/item.cpp @@ -59,11 +59,11 @@ namespace Internal { Item::Item(ItemPool *pool, ItemType type) : m_pool(pool) - , m_observer(0) - , m_prototype(0) - , m_scope(0) - , m_outerItem(0) - , m_parent(0) + , m_observer(nullptr) + , m_prototype(nullptr) + , m_scope(nullptr) + , m_outerItem(nullptr) + , m_parent(nullptr) , m_type(type) { } @@ -338,7 +338,7 @@ void Item::removeProperty(const QString &name) Item *Item::child(ItemType type, bool checkForMultiple) const { - Item *child = 0; + Item *child = nullptr; for (Item * const currentChild : children()) { if (currentChild->type() == type) { if (!checkForMultiple) diff --git a/src/lib/corelib/language/item.h b/src/lib/corelib/language/item.h index 62f4adde3..6dfc138aa 100644 --- a/src/lib/corelib/language/item.h +++ b/src/lib/corelib/language/item.h @@ -72,7 +72,7 @@ public: struct Module { Module() - : item(0), isProduct(false), required(true) + : item(nullptr), isProduct(false), required(true) {} QualifiedId name; diff --git a/src/lib/corelib/language/itemreadervisitorstate.cpp b/src/lib/corelib/language/itemreadervisitorstate.cpp index b1261f0ca..a48f081ff 100644 --- a/src/lib/corelib/language/itemreadervisitorstate.cpp +++ b/src/lib/corelib/language/itemreadervisitorstate.cpp @@ -62,7 +62,7 @@ class ASTCacheValueData : public QSharedData Q_DISABLE_COPY(ASTCacheValueData) public: ASTCacheValueData() - : ast(0) + : ast(nullptr) , processing(false) { } diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp index 22a678399..5f6a5ff58 100644 --- a/src/lib/corelib/language/language.cpp +++ b/src/lib/corelib/language/language.cpp @@ -773,7 +773,7 @@ QString ResolvedProduct::cachedExecutablePath(const QString &origFilePath) const } -ResolvedProject::ResolvedProject() : enabled(true), m_topLevelProject(0) +ResolvedProject::ResolvedProject() : enabled(true), m_topLevelProject(nullptr) { } @@ -849,7 +849,7 @@ void ResolvedProject::store(PersistentPool &pool) const TopLevelProject::TopLevelProject() - : bgLocker(0), locked(false), lastResolveTime(FileTime::oldestTime()) + : bgLocker(nullptr), locked(false), lastResolveTime(FileTime::oldestTime()) { } diff --git a/src/lib/corelib/language/loader.cpp b/src/lib/corelib/language/loader.cpp index 997124465..685865371 100644 --- a/src/lib/corelib/language/loader.cpp +++ b/src/lib/corelib/language/loader.cpp @@ -62,7 +62,7 @@ namespace Internal { Loader::Loader(ScriptEngine *engine, const Logger &logger) : m_logger(logger) - , m_progressObserver(0) + , m_progressObserver(nullptr) , m_engine(engine) { m_logger.storeWarnings(); diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp index 40e41e47e..138a07f53 100644 --- a/src/lib/corelib/language/moduleloader.cpp +++ b/src/lib/corelib/language/moduleloader.cpp @@ -239,9 +239,9 @@ private: }; ModuleLoader::ModuleLoader(Evaluator *evaluator, Logger &logger) - : m_pool(0) + : m_pool(nullptr) , m_logger(logger) - , m_progressObserver(0) + , m_progressObserver(nullptr) , m_reader(new ItemReader(logger)) , m_evaluator(evaluator) { @@ -375,7 +375,7 @@ public: PropertyDeclarationCheck(const Set &disabledItems, const SetupProjectParameters ¶ms, Logger &logger) : m_disabledItems(disabledItems) - , m_parentItem(0) + , m_parentItem(nullptr) , m_params(params) , m_logger(logger) { @@ -2455,7 +2455,7 @@ Item *ModuleLoader::loadModule(ProductContext *productContext, Item *exportingPr } delayedPropertyChanger.applyNow(); if (!modulePrototype) - return 0; + return nullptr; instantiateModule(productContext, exportingProductItem, item, moduleInstance, modulePrototype, moduleName, pmi); @@ -2552,7 +2552,7 @@ Item *ModuleLoader::searchAndLoadModuleFile(ProductContext *productContext, throw ErrorInfo(Tr::tr("Module %1 could not be loaded.").arg(fullName), dependsItemLocation); - return 0; + return nullptr; } // returns QVariant::Invalid for types that do not need conversion @@ -2630,7 +2630,7 @@ Item *ModuleLoader::loadModuleFile(ProductContext *productContext, const QString << "Alleged module " << fullModuleName << " has type '" << module->typeName() << "', so it's not a module after all."; *triedToLoad = false; - return 0; + return nullptr; } // Set the name before evaluating any properties. EvaluatorScriptClass reads the module name. @@ -2670,7 +2670,7 @@ Item *ModuleLoader::loadModuleFile(ProductContext *productContext, const QString if (!enabled) { qCDebug(lcModuleLoader) << "condition of module" << fullModuleName << "is false"; m_modulePrototypeItemCache.insert(cacheKey, ItemCacheValue(module, false)); - return 0; + return nullptr; } if (isBaseModule) diff --git a/src/lib/corelib/language/moduleloader.h b/src/lib/corelib/language/moduleloader.h index cc3b02973..a46f80873 100644 --- a/src/lib/corelib/language/moduleloader.h +++ b/src/lib/corelib/language/moduleloader.h @@ -77,7 +77,7 @@ using ModulePropertiesPerGroup = std::unordered_mapmodules().size(); for (const Item::Module &dep : m.item->modules()) { if (dep.name == m_mergedModule.name) { diff --git a/src/lib/corelib/language/projectresolver.cpp b/src/lib/corelib/language/projectresolver.cpp index 879f42a11..ee95cacf1 100644 --- a/src/lib/corelib/language/projectresolver.cpp +++ b/src/lib/corelib/language/projectresolver.cpp @@ -110,7 +110,7 @@ ProjectResolver::ProjectResolver(Evaluator *evaluator, const ModuleLoaderResult : m_evaluator(evaluator) , m_logger(logger) , m_engine(m_evaluator->engine()) - , m_progressObserver(0) + , m_progressObserver(nullptr) , m_setupParams(setupParameters) , m_loadResult(loadResult) { @@ -151,8 +151,8 @@ TopLevelProjectPtr ProjectResolver::resolve() m_setupParams.logElapsedTime()); qCDebug(lcProjectResolver) << "resolving" << m_loadResult.root->file()->filePath(); - m_productContext = 0; - m_moduleContext = 0; + m_productContext = nullptr; + m_moduleContext = nullptr; m_elapsedTimeModPropEval = m_elapsedTimeAllPropEval = m_elapsedTimeGroups = 0; TopLevelProjectPtr tlp; try { diff --git a/src/lib/corelib/language/scriptengine.h b/src/lib/corelib/language/scriptengine.h index 68455c44e..05f4f519f 100644 --- a/src/lib/corelib/language/scriptengine.h +++ b/src/lib/corelib/language/scriptengine.h @@ -97,7 +97,7 @@ class QBS_AUTOTEST_EXPORT ScriptEngine : public QScriptEngine { Q_OBJECT public: - ScriptEngine(Logger &logger, EvalContext evalContext, QObject *parent = 0); + ScriptEngine(Logger &logger, EvalContext evalContext, QObject *parent = nullptr); ~ScriptEngine(); Logger &logger() const { return m_logger; } diff --git a/src/lib/corelib/language/value.cpp b/src/lib/corelib/language/value.cpp index 8c3dea32c..69f7836d2 100644 --- a/src/lib/corelib/language/value.cpp +++ b/src/lib/corelib/language/value.cpp @@ -49,7 +49,7 @@ namespace qbs { namespace Internal { Value::Value(Type t, bool createdByPropertiesBlock) - : m_type(t), m_definingItem(0), m_createdByPropertiesBlock(createdByPropertiesBlock) + : m_type(t), m_definingItem(nullptr), m_createdByPropertiesBlock(createdByPropertiesBlock) { } diff --git a/src/lib/corelib/parser/qmlerror.cpp b/src/lib/corelib/parser/qmlerror.cpp index 6556ba8a5..c6fd2e27c 100644 --- a/src/lib/corelib/parser/qmlerror.cpp +++ b/src/lib/corelib/parser/qmlerror.cpp @@ -94,7 +94,7 @@ QmlErrorPrivate::QmlErrorPrivate() Creates an empty error object. */ QmlError::QmlError() -: d(0) +: d(nullptr) { } @@ -102,7 +102,7 @@ QmlError::QmlError() Creates a copy of \a other. */ QmlError::QmlError(const QmlError &other) -: d(0) +: d(nullptr) { *this = other; } @@ -114,7 +114,7 @@ QmlError &QmlError::operator=(const QmlError &other) { if (!other.d) { delete d; - d = 0; + d = nullptr; } else { if (!d) d = new QmlErrorPrivate; d->url = other.d->url; @@ -130,7 +130,7 @@ QmlError &QmlError::operator=(const QmlError &other) */ QmlError::~QmlError() { - delete d; d = 0; + delete d; d = nullptr; } /*! @@ -138,7 +138,7 @@ QmlError::~QmlError() */ bool QmlError::isValid() const { - return d != 0; + return d != nullptr; } /*! diff --git a/src/lib/corelib/parser/qmljsast.cpp b/src/lib/corelib/parser/qmljsast.cpp index 1d0d87b2e..8c87f80b2 100644 --- a/src/lib/corelib/parser/qmljsast.cpp +++ b/src/lib/corelib/parser/qmljsast.cpp @@ -60,22 +60,22 @@ void Node::accept(Node *node, Visitor *visitor) ExpressionNode *Node::expressionCast() { - return 0; + return nullptr; } BinaryExpression *Node::binaryExpressionCast() { - return 0; + return nullptr; } Statement *Node::statementCast() { - return 0; + return nullptr; } UiObjectMember *Node::uiObjectMemberCast() { - return 0; + return nullptr; } ExpressionNode *ExpressionNode::expressionCast() diff --git a/src/lib/corelib/parser/qmljsast_p.h b/src/lib/corelib/parser/qmljsast_p.h index 072c77521..d7b627a4b 100644 --- a/src/lib/corelib/parser/qmljsast_p.h +++ b/src/lib/corelib/parser/qmljsast_p.h @@ -110,10 +110,10 @@ namespace AST { template _T1 cast(_T2 *ast) { - if (ast && ast->kind == static_cast<_T1>(0)->K) + if (ast && ast->kind == static_cast<_T1>(nullptr)->K) return static_cast<_T1>(ast); - return 0; + return nullptr; } class QML_PARSER_EXPORT Node: public Managed @@ -448,11 +448,11 @@ public: QMLJS_DECLARE_AST_NODE(ArrayLiteral) ArrayLiteral(Elision *e): - elements (0), elision (e) + elements (nullptr), elision (e) { kind = K; } ArrayLiteral(ElementList *elts): - elements (elts), elision (0) + elements (elts), elision (nullptr) { kind = K; } ArrayLiteral(ElementList *elts, Elision *e): @@ -481,7 +481,7 @@ public: QMLJS_DECLARE_AST_NODE(ObjectLiteral) ObjectLiteral(): - properties (0) { kind = K; } + properties (nullptr) { kind = K; } ObjectLiteral(PropertyNameAndValueList *plist): properties (plist) { kind = K; } @@ -526,7 +526,7 @@ public: inline Elision *finish () { Elision *front = next; - next = 0; + next = nullptr; return front; } @@ -555,7 +555,7 @@ public: inline ElementList *finish () { ElementList *front = next; - next = 0; + next = nullptr; return front; } @@ -631,7 +631,7 @@ public: inline PropertyNameAndValueList *finish () { PropertyNameAndValueList *front = next; - next = 0; + next = nullptr; return front; } @@ -835,7 +835,7 @@ public: inline ArgumentList *finish () { ArgumentList *front = next; - next = 0; + next = nullptr; return front; } @@ -1199,7 +1199,7 @@ public: inline StatementList *finish () { StatementList *front = next; - next = 0; + next = nullptr; return front; } @@ -1287,10 +1287,10 @@ public: inline VariableDeclarationList *finish (bool readOnly) { VariableDeclarationList *front = next; - next = 0; + next = nullptr; if (readOnly) { VariableDeclarationList *vdl; - for (vdl = front; vdl != 0; vdl = vdl->next) + for (vdl = front; vdl != nullptr; vdl = vdl->next) vdl->declaration->readOnly = true; } return front; @@ -1735,7 +1735,7 @@ public: inline CaseClauses *finish () { CaseClauses *front = next; - next = 0; + next = nullptr; return front; } @@ -1871,11 +1871,11 @@ public: { kind = K; } TryStatement(Statement *stmt, Finally *f): - statement (stmt), catchExpression (0), finallyExpression (f) + statement (stmt), catchExpression (nullptr), finallyExpression (f) { kind = K; } TryStatement(Statement *stmt, Catch *c): - statement (stmt), catchExpression (c), finallyExpression (0) + statement (stmt), catchExpression (c), finallyExpression (nullptr) { kind = K; } virtual void accept0(Visitor *visitor); @@ -1969,7 +1969,7 @@ public: inline FormalParameterList *finish () { FormalParameterList *front = next; - next = 0; + next = nullptr; return front; } @@ -2017,7 +2017,7 @@ public: inline SourceElements *finish () { SourceElements *front = next; - next = 0; + next = nullptr; return front; } @@ -2151,7 +2151,7 @@ public: UiQualifiedId *finish() { UiQualifiedId *head = next; - next = 0; + next = nullptr; return head; } @@ -2175,7 +2175,7 @@ public: QMLJS_DECLARE_AST_NODE(UiImport) UiImport(const QStringRef &fileName) - : fileName(fileName), importUri(0) + : fileName(fileName), importUri(nullptr) { kind = K; } UiImport(UiQualifiedId *uri) @@ -2223,7 +2223,7 @@ public: UiImportList *finish() { UiImportList *head = next; - next = 0; + next = nullptr; return head; } @@ -2277,7 +2277,7 @@ public: UiObjectMemberList *finish() { UiObjectMemberList *head = next; - next = 0; + next = nullptr; return head; } @@ -2348,7 +2348,7 @@ public: UiArrayMemberList *finish() { UiArrayMemberList *head = next; - next = 0; + next = nullptr; return head; } @@ -2409,7 +2409,7 @@ public: inline UiParameterList *finish () { UiParameterList *front = next; - next = 0; + next = nullptr; return front; } @@ -2429,13 +2429,13 @@ public: UiPublicMember(const QStringRef &memberType, const QStringRef &name) - : type(Property), memberType(memberType), name(name), statement(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), memberType(memberType), name(name), statement(nullptr), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } UiPublicMember(const QStringRef &memberType, const QStringRef &name, Statement *statement) - : type(Property), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), memberType(memberType), name(name), statement(statement), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } virtual void accept0(Visitor *visitor); diff --git a/src/lib/corelib/parser/qmljsengine_p.cpp b/src/lib/corelib/parser/qmljsengine_p.cpp index 8a7b9dbc8..211743190 100644 --- a/src/lib/corelib/parser/qmljsengine_p.cpp +++ b/src/lib/corelib/parser/qmljsengine_p.cpp @@ -118,7 +118,7 @@ double integerFromString(const QString &str, int radix) Engine::Engine() - : _lexer(0), _directives(0) + : _lexer(nullptr), _directives(nullptr) { } Engine::~Engine() diff --git a/src/lib/corelib/parser/qmljslexer.cpp b/src/lib/corelib/parser/qmljslexer.cpp index 43c52a474..2c96aa8cf 100644 --- a/src/lib/corelib/parser/qmljslexer.cpp +++ b/src/lib/corelib/parser/qmljslexer.cpp @@ -84,10 +84,10 @@ static QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4) Lexer::Lexer(Engine *engine) : _engine(engine) - , _codePtr(0) - , _lastLinePtr(0) - , _tokenLinePtr(0) - , _tokenStartPtr(0) + , _codePtr(nullptr) + , _lastLinePtr(nullptr) + , _tokenLinePtr(nullptr) + , _tokenStartPtr(nullptr) , _char(QLatin1Char('\n')) , _errorCode(NoError) , _currentLineNumber(0) @@ -455,7 +455,7 @@ again: chars.append('\0'); const char *begin = chars.constData(); - const char *end = 0; + const char *end = nullptr; bool ok = false; _tokenValue = qstrtod(begin, &end, &ok); @@ -845,7 +845,7 @@ int Lexer::scanNumber(QChar ch) chars.append('\0'); const char *begin = chars.constData(); - const char *end = 0; + const char *end = nullptr; bool ok = false; _tokenValue = qstrtod(begin, &end, &ok); diff --git a/src/lib/corelib/parser/qmljsmemorypool_p.h b/src/lib/corelib/parser/qmljsmemorypool_p.h index fa16ac409..897348712 100644 --- a/src/lib/corelib/parser/qmljsmemorypool_p.h +++ b/src/lib/corelib/parser/qmljsmemorypool_p.h @@ -68,11 +68,11 @@ class QML_PARSER_EXPORT MemoryPool : public QSharedData public: MemoryPool() - : _blocks(0), + : _blocks(nullptr), _allocatedBlocks(0), _blockCount(-1), - _ptr(0), - _end(0) + _ptr(nullptr), + _end(nullptr) { } ~MemoryPool() @@ -101,7 +101,7 @@ public: void reset() { _blockCount = -1; - _ptr = _end = 0; + _ptr = _end = nullptr; } private: @@ -118,7 +118,7 @@ private: _blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks); for (int index = _blockCount; index < _allocatedBlocks; ++index) - _blocks[index] = 0; + _blocks[index] = nullptr; } char *&block = _blocks[_blockCount]; diff --git a/src/lib/corelib/parser/qmljsparser.cpp b/src/lib/corelib/parser/qmljsparser.cpp index 963631b7d..10be751a8 100644 --- a/src/lib/corelib/parser/qmljsparser.cpp +++ b/src/lib/corelib/parser/qmljsparser.cpp @@ -77,13 +77,13 @@ Parser::Parser(Engine *engine): pool(engine->pool()), tos(0), stack_size(0), - sym_stack(0), - state_stack(0), - location_stack(0), - string_stack(0), - program(0), - first_token(0), - last_token(0) + sym_stack(nullptr), + state_stack(nullptr), + location_stack(nullptr), + string_stack(nullptr), + program(nullptr), + first_token(nullptr), + last_token(nullptr) { } @@ -132,7 +132,7 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return currentId->finish(); } - return 0; + return nullptr; } bool Parser::parse(int startToken) @@ -160,7 +160,7 @@ bool Parser::parse(int startToken) } tos = -1; - program = 0; + program = nullptr; do { if (++tos == stack_size) @@ -275,7 +275,7 @@ case 19: { } break; case 20: { - AST::UiImport *node = 0; + AST::UiImport *node = nullptr; if (AST::StringLiteral *importIdLiteral = AST::cast(sym(2).Expression)) { node = new (pool) AST::UiImport(importIdLiteral->value); @@ -298,7 +298,7 @@ case 20: { } break; case 21: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 22: { @@ -379,7 +379,7 @@ case 41: } break; case 45: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 46: { @@ -497,7 +497,7 @@ case 62: { AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); propertyName->identifierToken = loc(6); - propertyName->next = 0; + propertyName->next = nullptr; AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding( propertyName, sym(9).UiArrayMemberList->finish()); @@ -519,7 +519,7 @@ case 63: { AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); propertyName->identifierToken = loc(3); - propertyName->next = 0; + propertyName->next = nullptr; AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); @@ -652,7 +652,7 @@ case 85: { } break; case 86: { - AST::ObjectLiteral *node = 0; + AST::ObjectLiteral *node = nullptr; if (sym(2).Node) node = new (pool) AST::ObjectLiteral( sym(2).PropertyNameAndValueList->finish ()); @@ -689,7 +689,7 @@ case 89: { if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { sym(1).UiQualifiedId = qualifiedId; } else { - sym(1).UiQualifiedId = 0; + sym(1).UiQualifiedId = nullptr; diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), QLatin1String("Expected a qualified name id"))); @@ -834,7 +834,7 @@ case 147: { } break; case 148: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 149: { @@ -1261,7 +1261,7 @@ case 242: { } break; case 243: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 246: { @@ -1271,7 +1271,7 @@ case 246: { } break; case 247: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 264: { @@ -1290,7 +1290,7 @@ case 266: { } break; case 267: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 268: { @@ -1350,7 +1350,7 @@ case 279: { } break; case 280: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 282: { @@ -1359,7 +1359,7 @@ case 282: { } break; case 283: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 285: { @@ -1530,7 +1530,7 @@ case 312: { } break; case 313: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 314: { @@ -1649,7 +1649,7 @@ case 332: { } break; case 333: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 334: { @@ -1657,7 +1657,7 @@ case 334: { } break; case 335: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 337: { @@ -1689,7 +1689,7 @@ case 344: { } break; case 346: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; } // switch diff --git a/src/lib/corelib/parser/qmljsparser_p.h b/src/lib/corelib/parser/qmljsparser_p.h index fde61ea11..05e22074b 100644 --- a/src/lib/corelib/parser/qmljsparser_p.h +++ b/src/lib/corelib/parser/qmljsparser_p.h @@ -134,7 +134,7 @@ public: AST::Statement *statement() const { if (! program) - return 0; + return nullptr; return program->statementCast(); } @@ -142,7 +142,7 @@ public: AST::ExpressionNode *expression() const { if (! program) - return 0; + return nullptr; return program->expressionCast(); } @@ -150,7 +150,7 @@ public: AST::UiObjectMember *uiObjectMember() const { if (! program) - return 0; + return nullptr; return program->uiObjectMemberCast(); } diff --git a/src/lib/corelib/tools/id.cpp b/src/lib/corelib/tools/id.cpp index e2e0cf5f5..66c5f85d7 100644 --- a/src/lib/corelib/tools/id.cpp +++ b/src/lib/corelib/tools/id.cpp @@ -69,7 +69,7 @@ class StringHolder { public: StringHolder() - : n(0), str(0) + : n(0), str(nullptr) {} StringHolder(const char *s, int length) diff --git a/src/lib/corelib/tools/persistence.cpp b/src/lib/corelib/tools/persistence.cpp index dd1265f92..2dc7ab30a 100644 --- a/src/lib/corelib/tools/persistence.cpp +++ b/src/lib/corelib/tools/persistence.cpp @@ -142,7 +142,7 @@ void PersistentPool::finalizeWriteStream() void PersistentPool::closeStream() { delete m_stream.device(); - m_stream.setDevice(0); + m_stream.setDevice(nullptr); } void PersistentPool::storePersistentObject(const PersistentObject *object) diff --git a/src/lib/corelib/tools/persistence.h b/src/lib/corelib/tools/persistence.h index 847ded5cb..cbabd828f 100644 --- a/src/lib/corelib/tools/persistence.h +++ b/src/lib/corelib/tools/persistence.h @@ -136,7 +136,7 @@ template inline T *PersistentPool::idLoad() m_stream >> id; if (id < 0) - return 0; + return nullptr; if (id < static_cast(m_loadedRaw.size())) { PersistentObject *obj = m_loadedRaw.at(id); @@ -146,7 +146,7 @@ template inline T *PersistentPool::idLoad() auto i = m_loadedRaw.size(); m_loadedRaw.resize(id + 1); for (; i < m_loadedRaw.size(); ++i) - m_loadedRaw[i] = 0; + m_loadedRaw[i] = nullptr; T * const t = new T; PersistentObject * const po = t; diff --git a/src/lib/corelib/tools/profiling.cpp b/src/lib/corelib/tools/profiling.cpp index 18ce2322d..2f92658d7 100644 --- a/src/lib/corelib/tools/profiling.cpp +++ b/src/lib/corelib/tools/profiling.cpp @@ -57,7 +57,7 @@ public: TimedActivityLogger::TimedActivityLogger(const Logger &logger, const QString &activity, bool enabled) - : d(0) + : d(nullptr) { if (!enabled) return; @@ -76,7 +76,7 @@ void TimedActivityLogger::finishActivity() d->logger.qbsLog(LoggerInfo, true) << Tr::tr("Activity '%2' took %3.").arg(d->activity, timeString); delete d; - d = 0; + d = nullptr; } TimedActivityLogger::~TimedActivityLogger() diff --git a/src/lib/corelib/tools/qbsprocess.h b/src/lib/corelib/tools/qbsprocess.h index 9d2343010..07f344e8a 100644 --- a/src/lib/corelib/tools/qbsprocess.h +++ b/src/lib/corelib/tools/qbsprocess.h @@ -54,7 +54,7 @@ class QbsProcess : public QObject { Q_OBJECT public: - explicit QbsProcess(QObject *parent = 0); + explicit QbsProcess(QObject *parent = nullptr); QProcess::ProcessState state() const { return m_state; } void setProcessEnvironment(const QProcessEnvironment &env) { m_environment = env; } diff --git a/src/lib/corelib/tools/scannerpluginmanager.cpp b/src/lib/corelib/tools/scannerpluginmanager.cpp index eaa70ec36..55fed81c0 100644 --- a/src/lib/corelib/tools/scannerpluginmanager.cpp +++ b/src/lib/corelib/tools/scannerpluginmanager.cpp @@ -61,7 +61,7 @@ QList ScannerPluginManager::scannersForFileTag(const FileTag &f void ScannerPluginManager::registerPlugins(ScannerPlugin **plugins) { - for (int i = 0; plugins[i] != 0; ++i) { + for (int i = 0; plugins[i] != nullptr; ++i) { const FileTags &fileTags = FileTags::fromStringList( QString::fromLatin1(plugins[i]->fileTags).split(QLatin1Char(','))); for (const FileTag &tag : fileTags) diff --git a/src/lib/corelib/tools/settingsmodel.cpp b/src/lib/corelib/tools/settingsmodel.cpp index 4562de906..b175211a1 100644 --- a/src/lib/corelib/tools/settingsmodel.cpp +++ b/src/lib/corelib/tools/settingsmodel.cpp @@ -60,7 +60,7 @@ namespace Internal { struct Node { - Node() : parent(0), isFromSettings(true) {} + Node() : parent(nullptr), isFromSettings(true) {} ~Node() { qDeleteAll(children); } QString uniqueChildName() const; @@ -279,7 +279,7 @@ bool SettingsModel::setData(const QModelIndex &index, const QVariant &value, int if (!node) return false; const QString valueString = value.toString(); - QString *toChange = 0; + QString *toChange = nullptr; if (index.column() == keyColumn() && !valueString.isEmpty() && !node->parent->hasDirectChildWithName(valueString) && !(node->parent->parent == &d->rootNode @@ -358,7 +358,7 @@ void SettingsModel::SettingsModelPrivate::addNodeFromSettings(Node *parentNode, void SettingsModel::SettingsModelPrivate::addNode(qbs::Internal::Node *parentNode, const QString ¤tNamePart, const QStringList &restOfName, const QVariant &value) { - Node *currentNode = 0; + Node *currentNode = nullptr; for (Node * const n : qAsConst(parentNode->children)) { if (n->name == currentNamePart) { currentNode = n; diff --git a/src/lib/corelib/tools/settingsmodel.h b/src/lib/corelib/tools/settingsmodel.h index 8628bf77d..94f163438 100644 --- a/src/lib/corelib/tools/settingsmodel.h +++ b/src/lib/corelib/tools/settingsmodel.h @@ -51,7 +51,7 @@ class QBS_EXPORT SettingsModel : public QAbstractItemModel { Q_OBJECT public: - SettingsModel(const QString &settingsDir, QObject *parent = 0); + SettingsModel(const QString &settingsDir, QObject *parent = nullptr); ~SettingsModel(); int keyColumn() const { return 0; } diff --git a/src/lib/corelib/tools/vsenvironmentdetector.cpp b/src/lib/corelib/tools/vsenvironmentdetector.cpp index 16cdc3110..fd5feecc9 100644 --- a/src/lib/corelib/tools/vsenvironmentdetector.cpp +++ b/src/lib/corelib/tools/vsenvironmentdetector.cpp @@ -233,7 +233,7 @@ void VsEnvironmentDetector::writeBatchFile(QIODevice *device, const QString &vcv void VsEnvironmentDetector::parseBatOutput(const QByteArray &output, std::vector msvcs) { QString arch; - QProcessEnvironment *targetEnv = 0; + QProcessEnvironment *targetEnv = nullptr; for (QByteArray line : output.split('\n')) { line = line.trimmed(); if (line.isEmpty()) -- cgit v1.2.1