Remove some more uses of Args::GetArgumentAtIndex.

llvm-svn: 289188
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index 8aa2856..0d0aa10 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -98,58 +98,61 @@
   const size_t argc = args.GetArgumentCount();
   if (argc == 0) {
     this->CommandObject::GenerateHelpText(result);
-  } else {
-    const char *sub_command = args.GetArgumentAtIndex(0);
-
-    if (sub_command) {
-      if (::strcasecmp(sub_command, "help") == 0) {
-        this->CommandObject::GenerateHelpText(result);
-      } else if (!m_subcommand_dict.empty()) {
-        StringList matches;
-        CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches);
-        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.
-
-          args.Shift();
-
-          sub_cmd_obj->Execute(args_string, result);
-        } else {
-          std::string error_msg;
-          const size_t num_subcmd_matches = matches.GetSize();
-          if (num_subcmd_matches > 0)
-            error_msg.assign("ambiguous command ");
-          else
-            error_msg.assign("invalid command ");
-
-          error_msg.append("'");
-          error_msg.append(GetCommandName());
-          error_msg.append(" ");
-          error_msg.append(sub_command);
-          error_msg.append("'.");
-
-          if (num_subcmd_matches > 0) {
-            error_msg.append(" Possible completions:");
-            for (size_t i = 0; i < num_subcmd_matches; i++) {
-              error_msg.append("\n\t");
-              error_msg.append(matches.GetStringAtIndex(i));
-            }
-          }
-          error_msg.append("\n");
-          result.AppendRawError(error_msg.c_str());
-          result.SetStatus(eReturnStatusFailed);
-        }
-      } else {
-        result.AppendErrorWithFormat("'%s' does not have any subcommands.\n",
-                                     GetCommandName().str().c_str());
-        result.SetStatus(eReturnStatusFailed);
-      }
-    }
+    return result.Succeeded();
   }
 
-  return result.Succeeded();
+  auto sub_command = args[0].ref;
+  if (sub_command.empty())
+    return result.Succeeded();
+
+  if (sub_command.equals_lower("help")) {
+    this->CommandObject::GenerateHelpText(result);
+    return result.Succeeded();
+  }
+
+  if (m_subcommand_dict.empty()) {
+    result.AppendErrorWithFormat("'%s' does not have any subcommands.\n",
+                                 GetCommandName().str().c_str());
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  StringList matches;
+  CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches);
+  if (sub_cmd_obj != nullptr) {
+    // Now call CommandObject::Execute to process options in `rest_of_line`.
+    // From there the command-specific version of Execute will be called,
+    // with the processed arguments.
+
+    args.Shift();
+    sub_cmd_obj->Execute(args_string, result);
+    return result.Succeeded();
+  }
+
+  std::string error_msg;
+  const size_t num_subcmd_matches = matches.GetSize();
+  if (num_subcmd_matches > 0)
+    error_msg.assign("ambiguous command ");
+  else
+    error_msg.assign("invalid command ");
+
+  error_msg.append("'");
+  error_msg.append(GetCommandName());
+  error_msg.append(" ");
+  error_msg.append(sub_command);
+  error_msg.append("'.");
+
+  if (num_subcmd_matches > 0) {
+    error_msg.append(" Possible completions:");
+    for (size_t i = 0; i < num_subcmd_matches; i++) {
+      error_msg.append("\n\t");
+      error_msg.append(matches.GetStringAtIndex(i));
+    }
+  }
+  error_msg.append("\n");
+  result.AppendRawError(error_msg.c_str());
+  result.SetStatus(eReturnStatusFailed);
+  return false;
 }
 
 void CommandObjectMultiword::GenerateHelpText(Stream &output_stream) {
@@ -191,16 +194,15 @@
                                              bool &word_complete,
                                              StringList &matches) {
   // Any of the command matches will provide a complete word, otherwise the
-  // individual
-  // completers will override this.
+  // individual completers will override this.
   word_complete = true;
 
-  const char *arg0 = input.GetArgumentAtIndex(0);
+  auto arg0 = input[0].ref;
   if (cursor_index == 0) {
     AddNamesMatchingPartialString(m_subcommand_dict, arg0, matches);
 
     if (matches.GetSize() == 1 && matches.GetStringAtIndex(0) != nullptr &&
-        strcmp(arg0, matches.GetStringAtIndex(0)) == 0) {
+        (arg0 == matches.GetStringAtIndex(0))) {
       StringList temp_matches;
       CommandObject *cmd_obj = GetSubcommandObject(arg0, &temp_matches);
       if (cmd_obj != nullptr) {
@@ -240,7 +242,7 @@
   if (current_command_args.GetArgumentCount() <= index)
     return nullptr;
   CommandObject *sub_command_object =
-      GetSubcommandObject(current_command_args.GetArgumentAtIndex(index));
+      GetSubcommandObject(current_command_args[index].ref);
   if (sub_command_object == nullptr)
     return nullptr;
   return sub_command_object->GetRepeatCommand(current_command_args, index);