Commit 15229ebe authored by Kevin Funk's avatar Kevin Funk

Use explicit constructors where possible

parent 83fb87ed
......@@ -43,7 +43,7 @@ class Job : public KDevelop::OutputExecuteJob
Q_OBJECT
public:
Job(const Parameters& params, QObject* parent = nullptr);
explicit Job(const Parameters& params, QObject* parent = nullptr);
~Job() override;
void start() override;
......
......@@ -42,7 +42,7 @@ class Plugin : public KDevelop::IPlugin
Q_OBJECT
public:
Plugin(QObject* parent, const QVariantList& = QVariantList());
explicit Plugin(QObject* parent, const QVariantList& = QVariantList());
~Plugin() override;
......
......@@ -39,7 +39,7 @@ public:
* Parses a file path argument and determines its line number and column and full path
* @param path path passed on e.g. command line to parse into an URL
*/
UrlInfo(QString path = QString())
explicit UrlInfo(QString path = QString())
: cursor(KTextEditor::Cursor::invalid())
{
/**
......
......@@ -32,7 +32,7 @@ class ProcessSelectionDialog : public QDialog
{
Q_OBJECT
public:
ProcessSelectionDialog( QWidget *parent=nullptr );
explicit ProcessSelectionDialog( QWidget *parent=nullptr );
~ProcessSelectionDialog() override;
long int pidSelected();
QSize sizeHint() const override;
......
......@@ -32,7 +32,7 @@ namespace KDevMI {
class SelectCoreDialog : public QDialog
{
public:
SelectCoreDialog(QWidget *parent = nullptr);
explicit SelectCoreDialog(QWidget *parent = nullptr);
QUrl binary() const;
QUrl core() const;
......
......@@ -250,7 +250,7 @@ namespace KDevMI { namespace MI {
struct StringLiteralValue : public Value
{
StringLiteralValue(const QString &lit)
explicit StringLiteralValue(const QString &lit)
: literal_(lit) { Value::kind = StringLiteral; }
public: // Value overrides
......@@ -305,7 +305,7 @@ namespace KDevMI { namespace MI {
struct ResultRecord : public TupleRecord
{
ResultRecord(const QString& reason)
explicit ResultRecord(const QString& reason)
: token(0)
, reason(reason)
{
......@@ -357,7 +357,7 @@ namespace KDevMI { namespace MI {
Log
};
StreamRecord(Subkind subkind)
explicit StreamRecord(Subkind subkind)
: subkind(subkind)
{
Record::kind = Stream;
......
......@@ -82,7 +82,7 @@ class FunctionCommandHandler : public MICommandHandler {
public:
typedef std::function<void (const ResultRecord&)> Function;
FunctionCommandHandler(const Function& callback, CommandFlags flags = nullptr);
explicit FunctionCommandHandler(const Function& callback, CommandFlags flags = nullptr);
void handle(const ResultRecord&) override;
bool handlesError() override;
......@@ -99,7 +99,7 @@ private:
class MICommand
{
protected:
MICommand(CommandType type, const QString& arguments = QString(), CommandFlags flags = nullptr);
explicit MICommand(CommandType type, const QString& arguments = QString(), CommandFlags flags = nullptr);
friend class KDevMI::MIDebugSession;
public:
......@@ -280,7 +280,7 @@ public:
};
}
SentinelCommand(const Function& handler, CommandFlags flags = nullptr)
explicit SentinelCommand(const Function& handler, CommandFlags flags = nullptr)
: MICommand(NonMI, QString(), flags)
, handler(handler)
{
......
......@@ -167,7 +167,7 @@ struct MIBreakpointController::DeleteHandler : MIBreakpointController::Handler {
};
struct MIBreakpointController::IgnoreChanges {
IgnoreChanges(MIBreakpointController& controller)
explicit IgnoreChanges(MIBreakpointController& controller)
: controller(controller)
{
++controller.m_ignoreChanges;
......
......@@ -64,7 +64,7 @@ class MIBreakpointController : public KDevelop::IBreakpointController
{
Q_OBJECT
public:
MIBreakpointController(MIDebugSession* parent);
explicit MIBreakpointController(MIDebugSession* parent);
using IBreakpointController::breakpointModel;
......
......@@ -66,7 +66,7 @@ class MIExamineCoreJob : public KJob
{
Q_OBJECT
public:
MIExamineCoreJob(MIDebuggerPlugin *plugin, QObject *parent = nullptr);
explicit MIExamineCoreJob(MIDebuggerPlugin *plugin, QObject *parent = nullptr);
void start() override;
......
......@@ -34,7 +34,7 @@ class MIDebugSession;
class MIFrameStackModel : public KDevelop::FrameStackModel
{
public:
MIFrameStackModel( MIDebugSession* session);
explicit MIFrameStackModel( MIDebugSession* session);
MIDebugSession* session();
......
......@@ -321,7 +321,7 @@ QString MIVariable::enquotedExpression() const
class SetFormatHandler : public MICommandHandler
{
public:
SetFormatHandler(MIVariable *var)
explicit SetFormatHandler(MIVariable *var)
: m_variable(var)
{}
......
......@@ -110,7 +110,7 @@ void MIVariableController::handleVarUpdate(const ResultRecord& r)
class StackListArgumentsHandler : public MICommandHandler
{
public:
StackListArgumentsHandler(QStringList localsName)
explicit StackListArgumentsHandler(QStringList localsName)
: m_localsName(localsName)
{}
......@@ -139,7 +139,7 @@ private:
class StackListLocalsHandler : public MICommandHandler
{
public:
StackListLocalsHandler(MIDebugSession *session)
explicit StackListLocalsHandler(MIDebugSession *session)
: m_session(session)
{}
......
......@@ -42,7 +42,7 @@ class MIVariableController : public KDevelop::IVariableController
Q_OBJECT
public:
MIVariableController( MIDebugSession* parent);
explicit MIVariableController( MIDebugSession* parent);
KDevelop::Variable* createVariable(KDevelop::TreeModel* model, KDevelop::TreeItem* parent,
const QString& expression,
......
......@@ -157,7 +157,7 @@ public slots:
virtual void setRegisterValue(const Register& reg);
protected:
IRegisterController(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
explicit 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;
......
......@@ -31,7 +31,7 @@ class RegisterController_Arm : public IRegisterController
{
public:
RegisterController_Arm(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
explicit RegisterController_Arm(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
QVector<GroupsName> namesOfRegisterGroups() const override;
......
......@@ -36,7 +36,7 @@ public slots:
void updateRegisters(const GroupsName& group = GroupsName()) override;
protected:
RegisterControllerGeneral_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
explicit RegisterControllerGeneral_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
RegistersGroup registersFromGroup(const GroupsName& group) const override;
......@@ -71,7 +71,7 @@ class RegisterController_x86 : public RegisterControllerGeneral_x86
{
public:
RegisterController_x86(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
explicit 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 = nullptr, QObject* parent = nullptr);
explicit RegisterController_x86_64(MIDebugSession* debugSession = nullptr, QObject* parent = nullptr);
private:
void initRegisterNames();
......
......@@ -46,7 +46,7 @@ class ArchitectureParser : public QObject
public:
ArchitectureParser(QObject* parent);
explicit ArchitectureParser(QObject* parent);
///Asynchronously determines current architecture. emits @p architectureParsed when ready.
void determineArchitecture(MIDebugSession* debugSession);
......@@ -68,7 +68,7 @@ class RegistersManager : public QObject
Q_OBJECT
public:
RegistersManager(QWidget* parent);
explicit RegistersManager(QWidget* parent);
public Q_SLOTS:
void setSession(MIDebugSession* debugSession);
......
......@@ -38,7 +38,7 @@ class RegistersView : public QWidget, private Ui::RegistersView
Q_OBJECT
public:
RegistersView(QWidget* p = nullptr);
explicit RegistersView(QWidget* p = nullptr);
void enable(bool enabled);
......
......@@ -39,7 +39,7 @@ class STTY : public QObject
Q_OBJECT
public:
STTY(bool ext=false, const QString &termAppName=QString());
explicit STTY(bool ext=false, const QString &termAppName=QString());
~STTY() override;
///Call it if getSlave returns an empty string.
......
......@@ -52,7 +52,7 @@ class DebuggerConsoleView : public QWidget
{
Q_OBJECT
public:
DebuggerConsoleView(MIDebuggerPlugin *plugin, QWidget *parent = nullptr);
explicit DebuggerConsoleView(MIDebuggerPlugin *plugin, QWidget *parent = nullptr);
~DebuggerConsoleView();
/**
......
......@@ -51,7 +51,7 @@ class SelectAddressDialog : public QDialog
{
Q_OBJECT
public:
SelectAddressDialog(QWidget *parent = nullptr);
explicit SelectAddressDialog(QWidget *parent = nullptr);
QString address() const;
void setAddress(const QString& address);
......@@ -109,7 +109,7 @@ public:
ColumnCount
};
DisassembleWidget( MIDebuggerPlugin* plugin, QWidget *parent=nullptr );
explicit DisassembleWidget( MIDebuggerPlugin* plugin, QWidget *parent=nullptr );
~DisassembleWidget() override;
Q_SIGNALS:
......
......@@ -67,7 +67,7 @@ class CppDebuggerPlugin : public MIDebuggerPlugin
public:
friend class DebugSession;
CppDebuggerPlugin(QObject *parent, const QVariantList & = QVariantList());
explicit CppDebuggerPlugin(QObject *parent, const QVariantList & = QVariantList());
~CppDebuggerPlugin() override;
DebugSession *createSession() override;
......
......@@ -33,7 +33,7 @@ class BreakpointController : public MIBreakpointController
Q_OBJECT
public:
BreakpointController(DebugSession *parent);
explicit BreakpointController(DebugSession *parent);
private:
};
......
......@@ -58,7 +58,7 @@ class GdbConfigPage : public KDevelop::LaunchConfigurationPage
{
Q_OBJECT
public:
GdbConfigPage( QWidget* parent = nullptr );
explicit GdbConfigPage( QWidget* parent = nullptr );
~GdbConfigPage() override;
QIcon icon() const override;
void loadFromConfiguration(const KConfigGroup& cfg, KDevelop::IProject* = nullptr) override;
......
......@@ -32,7 +32,7 @@ class GdbFrameStackModel : public KDevMI::MIFrameStackModel
{
Q_OBJECT
public:
GdbFrameStackModel(DebugSession* session);
explicit GdbFrameStackModel(DebugSession* session);
DebugSession* session();
};
......
......@@ -51,7 +51,7 @@ class GDBOutputWidget : public QWidget
Q_OBJECT
public:
GDBOutputWidget(CppDebuggerPlugin* plugin, QWidget *parent=nullptr );
explicit GDBOutputWidget(CppDebuggerPlugin* plugin, QWidget *parent=nullptr );
~GDBOutputWidget() override;
void savePartialProjectSession();
......@@ -144,7 +144,7 @@ class OutputTextEdit : public QTextEdit
Q_OBJECT
public:
OutputTextEdit(GDBOutputWidget* parent);
explicit OutputTextEdit(GDBOutputWidget* parent);
protected:
void contextMenuEvent(QContextMenuEvent* event) override;
......
......@@ -42,7 +42,7 @@ namespace GDB
{
Q_OBJECT
public:
MemoryViewerWidget(CppDebuggerPlugin* plugin, QWidget* parent = nullptr);
explicit MemoryViewerWidget(CppDebuggerPlugin* plugin, QWidget* parent = nullptr);
public Q_SLOTS:
/** Adds a new memory view. */
......@@ -65,7 +65,7 @@ namespace GDB
{
Q_OBJECT
public:
MemoryView(QWidget* parent);
explicit MemoryView(QWidget* parent);
void debuggerStateChanged(DBGStateFlags state);
......
......@@ -8,7 +8,7 @@
#include <QDebug>
struct A {
A(const QString& _a = QString(), const QString& _b = QString(),
explicit A(const QString& _a = QString(), const QString& _b = QString(),
int _c = -1, int _d = -1)
: a(_a), b(_b), c(_c), d(_d)
{}
......
......@@ -31,7 +31,7 @@ const QString BINARY_PATH(PRINTER_BIN_DIR);
class GdbProcess : private QProcess
{
public:
GdbProcess(const QString &program) : QProcess()
explicit GdbProcess(const QString &program) : QProcess()
{
setProcessChannelMode(MergedChannels);
// don't attempt to load .gdbinit in home (may cause unexpected results)
......
......@@ -140,7 +140,7 @@ public:
class TestLaunchConfiguration : public KDevelop::ILaunchConfiguration
{
public:
TestLaunchConfiguration(const QUrl& executable = findExecutable("debugee"),
explicit TestLaunchConfiguration(const QUrl& executable = findExecutable("debugee"),
const QUrl& workingDirectory = QUrl()) {
qDebug() << "FIND" << executable;
c = new KConfig();
......@@ -169,7 +169,7 @@ class TestFrameStackModel : public GdbFrameStackModel
{
public:
TestFrameStackModel(DebugSession* session)
explicit TestFrameStackModel(DebugSession* session)
: GdbFrameStackModel(session), fetchFramesCalled(0), fetchThreadsCalled(0) {}
int fetchFramesCalled;
......
......@@ -33,7 +33,7 @@ class VariableController : public MIVariableController
Q_OBJECT
public:
VariableController(DebugSession* parent);
explicit VariableController(DebugSession* parent);
private:
DebugSession* debugSession() const;
......
......@@ -33,7 +33,7 @@ class BreakpointController : public MIBreakpointController
Q_OBJECT
public:
BreakpointController(DebugSession *parent);
explicit BreakpointController(DebugSession *parent);
private:
};
......
......@@ -38,7 +38,7 @@ class LldbFrameStackModel : public MIFrameStackModel
{
Q_OBJECT
public:
LldbFrameStackModel(DebugSession* session);
explicit LldbFrameStackModel(DebugSession* session);
DebugSession* session();
......
......@@ -34,7 +34,7 @@ class VariableController : public MIVariableController
Q_OBJECT
public:
VariableController(DebugSession* parent);
explicit VariableController(DebugSession* parent);
void update() override;
LldbVariable* createVariable(KDevelop::TreeModel* model, KDevelop::TreeItem* parent,
......
......@@ -34,7 +34,7 @@ namespace KDevMI { namespace LLDB {
class NonInterruptDebuggerConsoleView : public DebuggerConsoleView
{
public:
NonInterruptDebuggerConsoleView(MIDebuggerPlugin *plugin, QWidget *parent = nullptr)
explicit NonInterruptDebuggerConsoleView(MIDebuggerPlugin *plugin, QWidget *parent = nullptr)
: DebuggerConsoleView(plugin, parent)
{
setShowInterrupt(false);
......@@ -49,7 +49,7 @@ class LldbDebuggerPlugin : public MIDebuggerPlugin
public:
friend class KDevMI::LLDB::DebugSession;
LldbDebuggerPlugin(QObject *parent, const QVariantList & = QVariantList());
explicit LldbDebuggerPlugin(QObject *parent, const QVariantList & = QVariantList());
~LldbDebuggerPlugin() override;
DebugSession *createSession() override;
......
......@@ -57,7 +57,7 @@ using namespace KDevelop;
struct ExecRunHandler : public MICommandHandler
{
ExecRunHandler(DebugSession *session, int maxRetry = 5)
explicit ExecRunHandler(DebugSession *session, int maxRetry = 5)
: m_session(session)
, m_remainRetry(maxRetry)
, m_activeCommands(1)
......
......@@ -35,7 +35,7 @@ class DebugSession;
class LldbCommand : public MI::MICommand
{
protected:
LldbCommand(MI::CommandType type, const QString& arguments = QString(),
explicit LldbCommand(MI::CommandType type, const QString& arguments = QString(),
MI::CommandFlags flags = nullptr);
friend class KDevMI::LLDB::DebugSession;
public:
......
......@@ -8,7 +8,7 @@
#include <QDebug>
struct A {
A(const QString& _a = QString(), const QString& _b = QString(),
explicit A(const QString& _a = QString(), const QString& _b = QString(),
int _c = -1, int _d = -1)
: a(_a), b(_b), c(_c), d(_d)
{}
......
......@@ -95,7 +95,7 @@ public:
class TestLaunchConfiguration : public ILaunchConfiguration
{
public:
TestLaunchConfiguration(const QUrl& executable = findExecutable("lldb_debugee"),
explicit TestLaunchConfiguration(const QUrl& executable = findExecutable("lldb_debugee"),
const QUrl& workingDirectory = QUrl()) {
qDebug() << "FIND" << executable;
c = new KConfig();
......@@ -124,7 +124,7 @@ class TestFrameStackModel : public LldbFrameStackModel
{
public:
TestFrameStackModel(DebugSession* session)
explicit TestFrameStackModel(DebugSession* session)
: LldbFrameStackModel(session), fetchFramesCalled(0), fetchThreadsCalled(0) {}
void fetchFrames(int threadNumber, int from, int to) override
......
......@@ -74,7 +74,7 @@ using namespace KDevMI::LLDB;
class TestLaunchConfiguration : public ILaunchConfiguration
{
public:
TestLaunchConfiguration(const QString& executable,
explicit TestLaunchConfiguration(const QString& executable,
const QUrl& workingDirectory = QUrl()) {
auto execPath = findExecutable(executable);
qDebug() << "FIND" << execPath;
......
......@@ -34,7 +34,7 @@ class LldbConfigPage : public KDevelop::LaunchConfigurationPage
{
Q_OBJECT
public:
LldbConfigPage( QWidget* parent = nullptr );
explicit LldbConfigPage( QWidget* parent = nullptr );
~LldbConfigPage() override;
QIcon icon() const override;
......
......@@ -37,7 +37,7 @@ class ManPageModel : public QAbstractItemModel
Q_OBJECT
public:
ManPageModel(QObject* parent = nullptr);
explicit ManPageModel(QObject* parent = nullptr);
~ManPageModel() override;
/**
......
......@@ -36,7 +36,7 @@ class ManPagePlugin : public KDevelop::IPlugin, public KDevelop::IDocumentationP
Q_OBJECT
Q_INTERFACES( KDevelop::IDocumentationProvider )
public:
ManPagePlugin(QObject *parent, const QVariantList & args= QVariantList());
explicit ManPagePlugin(QObject *parent, const QVariantList & args= QVariantList());
~ManPagePlugin() override;
KDevelop::IDocumentation::Ptr documentationForDeclaration (KDevelop::Declaration* dec) const override;
QAbstractListModel* indexModel() const override;
......
......@@ -83,7 +83,7 @@ qint64 HelpNetworkReply::readData(char *buffer, qint64 maxlen)
class HelpNetworkAccessManager : public QNetworkAccessManager
{
public:
HelpNetworkAccessManager(QHelpEngineCore *engine, QObject *parent = nullptr)
explicit HelpNetworkAccessManager(QHelpEngineCore *engine, QObject *parent = nullptr)
: QNetworkAccessManager(parent), m_helpEngine(engine) {}
protected:
......
......@@ -33,7 +33,7 @@ class AStylePreferences : public KDevelop::SettingsWidget, public Ui::AStylePref
public:
enum Language { CPP, Java, CSharp};
AStylePreferences(Language lang=CPP, QWidget *parent=nullptr);
explicit AStylePreferences(Language lang=CPP, QWidget *parent=nullptr);
~AStylePreferences() override;
void load(const KDevelop::SourceFormatterStyle &style) override;
......
......@@ -32,7 +32,7 @@ Boston, MA 02110-1301, USA.
class AStyleStringIterator : public astyle::ASSourceIterator
{
public:
AStyleStringIterator(const QString &string);
explicit AStyleStringIterator(const QString &string);
virtual ~AStyleStringIterator();
bool hasMoreLines() const override;
......
......@@ -37,7 +37,7 @@ class ExecutePlasmoidPlugin : public KDevelop::IPlugin, public IExecutePlugin
Q_OBJECT
Q_INTERFACES( IExecutePlugin )
public:
ExecutePlasmoidPlugin(QObject *parent, const QVariantList & = QVariantList() );
explicit ExecutePlasmoidPlugin(QObject *parent, const QVariantList & = QVariantList() );
~ExecutePlasmoidPlugin() override;
void unload() override;
......
......@@ -34,7 +34,7 @@ class PlasmoidExecutionConfig : public KDevelop::LaunchConfigurationPage, Ui::Pl
{
Q_OBJECT
public:
PlasmoidExecutionConfig( QWidget* parent );
explicit PlasmoidExecutionConfig( QWidget* parent );
void loadFromConfiguration( const KConfigGroup& cfg, KDevelop::IProject* project = nullptr ) override;
void saveToConfiguration( KConfigGroup cfg, KDevelop::IProject* project = nullptr ) const override;
QString title() const override;
......@@ -44,7 +44,7 @@ public:
class PlasmoidLauncher : public KDevelop::ILauncher
{
public:
PlasmoidLauncher( ExecutePlasmoidPlugin* plugin );
explicit PlasmoidLauncher( ExecutePlasmoidPlugin* plugin );
QList< KDevelop::LaunchConfigurationPageFactory* > configPages() const override;
QString description() const override;
QString id() override;
......
......@@ -30,7 +30,7 @@ using namespace KDevelop;
class ClangHighlighting::Instance : public KDevelop::CodeHighlightingInstance
{
public:
Instance(const KDevelop::CodeHighlighting* highlighting);
explicit Instance(const KDevelop::CodeHighlighting* highlighting);
KDevelop::HighlightingEnumContainer::Types typeForDeclaration(KDevelop::Declaration* dec, KDevelop::DUContext* context) const override
{
......
......@@ -34,7 +34,7 @@ using namespace KDevelop;
class SessionConfigSkeleton : public KConfigSkeleton
{
public:
SessionConfigSkeleton( const QString& )
explicit SessionConfigSkeleton( const QString& )
: KConfigSkeleton( ICore::self()->activeSession()->config() )
{
}
......
......@@ -285,7 +285,7 @@ public:
return replacement;
}
ImplementsItem(const FuncImplementInfo& item)
explicit ImplementsItem(const FuncImplementInfo& item)
: DeclarationItem(item.declaration.data(), item.prototype,
i18n("Implement %1", item.isConstructor ? QStringLiteral("<constructor>") :
item.isDestructor ? QStringLiteral("<destructor>") : item.returnType),
......@@ -598,7 +598,7 @@ Declaration* classDeclarationForContext(const DUContextPointer& context, const C
class LookAheadItemMatcher
{
public:
LookAheadItemMatcher(const TopDUContextPointer& ctx)
explicit LookAheadItemMatcher(const TopDUContextPointer& ctx)
: m_topContext(ctx)
, m_enabled(ClangSettingsManager::self()->codeCompletionSettings().lookAhead)
{}
......
......@@ -220,7 +220,7 @@ QVector<KDevelop::IncludeItem> includeItemsForUrl(const QUrl& url, const Include
class IncludeFileCompletionItem : public AbstractIncludeFileCompletionItem<ClangNavigationWidget>
{
public:
IncludeFileCompletionItem(const IncludeItem& include)
explicit IncludeFileCompletionItem(const IncludeItem& include)
: AbstractIncludeFileCompletionItem<ClangNavigationWidget>(include)
{}
......