Commit 2a2e0341 authored by Anton Anikin's avatar Anton Anikin
Browse files

clang-tidy: use-nullptr run (on whole tree)

Reviewers: kfunk, #kdevelop

Reviewed By: kfunk, #kdevelop

Subscribers: kfunk, kdevelop-devel

Differential Revision: https://phabricator.kde.org/D3082
parent aacb11c1
......@@ -179,7 +179,7 @@ static const KDevelop::SessionInfo* findSessionInList( const SessionInfos& sessi
// We won't search a session without input data, since that could lead to false-positives
// with unnamed sessions
if( data.isEmpty() )
return 0;
return nullptr;
for( auto it = sessions.constBegin(); it != sessions.constEnd(); ++it ) {
if ( ( it->name == data ) || ( it->uuid.toString() == data ) ) {
......@@ -187,7 +187,7 @@ static const KDevelop::SessionInfo* findSessionInList( const SessionInfos& sessi
return &sessionRef;
}
}
return 0;
return nullptr;
}
/// Performs a DBus call to open the given @p files in the running kdev instance identified by @p pid
......@@ -686,7 +686,7 @@ int main( int argc, char *argv[] )
Q_ASSERT( !debugeeName.isEmpty() );
QString launchName = debugeeName;
KDevelop::LaunchConfiguration* launch = 0;
KDevelop::LaunchConfiguration* launch = nullptr;
qCDebug(APP) << launchName;
foreach (KDevelop::LaunchConfiguration *l, core->runControllerInternal()->launchConfigurationsInternal()) {
qCDebug(APP) << l->name();
......@@ -695,7 +695,7 @@ int main( int argc, char *argv[] )
}
}
KDevelop::LaunchConfigurationType *type = 0;
KDevelop::LaunchConfigurationType *type = nullptr;
foreach (KDevelop::LaunchConfigurationType *t, core->runController()->launchConfigurationTypes()) {
qCDebug(APP) << t->id();
if (t->id() == "Native Application") {
......@@ -709,8 +709,8 @@ int main( int argc, char *argv[] )
return 1;
}
if (launch && launch->type()->id() != "Native Application") launch = 0;
if (launch && launch->launcherForMode("debug") != parser.value("debug")) launch = 0;
if (launch && launch->type()->id() != "Native Application") launch = nullptr;
if (launch && launch->launcherForMode("debug") != parser.value("debug")) launch = nullptr;
if (!launch) {
qCDebug(APP) << launchName << "not found, creating a new one";
QPair<QString,QString> launcher;
......@@ -727,7 +727,7 @@ int main( int argc, char *argv[] )
qerr << endl << i18n("Cannot find launcher %1", parser.value("debug")) << endl;
return 1;
}
KDevelop::ILaunchConfiguration* ilaunch = core->runController()->createLaunchConfiguration(type, launcher, 0, launchName);
KDevelop::ILaunchConfiguration* ilaunch = core->runController()->createLaunchConfiguration(type, launcher, nullptr, launchName);
launch = dynamic_cast<KDevelop::LaunchConfiguration*>(ilaunch);
}
......
......@@ -30,7 +30,7 @@
KDevelopSessionsEngine::KDevelopSessionsEngine(QObject *parent, const QVariantList &args)
: Plasma::DataEngine(parent, args),
m_dirWatch(0)
m_dirWatch(nullptr)
{
init();
}
......
......@@ -32,7 +32,7 @@ class ProcessSelectionDialog : public QDialog
{
Q_OBJECT
public:
ProcessSelectionDialog( QWidget *parent=0 );
ProcessSelectionDialog( QWidget *parent=nullptr );
~ProcessSelectionDialog() override;
long int pidSelected();
QSize sizeHint() const override;
......
......@@ -112,7 +112,7 @@ bool MICommand::invokeHandler(const ResultRecord& r)
if (autoDelete) {
delete commandHandler_;
}
commandHandler_ = 0;
commandHandler_ = nullptr;
return true;
} else {
return false;
......
......@@ -49,7 +49,7 @@ using namespace KDevMI::MI;
} while (0)
MIParser::MIParser()
: m_lex(0)
: m_lex(nullptr)
{
}
......@@ -59,11 +59,11 @@ MIParser::~MIParser()
std::unique_ptr<Record> MIParser::parse(FileSymbol *file)
{
m_lex = 0;
m_lex = nullptr;
TokenStream *tokenStream = m_lexer.tokenize(file);
if (!tokenStream)
return 0;
return nullptr;
m_lex = file->tokenStream = tokenStream;
......@@ -192,7 +192,7 @@ bool MIParser::parseResult(Result *&result)
m_lex->nextToken();
}
Value *value = 0;
Value *value = nullptr;
if (!parseValue(value))
return false;
......@@ -204,7 +204,7 @@ bool MIParser::parseResult(Result *&result)
bool MIParser::parseValue(Value *&value)
{
value = 0;
value = nullptr;
switch (m_lex->lookAhead()) {
case Token_string_literal: {
......@@ -247,8 +247,8 @@ bool MIParser::parseList(Value *&value)
// that out too using function pointers.
int tok = m_lex->lookAhead();
while (tok && tok != ']') {
Result *result = 0;
Value *val = 0;
Result *result = nullptr;
Value *val = nullptr;
if (tok == Token_identifier)
{
......
......@@ -158,7 +158,7 @@ struct MIBreakpointController::InsertedHandler : public MIBreakpointController::
struct MIBreakpointController::DeleteHandler : MIBreakpointController::Handler {
DeleteHandler(MIBreakpointController* c, const BreakpointDataPtr& b)
: Handler(c, b, 0) {}
: Handler(c, b, nullptr) {}
void handle(const ResultRecord&) override
{
......
......@@ -95,7 +95,7 @@ void MIDebugger::execute(MICommand* command)
bool MIDebugger::isReady() const
{
return currentCmd_ == 0;
return currentCmd_ == nullptr;
}
void MIDebugger::interrupt()
......
......@@ -45,7 +45,7 @@ class MIDebugger : public QObject
{
Q_OBJECT
public:
explicit MIDebugger(QObject* parent = 0);
explicit MIDebugger(QObject* parent = nullptr);
~MIDebugger() override;
/** Starts the debugger. This should be done after connecting to all
......
......@@ -124,7 +124,7 @@ public:
: m_plugin(plugin), m_id(id), m_defaultArea(defaultArea)
{}
QWidget* create(QWidget *parent = 0) override
QWidget* create(QWidget *parent = nullptr) override
{
return new T(m_plugin, parent);
}
......
......@@ -43,7 +43,7 @@ class MIDebugJob : public KDevelop::OutputJob
Q_OBJECT
public:
MIDebugJob(MIDebuggerPlugin* p, KDevelop::ILaunchConfiguration* launchcfg, IExecutePlugin* plugin,
QObject* parent = 0);
QObject* parent = nullptr);
void start() override;
protected:
......
......@@ -1252,7 +1252,7 @@ void MIDebugSession::handleNoInferior(const QString& msg)
// will continiously bomd STTY with signals, so we need to either disable
// QSocketNotifier, or delete STTY. The latter is simpler, since we can't
// reuse it for future debug sessions anyway.
m_tty.reset(0);
m_tty.reset(nullptr);
}
stopDebugger();
......
......@@ -188,7 +188,7 @@ public Q_SLOTS:
public:
virtual MI::MICommand *createCommand(MI::CommandType type, const QString& arguments,
MI::CommandFlags flags = 0) const;
MI::CommandFlags flags = nullptr) const;
virtual MI::MICommand *createUserCommand(const QString &cmd) const;
/** Adds a command to the end of queue of commands to be executed
by debugger. The command will be actually sent to debugger only when
......@@ -205,21 +205,21 @@ public:
/** Same as above, but internally constructs MICommand using createCommand() */
void addCommand(MI::CommandType type, const QString& arguments = QString(),
MI::CommandFlags flags = 0);
MI::CommandFlags flags = nullptr);
void addCommand(MI::CommandType type, const QString& arguments,
MI::MICommandHandler* handler,
MI::CommandFlags flags = 0);
MI::CommandFlags flags = nullptr);
void addCommand(MI::CommandType type, const QString& arguments,
const MI::FunctionCommandHandler::Function& callback,
MI::CommandFlags flags = 0);
MI::CommandFlags flags = nullptr);
template<class Handler>
void addCommand(MI::CommandType type, const QString& arguments,
Handler* handler_this,
void (Handler::* handler_method)(const MI::ResultRecord&),
MI::CommandFlags flags = 0);
MI::CommandFlags flags = nullptr);
QMap<QString, MIVariable*> & variableMapping();
MIVariable* findVariableByVarobjName(const QString &varobjName) const;
......
......@@ -65,7 +65,7 @@ private:
using namespace KDevMI;
ModelsManager::ModelsManager(QObject* parent) : QObject(parent), m_models(new Models), m_controller(0), m_config(KSharedConfig::openConfig()->group("Register models")) {}
ModelsManager::ModelsManager(QObject* parent) : QObject(parent), m_models(new Models), m_controller(nullptr), m_config(KSharedConfig::openConfig()->group("Register models")) {}
ModelsManager::~ModelsManager() {}
......@@ -166,7 +166,7 @@ QStandardItemModel* Models::addModel(const Model& m)
m_models.append(m);
return m.model.data();
}
return 0;
return nullptr;
}
bool Models::contains(const QString& name) const
......@@ -206,7 +206,7 @@ QStandardItemModel* Models::modelForName(const QString& name) const
return m.model.data();
}
}
return 0;
return nullptr;
}
QStandardItemModel* Models::modelForView(QAbstractItemView* view) const
......@@ -216,7 +216,7 @@ QStandardItemModel* Models::modelForView(QAbstractItemView* view) const
return m.model.data();
}
}
return 0;
return nullptr;
}
void ModelsManager::itemChanged(QStandardItem* i)
......
......@@ -47,7 +47,7 @@ class ModelsManager : public QObject
Q_OBJECT
public:
explicit ModelsManager(QObject* parent = 0);
explicit ModelsManager(QObject* parent = nullptr);
~ModelsManager() override;
......
......@@ -218,7 +218,7 @@ void IRegisterController::updateValuesForRegisters(RegistersGroup* registers) co
void IRegisterController::setFlagRegister(const Register& reg, const FlagRegister& flag)
{
quint32 flagsValue = registerValue(flag.registerName).toUInt(0, 16);
quint32 flagsValue = registerValue(flag.registerName).toUInt(nullptr, 16);
const int idx = flag.flags.indexOf(reg.name);
......@@ -251,7 +251,7 @@ IRegisterController::~IRegisterController() {}
void IRegisterController::updateFlagValues(RegistersGroup* flagsGroup, const FlagRegister& flagRegister) const
{
const quint32 flagsValue = registerValue(flagRegister.registerName).toUInt(0, 16);
const quint32 flagsValue = registerValue(flagRegister.registerName).toUInt(nullptr, 16);
for (int idx = 0; idx < flagRegister.flags.count(); idx++) {
flagsGroup->registers[idx].value = ((flagsValue >> flagRegister.bits[idx].toInt()) & 1) ? "1" : "0";
......
......@@ -157,7 +157,7 @@ public slots:
virtual void setRegisterValue(const Register& reg);
protected:
IRegisterController(MIDebugSession* debugSession = 0, QObject* parent = 0);
IRegisterController(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
///Returns registers from the @p group, or empty registers group if @p group is invalid.
virtual RegistersGroup registersFromGroup(const GroupsName& group) const = 0;
......
......@@ -78,12 +78,12 @@ void ArchitectureParser::determineArchitecture(MIDebugSession* debugSession)
}
RegistersManager::RegistersManager(QWidget* parent)
: QObject(parent), m_registersView(new RegistersView(parent)), m_registerController(0), m_architectureParser(new ArchitectureParser(this)), m_debugSession(0), m_modelsManager(new ModelsManager(this)), m_currentArchitecture(undefined), m_needToCheckArch(false)
: QObject(parent), m_registersView(new RegistersView(parent)), m_registerController(nullptr), m_architectureParser(new ArchitectureParser(this)), m_debugSession(nullptr), m_modelsManager(new ModelsManager(this)), m_currentArchitecture(undefined), m_needToCheckArch(false)
{
connect(m_architectureParser, &ArchitectureParser::architectureParsed, this, &RegistersManager::architectureParsedSlot);
m_registersView->setModel(m_modelsManager);
setController(0);
setController(nullptr);
}
void RegistersManager::architectureParsedSlot(Architecture arch)
......@@ -132,7 +132,7 @@ void RegistersManager::setSession(MIDebugSession* debugSession)
if (!m_debugSession) {
qCDebug(DEBUGGERCOMMON) << "Will reparse arch";
m_needToCheckArch = true;
setController(0);
setController(nullptr);
}
}
......@@ -146,7 +146,7 @@ void RegistersManager::updateRegisters()
if (m_needToCheckArch) {
m_needToCheckArch = false;
m_currentArchitecture = undefined;
setController(0);
setController(nullptr);
}
if (m_currentArchitecture == undefined) {
m_architectureParser->determineArchitecture(m_debugSession);
......
......@@ -38,7 +38,7 @@ const int TABLES_COUNT = 5;
}
RegistersView::RegistersView(QWidget* p)
: QWidget(p), m_menu(new QMenu(this)), m_mapper(new QSignalMapper(this)), m_modelsManager(0)
: QWidget(p), m_menu(new QMenu(this)), m_mapper(new QSignalMapper(this)), m_modelsManager(nullptr)
{
setupUi(this);
......@@ -145,7 +145,7 @@ QAction* RegistersView::findAction(const QString& name)
return a;
}
}
return 0;
return nullptr;
}
void RegistersView::addView(QTableView* view, int idx)
......
......@@ -38,7 +38,7 @@ class RegistersView : public QWidget, private Ui::RegistersView
Q_OBJECT
public:
RegistersView(QWidget* p = 0);
RegistersView(QWidget* p = nullptr);
void enable(bool enabled);
......
......@@ -97,7 +97,7 @@ static int chownpty(int fd, int grant)
::exit(1);
QString path = QStandardPaths::findExecutable(BASE_CHOWN);
execle(QFile::encodeName(path), BASE_CHOWN, grant?"--grant":"--revoke", (void *)0, NULL);
execle(QFile::encodeName(path), BASE_CHOWN, grant?"--grant":"--revoke", (void *)nullptr, NULL);
::exit(1); // should not be reached
}
if (pid > 0) {
......@@ -124,9 +124,9 @@ static int chownpty(int fd, int grant)
STTY::STTY(bool ext, const QString &termAppName)
: QObject(),
out(0),
out(nullptr),
ttySlave(""),
m_externalTerminal(0),
m_externalTerminal(nullptr),
external_(ext)
{
if (ext) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment