summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectMultiword.cpp
diff options
context:
space:
mode:
authorEugene Zelenko <eugene.zelenko@gmail.com>2016-02-20 00:58:29 +0000
committerEugene Zelenko <eugene.zelenko@gmail.com>2016-02-20 00:58:29 +0000
commit26cac3af0b83c59a201d91c96e2810e3b2554704 (patch)
treeef7469f1fc2f8230b4d400b71b92953817ca0884 /lldb/source/Commands/CommandObjectMultiword.cpp
parent7a0d7d6be974a4cc7d960b8be66a49dda12cc90c (diff)
downloadbcm5719-llvm-26cac3af0b83c59a201d91c96e2810e3b2554704.tar.gz
bcm5719-llvm-26cac3af0b83c59a201d91c96e2810e3b2554704.zip
Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.
llvm-svn: 261389
Diffstat (limited to 'lldb/source/Commands/CommandObjectMultiword.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectMultiword.cpp83
1 files changed, 31 insertions, 52 deletions
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index ed70551ef37..6d35c9cec1f 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -7,11 +7,11 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/Interpreter/CommandObjectMultiword.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
+#include "lldb/Interpreter/CommandObjectMultiword.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/Options.h"
@@ -24,22 +24,17 @@ using namespace lldb_private;
// CommandObjectMultiword
//-------------------------------------------------------------------------
-CommandObjectMultiword::CommandObjectMultiword
-(
- CommandInterpreter &interpreter,
- const char *name,
- const char *help,
- const char *syntax,
- uint32_t flags
-) :
+CommandObjectMultiword::CommandObjectMultiword(CommandInterpreter &interpreter,
+ const char *name,
+ const char *help,
+ const char *syntax,
+ uint32_t flags) :
CommandObject (interpreter, name, help, syntax, flags),
m_can_be_removed(false)
{
}
-CommandObjectMultiword::~CommandObjectMultiword ()
-{
-}
+CommandObjectMultiword::~CommandObjectMultiword() = default;
CommandObjectSP
CommandObjectMultiword::GetSubcommandSP (const char *sub_cmd, StringList *matches)
@@ -58,9 +53,8 @@ CommandObjectMultiword::GetSubcommandSP (const char *sub_cmd, StringList *matche
}
else
{
-
StringList local_matches;
- if (matches == NULL)
+ if (matches == nullptr)
matches = &local_matches;
int num_matches = CommandObject::AddNamesMatchingPartialString (m_subcommand_dict, sub_cmd, *matches);
@@ -86,13 +80,10 @@ CommandObjectMultiword::GetSubcommandObject (const char *sub_cmd, StringList *ma
}
bool
-CommandObjectMultiword::LoadSubCommand
-(
- const char *name,
- const CommandObjectSP& cmd_obj
-)
+CommandObjectMultiword::LoadSubCommand(const char *name,
+ const CommandObjectSP& cmd_obj)
{
- if (cmd_obj.get())
+ if (cmd_obj)
assert((&GetCommandInterpreter() == &cmd_obj->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter");
CommandMap::iterator pos;
@@ -132,7 +123,7 @@ CommandObjectMultiword::Execute(const char *args_string, CommandReturnObject &re
{
StringList matches;
CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches);
- if (sub_cmd_obj != NULL)
+ if (sub_cmd_obj != nullptr)
{
// Now call CommandObject::Execute to process and options in 'rest_of_line'. From there
// the command-specific version of Execute will be called, with the processed arguments.
@@ -221,16 +212,13 @@ CommandObjectMultiword::GenerateHelpText (Stream &output_stream)
}
int
-CommandObjectMultiword::HandleCompletion
-(
- Args &input,
- int &cursor_index,
- int &cursor_char_position,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches
-)
+CommandObjectMultiword::HandleCompletion(Args &input,
+ int &cursor_index,
+ int &cursor_char_position,
+ int match_start_point,
+ int max_return_elements,
+ bool &word_complete,
+ StringList &matches)
{
// Any of the command matches will provide a complete word, otherwise the individual
// completers will override this.
@@ -244,13 +232,13 @@ CommandObjectMultiword::HandleCompletion
matches);
if (matches.GetSize() == 1
- && matches.GetStringAtIndex(0) != NULL
+ && matches.GetStringAtIndex(0) != nullptr
&& strcmp (arg0, matches.GetStringAtIndex(0)) == 0)
{
StringList temp_matches;
CommandObject *cmd_obj = GetSubcommandObject (arg0,
&temp_matches);
- if (cmd_obj != NULL)
+ if (cmd_obj != nullptr)
{
if (input.GetArgumentCount() == 1)
{
@@ -278,7 +266,7 @@ CommandObjectMultiword::HandleCompletion
{
CommandObject *sub_command_object = GetSubcommandObject (arg0,
&matches);
- if (sub_command_object == NULL)
+ if (sub_command_object == nullptr)
{
return matches.GetSize();
}
@@ -296,7 +284,6 @@ CommandObjectMultiword::HandleCompletion
word_complete,
matches);
}
-
}
}
@@ -305,14 +292,13 @@ CommandObjectMultiword::GetRepeatCommand (Args &current_command_args, uint32_t i
{
index++;
if (current_command_args.GetArgumentCount() <= index)
- return NULL;
+ return nullptr;
CommandObject *sub_command_object = GetSubcommandObject (current_command_args.GetArgumentAtIndex(index));
- if (sub_command_object == NULL)
- return NULL;
+ if (sub_command_object == nullptr)
+ return nullptr;
return sub_command_object->GetRepeatCommand(current_command_args, index);
}
-
void
CommandObjectMultiword::AproposAllSubCommands (const char *prefix,
const char *search_word,
@@ -343,8 +329,6 @@ CommandObjectMultiword::AproposAllSubCommands (const char *prefix,
}
}
-
-
CommandObjectProxy::CommandObjectProxy (CommandInterpreter &interpreter,
const char *name,
const char *help,
@@ -354,9 +338,7 @@ CommandObjectProxy::CommandObjectProxy (CommandInterpreter &interpreter,
{
}
-CommandObjectProxy::~CommandObjectProxy ()
-{
-}
+CommandObjectProxy::~CommandObjectProxy() = default;
const char *
CommandObjectProxy::GetHelpLong ()
@@ -364,7 +346,7 @@ CommandObjectProxy::GetHelpLong ()
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->GetHelpLong();
- return NULL;
+ return nullptr;
}
bool
@@ -408,7 +390,7 @@ CommandObjectProxy::GetSubcommandObject (const char *sub_cmd, StringList *matche
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->GetSubcommandObject(sub_cmd, matches);
- return NULL;
+ return nullptr;
}
void
@@ -453,17 +435,15 @@ CommandObjectProxy::WantsCompletion()
return false;
}
-
Options *
CommandObjectProxy::GetOptions ()
{
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->GetOptions ();
- return NULL;
+ return nullptr;
}
-
int
CommandObjectProxy::HandleCompletion (Args &input,
int &cursor_index,
@@ -485,6 +465,7 @@ CommandObjectProxy::HandleCompletion (Args &input,
matches.Clear();
return 0;
}
+
int
CommandObjectProxy::HandleArgumentCompletion (Args &input,
int &cursor_index,
@@ -516,7 +497,7 @@ CommandObjectProxy::GetRepeatCommand (Args &current_command_args,
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->GetRepeatCommand (current_command_args, index);
- return NULL;
+ return nullptr;
}
bool
@@ -530,5 +511,3 @@ CommandObjectProxy::Execute (const char *args_string,
result.SetStatus (eReturnStatusFailed);
return false;
}
-
-
OpenPOWER on IntegriCloud