Skip to content

Commit

Permalink
Fix Clang-tidy modernize-use-nullptr warnings in include/lldb/Interpr…
Browse files Browse the repository at this point in the history
…eter; other minor fixes.

Differential Revision: http://reviews.llvm.org/D14025

llvm-svn: 251162
  • Loading branch information
EugeneZelenko committed Oct 24, 2015
1 parent 79c4ee4 commit fe4ae5e
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 124 deletions.
24 changes: 12 additions & 12 deletions lldb/include/lldb/Interpreter/CommandInterpreter.h
Expand Up @@ -265,8 +265,8 @@ class CommandInterpreter :
bool include_aliases);

CommandObject *
GetCommandObject (const char *cmd,
StringList *matches = NULL);
GetCommandObject(const char *cmd,
StringList *matches = nullptr);

bool
CommandExists (const char *cmd);
Expand Down Expand Up @@ -322,20 +322,20 @@ class CommandInterpreter :
CommandReturnObject &result);

bool
HandleCommand (const char *command_line,
LazyBool add_to_history,
CommandReturnObject &result,
ExecutionContext *override_context = NULL,
bool repeat_on_empty_command = true,
bool no_context_switching = false);
HandleCommand(const char *command_line,
LazyBool add_to_history,
CommandReturnObject &result,
ExecutionContext *override_context = nullptr,
bool repeat_on_empty_command = true,
bool no_context_switching = false);

//------------------------------------------------------------------
/// Execute a list of commands in sequence.
///
/// @param[in] commands
/// The list of commands to execute.
/// @param[in,out] context
/// The execution context in which to run the commands. Can be NULL in which case the default
/// The execution context in which to run the commands. Can be nullptr in which case the default
/// context will be used.
/// @param[in] options
/// This object holds the options used to control when to stop, whether to execute commands,
Expand All @@ -356,7 +356,7 @@ class CommandInterpreter :
/// @param[in] file
/// The file from which to read in commands.
/// @param[in,out] context
/// The execution context in which to run the commands. Can be NULL in which case the default
/// The execution context in which to run the commands. Can be nullptr in which case the default
/// context will be used.
/// @param[in] options
/// This object holds the options used to control when to stop, whether to execute commands,
Expand Down Expand Up @@ -643,7 +643,7 @@ class CommandInterpreter :
}

lldb::IOHandlerSP
GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = NULL);
GetIOHandler(bool force_create = false, CommandInterpreterRunOptions *options = nullptr);

bool
GetStoppedForCrash () const
Expand Down Expand Up @@ -682,7 +682,7 @@ class CommandInterpreter :
SetSynchronous (bool value);

lldb::CommandObjectSP
GetCommandSP (const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = NULL);
GetCommandSP(const char *cmd, bool include_aliases = true, bool exact = true, StringList *matches = nullptr);

private:
Error
Expand Down
42 changes: 21 additions & 21 deletions lldb/include/lldb/Interpreter/CommandObject.h
Expand Up @@ -46,7 +46,7 @@ class CommandObject

explicit operator bool() const
{
return (help_callback != NULL);
return (help_callback != nullptr);
}
};

Expand Down Expand Up @@ -77,11 +77,11 @@ class CommandObject

typedef std::map<std::string, lldb::CommandObjectSP> CommandMap;

CommandObject (CommandInterpreter &interpreter,
const char *name,
const char *help = NULL,
const char *syntax = NULL,
uint32_t flags = 0);
CommandObject(CommandInterpreter &interpreter,
const char *name,
const char *help = nullptr,
const char *syntax = nullptr,
uint32_t flags = 0);

virtual
~CommandObject ();
Expand Down Expand Up @@ -141,15 +141,15 @@ class CommandObject
IsMultiwordObject () { return false; }

virtual lldb::CommandObjectSP
GetSubcommandSP (const char *sub_cmd, StringList *matches = NULL)
GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr)
{
return lldb::CommandObjectSP();
}

virtual CommandObject *
GetSubcommandObject (const char *sub_cmd, StringList *matches = NULL)
GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr)
{
return NULL;
return nullptr;
}

virtual void
Expand Down Expand Up @@ -373,13 +373,13 @@ class CommandObject
/// The complete current command line.
///
/// @return
/// NULL if there is no special repeat command - it will use the current command line.
/// nullptr if there is no special repeat command - it will use the current command line.
/// Otherwise a pointer to the command to be repeated.
/// If the returned string is the empty string, the command won't be repeated.
//------------------------------------------------------------------
virtual const char *GetRepeatCommand (Args &current_command_args, uint32_t index)
{
return NULL;
return nullptr;
}

bool
Expand Down Expand Up @@ -492,11 +492,11 @@ class CommandObject
class CommandObjectParsed : public CommandObject
{
public:
CommandObjectParsed (CommandInterpreter &interpreter,
const char *name,
const char *help = NULL,
const char *syntax = NULL,
uint32_t flags = 0) :
CommandObjectParsed(CommandInterpreter &interpreter,
const char *name,
const char *help = nullptr,
const char *syntax = nullptr,
uint32_t flags = 0) :
CommandObject (interpreter, name, help, syntax, flags) {}

~CommandObjectParsed() override = default;
Expand All @@ -519,11 +519,11 @@ class CommandObjectParsed : public CommandObject
class CommandObjectRaw : public CommandObject
{
public:
CommandObjectRaw (CommandInterpreter &interpreter,
const char *name,
const char *help = NULL,
const char *syntax = NULL,
uint32_t flags = 0) :
CommandObjectRaw(CommandInterpreter &interpreter,
const char *name,
const char *help = nullptr,
const char *syntax = nullptr,
uint32_t flags = 0) :
CommandObject (interpreter, name, help, syntax, flags) {}

~CommandObjectRaw() override = default;
Expand Down
28 changes: 14 additions & 14 deletions lldb/include/lldb/Interpreter/CommandObjectMultiword.h
Expand Up @@ -28,11 +28,11 @@ class CommandObjectMultiword : public CommandObject
friend class CommandInterpreter;
friend class CommandObjectSyntax;
public:
CommandObjectMultiword (CommandInterpreter &interpreter,
const char *name,
const char *help = NULL,
const char *syntax = NULL,
uint32_t flags = 0);
CommandObjectMultiword(CommandInterpreter &interpreter,
const char *name,
const char *help = nullptr,
const char *syntax = nullptr,
uint32_t flags = 0);

~CommandObjectMultiword() override;

Expand All @@ -50,10 +50,10 @@ friend class CommandObjectSyntax;
GenerateHelpText(Stream &output_stream) override;

lldb::CommandObjectSP
GetSubcommandSP(const char *sub_cmd, StringList *matches = NULL) override;
GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;

CommandObject *
GetSubcommandObject(const char *sub_cmd, StringList *matches = NULL) override;
GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;

void
AproposAllSubCommands(const char *prefix,
Expand Down Expand Up @@ -104,11 +104,11 @@ friend class CommandObjectSyntax;
class CommandObjectProxy : public CommandObject
{
public:
CommandObjectProxy (CommandInterpreter &interpreter,
const char *name,
const char *help = NULL,
const char *syntax = NULL,
uint32_t flags = 0);
CommandObjectProxy(CommandInterpreter &interpreter,
const char *name,
const char *help = nullptr,
const char *syntax = nullptr,
uint32_t flags = 0);

~CommandObjectProxy() override;

Expand All @@ -127,10 +127,10 @@ class CommandObjectProxy : public CommandObject
IsMultiwordObject() override;

lldb::CommandObjectSP
GetSubcommandSP(const char *sub_cmd, StringList *matches = NULL) override;
GetSubcommandSP(const char *sub_cmd, StringList *matches = nullptr) override;

CommandObject *
GetSubcommandObject(const char *sub_cmd, StringList *matches = NULL) override;
GetSubcommandObject(const char *sub_cmd, StringList *matches = nullptr) override;

void
AproposAllSubCommands(const char *prefix,
Expand Down
8 changes: 3 additions & 5 deletions lldb/include/lldb/Interpreter/CommandReturnObject.h
Expand Up @@ -22,11 +22,9 @@

namespace lldb_private {


class CommandReturnObject
{
public:

CommandReturnObject ();

~CommandReturnObject ();
Expand Down Expand Up @@ -142,8 +140,8 @@ class CommandReturnObject
AppendErrorWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3)));

void
SetError (const Error &error,
const char *fallback_error_cstr = NULL);
SetError(const Error &error,
const char *fallback_error_cstr = nullptr);

void
SetError (const char *error_cstr);
Expand Down Expand Up @@ -189,4 +187,4 @@ class CommandReturnObject

} // namespace lldb_private

#endif // liblldb_CommandReturnObject_h_
#endif // liblldb_CommandReturnObject_h_
8 changes: 2 additions & 6 deletions lldb/include/lldb/Interpreter/OptionGroupArchitecture.h
Expand Up @@ -26,7 +26,6 @@ namespace lldb_private {
class OptionGroupArchitecture : public OptionGroup
{
public:

OptionGroupArchitecture ();

~OptionGroupArchitecture() override;
Expand Down Expand Up @@ -55,15 +54,12 @@ class OptionGroupArchitecture : public OptionGroup
}

const char *
GetArchitectureName ()
GetArchitectureName()
{
if (m_arch_str.empty())
return NULL;
return m_arch_str.c_str();
return (m_arch_str.empty() ? nullptr : m_arch_str.c_str());
}

protected:

std::string m_arch_str; // Save the arch triple in case a platform is specified after the architecture
};

Expand Down
18 changes: 8 additions & 10 deletions lldb/include/lldb/Interpreter/OptionValue.h
@@ -1,4 +1,4 @@
//===-- OptionValue.h --------------------------------------*- C++ -*-===//
//===-- OptionValue.h -------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
Expand Down Expand Up @@ -61,7 +61,6 @@ namespace lldb_private {
eDumpGroupHelp = (eDumpOptionName | eDumpOptionType | eDumpOptionDescription)
};


OptionValue () :
m_callback (nullptr),
m_baton(nullptr),
Expand All @@ -76,9 +75,8 @@ namespace lldb_private {
{
}

virtual ~OptionValue ()
{
}
virtual ~OptionValue() = default;

//-----------------------------------------------------------------
// Subclasses should override these functions
//-----------------------------------------------------------------
Expand All @@ -99,7 +97,6 @@ namespace lldb_private {
return GetBuiltinTypeAsCString(GetType());
}


static const char *
GetBuiltinTypeAsCString (Type t);

Expand Down Expand Up @@ -156,6 +153,7 @@ namespace lldb_private {

virtual bool
DumpQualifiedName (Stream &strm) const;

//-----------------------------------------------------------------
// Subclasses should NOT override these functions as they use the
// above functions to implement functionality
Expand Down Expand Up @@ -376,7 +374,7 @@ namespace lldb_private {
SetSInt64Value (int64_t new_value);

const char *
GetStringValue (const char *fail_value = NULL) const;
GetStringValue(const char *fail_value = nullptr) const;

bool
SetStringValue (const char *new_value);
Expand Down Expand Up @@ -415,7 +413,7 @@ namespace lldb_private {
SetValueChangedCallback (OptionValueChangedCallback callback,
void *baton)
{
assert (m_callback == NULL);
assert (m_callback == nullptr);
m_callback = callback;
m_baton = baton;
}
Expand All @@ -426,6 +424,7 @@ namespace lldb_private {
if (m_callback)
m_callback (m_baton, this);
}

protected:
lldb::OptionValueWP m_parent_wp;
OptionValueChangedCallback m_callback;
Expand All @@ -436,9 +435,8 @@ namespace lldb_private {
// the command line or as a setting, versus if we
// just have the default value that was already
// populated in the option value.

};

} // namespace lldb_private

#endif // liblldb_OptionValue_h_
#endif // liblldb_OptionValue_h_

0 comments on commit fe4ae5e

Please sign in to comment.