Commit c4dcb3f2 authored by Anton Anikin's avatar Anton Anikin
Browse files

Next step for use-nullptr

Summary:
The patch continues use-nullptr migration with changes for some parts of code which was not fixed by clang-tidy.

Unfortunately it's not possible now to enable "-Wzero-as-null-pointer-constant" flag without adding many ugly fixes to code. It causes by warnings/errors produced by this flag for 3rd-party, non-KDevelop code such a KF5, Qt which still use old-style zeroes instead nullptr.

Reviewers: #kdevelop, kfunk

Reviewed By: #kdevelop, kfunk

Subscribers: kdevelop-devel

Differential Revision: https://phabricator.kde.org/D3092
parent 2a2e0341
......@@ -32,7 +32,7 @@ namespace KDevMI {
class SelectCoreDialog : public QDialog
{
public:
SelectCoreDialog(QWidget *parent = 0);
SelectCoreDialog(QWidget *parent = nullptr);
QUrl binary() const;
QUrl core() const;
......
......@@ -241,8 +241,8 @@ namespace KDevMI { namespace MI {
*/
struct Result
{
Result() : value(0) {}
~Result() { delete value; value = 0; }
Result() : value(nullptr) {}
~Result() { delete value; value = nullptr; }
QString variable;
Value *value;
......
......@@ -82,7 +82,7 @@ class FunctionCommandHandler : public MICommandHandler {
public:
typedef std::function<void (const ResultRecord&)> Function;
FunctionCommandHandler(const Function& callback, CommandFlags flags = 0);
FunctionCommandHandler(const Function& callback, CommandFlags flags = nullptr);
virtual void handle(const ResultRecord&) override;
virtual bool handlesError() override;
......@@ -99,7 +99,7 @@ private:
class MICommand
{
protected:
MICommand(CommandType type, const QString& arguments = QString(), CommandFlags flags = 0);
MICommand(CommandType type, const QString& arguments = QString(), CommandFlags flags = nullptr);
friend class KDevMI::MIDebugSession;
public:
......@@ -254,7 +254,7 @@ public:
CliCommand(CommandType type, const QString& command,
Handler* handler_this,
void (Handler::* handler_method)(const QStringList&),
CommandFlags flags = 0);
CommandFlags flags = nullptr);
};
/** Command that does nothing and can be just used to invoke
......@@ -269,7 +269,7 @@ public:
template<class Handler>
SentinelCommand(Handler* handler_this,
void (Handler::* handler_method)(),
CommandFlags flags = 0)
CommandFlags flags = nullptr)
: MICommand(NonMI, QString(), flags)
{
QPointer<Handler> guarded_this(handler_this);
......@@ -280,7 +280,7 @@ public:
};
}
SentinelCommand(const Function& handler, CommandFlags flags = 0)
SentinelCommand(const Function& handler, CommandFlags flags = nullptr)
: MICommand(NonMI, QString(), flags)
, handler(handler)
{
......
......@@ -44,7 +44,7 @@ struct FileSymbol
TokenStream *tokenStream;
inline FileSymbol()
: tokenStream(0) {}
: tokenStream(nullptr) {}
inline ~FileSymbol();
};
......@@ -142,7 +142,7 @@ private:
inline FileSymbol::~FileSymbol()
{
delete tokenStream;
tokenStream = 0;
tokenStream = nullptr;
}
} // end of MI
......
......@@ -101,7 +101,7 @@ private:
void createFromDebugger(const MI::Value& miBkpt);
void updateFromDebugger(int row, const MI::Value& miBkpt,
KDevelop::BreakpointModel::ColumnFlags lockedColumns = 0);
KDevelop::BreakpointModel::ColumnFlags lockedColumns = nullptr);
int rowFromDebuggerId(int gdbId) const;
......
......@@ -31,7 +31,7 @@ class RegisterController_Arm : public IRegisterController
{
public:
RegisterController_Arm(MIDebugSession* debugSession = 0, QObject* parent = 0);
RegisterController_Arm(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
virtual QVector<GroupsName> namesOfRegisterGroups() const override;
......
......@@ -36,7 +36,7 @@ public slots:
virtual void updateRegisters(const GroupsName& group = GroupsName()) override;
protected:
RegisterControllerGeneral_x86(MIDebugSession* debugSession = 0, QObject* parent = 0);
RegisterControllerGeneral_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
virtual RegistersGroup registersFromGroup(const GroupsName& group) const override;
......@@ -71,7 +71,7 @@ class RegisterController_x86 : public RegisterControllerGeneral_x86
{
public:
RegisterController_x86(MIDebugSession* debugSession = 0, QObject* parent = 0);
RegisterController_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
private:
void initRegisterNames();
......@@ -81,7 +81,7 @@ class RegisterController_x86_64 : public RegisterControllerGeneral_x86
{
public:
RegisterController_x86_64(MIDebugSession* debugSession = 0, QObject* parent = 0);
RegisterController_x86_64(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
private:
void initRegisterNames();
......
......@@ -42,7 +42,7 @@ namespace GDB
{
Q_OBJECT
public:
MemoryViewerWidget(CppDebuggerPlugin* plugin, QWidget* parent = 0);
MemoryViewerWidget(CppDebuggerPlugin* plugin, QWidget* parent = nullptr);
public Q_SLOTS:
/** Adds a new memory view. */
......
......@@ -36,7 +36,7 @@ class LldbCommand : public MI::MICommand
{
protected:
LldbCommand(MI::CommandType type, const QString& arguments = QString(),
MI::CommandFlags flags = 0);
MI::CommandFlags flags = nullptr);
friend class KDevMI::LLDB::DebugSession;
public:
~LldbCommand();
......
......@@ -74,7 +74,7 @@ class HelpNetworkAccessManager : public QNetworkAccessManager
protected:
virtual QNetworkReply *createRequest(Operation op,
const QNetworkRequest &request, QIODevice *outgoingData = 0) override;
const QNetworkRequest &request, QIODevice *outgoingData = nullptr) override;
private:
QHelpEngineCore *m_helpEngine;
......
......@@ -39,7 +39,7 @@ public:
ClangParsingEnvironmentFile(ClangParsingEnvironmentFileData& data);
~ClangParsingEnvironmentFile();
virtual bool needsUpdate(const KDevelop::ParsingEnvironment* environment = 0) const override;
virtual bool needsUpdate(const KDevelop::ParsingEnvironment* environment = nullptr) const override;
virtual int type() const override;
virtual bool matchEnvironment(const KDevelop::ParsingEnvironment* environment) const override;
......
......@@ -261,7 +261,7 @@ constexpr const char* delayedTypeName(CXTypeKind TK)
: TK == CXType_ObjCId ? "id"
: TK == CXType_ObjCSel ? "SEL"
: TK == CXType_NullPtr ? "nullptr_t"
: 0;
: nullptr;
}
}
......
......@@ -33,7 +33,7 @@ class CMakeDoc : public KDevelop::IDocumentation
virtual QString name() const override { return mName; }
virtual KDevelop::IDocumentationProvider* provider() const override;
virtual QWidget* documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent = 0) override;
virtual QWidget* documentationWidget(KDevelop::DocumentationFindWidget* findWidget, QWidget* parent = nullptr) override;
static CMakeDocumentation* s_provider;
......
......@@ -33,7 +33,7 @@ public:
virtual KDevelop::RangeInRevision editorFindRange(CMakeContentIterator* fromNode, CMakeContentIterator* toNode) override;
virtual KDevelop::QualifiedIdentifier identifierForNode(CMakeFunctionDesc* node) override;
virtual void setContextOnNode(CMakeContentIterator* node, KDevelop::DUContext* context) override;
virtual KDevelop::TopDUContext* newTopContext(const KDevelop::RangeInRevision& range, KDevelop::ParsingEnvironmentFile* file = 0) override;
virtual KDevelop::TopDUContext* newTopContext(const KDevelop::RangeInRevision& range, KDevelop::ParsingEnvironmentFile* file = nullptr) override;
};
#endif // CONTEXTBUILDER_H
......@@ -42,7 +42,7 @@ class CustomBuildSystem : public KDevelop::AbstractFileManagerPlugin, public KDe
Q_INTERFACES( KDevelop::IProjectFileManager )
Q_INTERFACES( KDevelop::IBuildSystemManager )
public:
explicit CustomBuildSystem( QObject *parent = 0, const QVariantList &args = QVariantList() );
explicit CustomBuildSystem( QObject *parent = nullptr, const QVariantList &args = QVariantList() );
virtual ~CustomBuildSystem();
// ProjectBuilder API
......@@ -65,7 +65,7 @@ signals:
public:
Features features() const override;
virtual KDevelop::ProjectFolderItem* createFolderItem( KDevelop::IProject* project,
const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent = 0 ) override;
const KDevelop::Path& path, KDevelop::ProjectBaseItem* parent = nullptr ) override;
// BuildSystemManager API
public:
......
......@@ -67,7 +67,7 @@ void classname::funcname()\
#define ENDTESTFUNCIMPL }
#define TESTASSIGNMENT( ast, var, opval, valcount ) \
QVERIFY( ast != 0 );\
QVERIFY( ast != nullptr );\
QVERIFY( ast->identifier->value == var );\
QVERIFY( ast->op->value == opval );\
QVERIFY( ast->values.count() == valcount );
......@@ -100,7 +100,7 @@ void classname::funcname()\
}
#define TESTSCOPEBODY( scope, teststmts, stmtcount ) \
QVERIFY( scope->body != 0 ); \
QVERIFY( scope->body != nullptr ); \
QVERIFY( scope->body->statements.count() == stmtcount ); \
matchScopeBodies(scope->body->statements, teststmts);
......
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