diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-21 10:41:54 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-26 07:13:18 +0000 |
commit | 499ec43937e926e4f2fa57a9baa455fcb3862262 (patch) | |
tree | 206c90d47387f8322b68f5e3db613189397e1af3 /src/plugins/qmltooling/qmldbg_debugger | |
parent | 53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff) |
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.
Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).
Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_debugger')
8 files changed, 28 insertions, 28 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp index 9315adf4ce..3851cdc71f 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp @@ -52,7 +52,7 @@ QQmlDebugService *QQmlDebuggerServiceFactory::create(const QString &key) if (key == QV4DebugServiceImpl::s_key) return new QV4DebugServiceImpl(this); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index 80da09d718..288ad243ce 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE QQmlEngineDebugServiceImpl::QQmlEngineDebugServiceImpl(QObject *parent) : - QQmlEngineDebugService(2, parent), m_watch(new QQmlWatcher(this)), m_statesDelegate(0) + QQmlEngineDebugService(2, parent), m_watch(new QQmlWatcher(this)), m_statesDelegate(nullptr) { connect(m_watch, &QQmlWatcher::propertyChanged, this, &QQmlEngineDebugServiceImpl::propertyChanged); @@ -726,7 +726,7 @@ bool QQmlEngineDebugServiceImpl::resetBinding(int objectId, const QString &prope if (hasValidSignal(object, propertyName)) { QQmlProperty property(object, propertyName, context); - QQmlPropertyPrivate::setSignalExpression(property, 0); + QQmlPropertyPrivate::setSignalExpression(property, nullptr); return true; } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp index cbbbb2ceb7..86571e6cbe 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp @@ -61,12 +61,12 @@ public: QObject *object, int debugId, const QMetaProperty &prop, - QQmlWatcher *parent = 0); + QQmlWatcher *parent = nullptr); QQmlWatchProxy(int id, QQmlExpression *exp, int debugId, - QQmlWatcher *parent = 0); + QQmlWatcher *parent = nullptr); public slots: void notifyValueChanged(); // Needs to be a slot because of QQmlPropertyPrivate::connect() @@ -86,7 +86,7 @@ QQmlWatchProxy::QQmlWatchProxy(int id, QQmlExpression *exp, int debugId, QQmlWatcher *parent) -: QObject(parent), m_id(id), m_watch(parent), m_object(0), m_debugId(debugId), m_expr(exp) +: QObject(parent), m_id(id), m_watch(parent), m_object(nullptr), m_debugId(debugId), m_expr(exp) { QObject::connect(m_expr, &QQmlExpression::valueChanged, this, &QQmlWatchProxy::notifyValueChanged); @@ -97,7 +97,7 @@ QQmlWatchProxy::QQmlWatchProxy(int id, int debugId, const QMetaProperty &prop, QQmlWatcher *parent) -: QObject(parent), m_id(id), m_watch(parent), m_object(object), m_debugId(debugId), m_property(prop), m_expr(0) +: QObject(parent), m_id(id), m_watch(parent), m_object(object), m_debugId(debugId), m_property(prop), m_expr(nullptr) { static int refreshIdx = -1; if(refreshIdx == -1) diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index a538956e8e..c86f3d1803 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -69,19 +69,19 @@ QV4::Heap::ExecutionContext *QV4DataCollector::findContext(int frame) { QV4::CppStackFrame *f = findFrame(frame); - return f ? f->context()->d() : 0; + return f ? f->context()->d() : nullptr; } QV4::Heap::CallContext *QV4DataCollector::findScope(QV4::Heap::ExecutionContext *ctx, int scope) { if (!ctx) - return 0; + return nullptr; for (; scope > 0 && ctx; --scope) ctx = ctx->outer; return (ctx && ctx->type == QV4::Heap::ExecutionContext::Type_CallContext) ? - static_cast<QV4::Heap::CallContext *>(ctx) : 0; + static_cast<QV4::Heap::CallContext *>(ctx) : nullptr; } QVector<QV4::Heap::ExecutionContext::ContextType> QV4DataCollector::getScopeTypes(int frame) @@ -139,16 +139,16 @@ const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::Execution switch (value->type()) { case QV4::Value::Empty_Type: Q_ASSERT(!"empty Value encountered"); - return 0; + return nullptr; case QV4::Value::Undefined_Type: dict.insert(valueKey, QJsonValue::Undefined); - return 0; + return nullptr; case QV4::Value::Null_Type: dict.insert(valueKey, QJsonValue::Null); - return 0; + return nullptr; case QV4::Value::Boolean_Type: dict.insert(valueKey, value->booleanValue()); - return 0; + return nullptr; case QV4::Value::Managed_Type: if (const QV4::String *s = value->as<QV4::String>()) { dict.insert(valueKey, s->toQString()); @@ -176,10 +176,10 @@ const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::Execution } else { Q_UNREACHABLE(); } - return 0; + return nullptr; case QV4::Value::Integer_Type: dict.insert(valueKey, value->integerValue()); - return 0; + return nullptr; default: {// double const double val = value->doubleValue(); if (qIsFinite(val)) @@ -190,7 +190,7 @@ const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::Execution dict.insert(valueKey, QStringLiteral("-Infinity")); else dict.insert(valueKey, QStringLiteral("Infinity")); - return 0; + return nullptr; } } } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp index 45817ea38e..a1ed211a55 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp @@ -71,8 +71,8 @@ QV4Debugger::QV4Debugger(QV4::ExecutionEngine *engine) , m_haveBreakPoints(false) , m_breakOnThrow(false) , m_returnedValue(engine, QV4::Primitive::undefinedValue()) - , m_gatherSources(0) - , m_runningJob(0) + , m_gatherSources(nullptr) + , m_runningJob(nullptr) , m_collector(engine) { static int debuggerId = qRegisterMetaType<QV4Debugger*>(); @@ -182,7 +182,7 @@ void QV4Debugger::maybeBreakAtInstruction() if (m_gatherSources) { m_gatherSources->run(); delete m_gatherSources; - m_gatherSources = 0; + m_gatherSources = nullptr; } switch (m_stepping) { @@ -295,11 +295,11 @@ bool QV4Debugger::reallyHitTheBreakPoint(const QString &filename, int linenr) if (condition.isEmpty()) return true; - Q_ASSERT(m_runningJob == 0); + Q_ASSERT(m_runningJob == nullptr); EvalJob evilJob(m_engine, condition); m_runningJob = &evilJob; m_runningJob->run(); - m_runningJob = 0; + m_runningJob = nullptr; return evilJob.resultAsBoolean(); } @@ -313,7 +313,7 @@ void QV4Debugger::runInEngine(QV4DebugJob *job) void QV4Debugger::runInEngine_havingLock(QV4DebugJob *job) { Q_ASSERT(job); - Q_ASSERT(m_runningJob == 0); + Q_ASSERT(m_runningJob == nullptr); m_runningJob = job; if (state() == Paused) @@ -321,7 +321,7 @@ void QV4Debugger::runInEngine_havingLock(QV4DebugJob *job) else emit scheduleJob(); m_jobIsRunning.wait(&m_lock); - m_runningJob = 0; + m_runningJob = nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp index 87e75c49b5..71645579c5 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp @@ -56,13 +56,13 @@ QV4Debugger *QV4DebuggerAgent::pausedDebugger() const if (debugger->state() == QV4Debugger::Paused) return debugger; } - return 0; + return nullptr; } bool QV4DebuggerAgent::isRunning() const { // "running" means none of the engines are paused. - return pausedDebugger() == 0; + return pausedDebugger() == nullptr; } void QV4DebuggerAgent::debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseReason reason) diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index 6f254c9e28..5b049ab521 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -208,7 +208,7 @@ void ValueLookupJob::run() QScopedPointer<QObject> scopeObject; QV4::ExecutionEngine *engine = collector->engine(); QV4::Scope scope(engine); - QV4::Heap::ExecutionContext *qmlContext = 0; + QV4::Heap::ExecutionContext *qmlContext = nullptr; if (engine->qmlEngine() && !engine->qmlContext()) { scopeObject.reset(new QObject); qmlContext = QV4::QmlContext::create(engine->currentContext(), diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 99a57be5d6..61209e08cb 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -98,7 +98,7 @@ public: debugService->send(response); } - debugService = 0; + debugService = nullptr; seq = QJsonValue(); req = QJsonObject(); response = QJsonObject(); |