[Lldb-commits] [lldb] r369635 - [lldb][NFC] Remove unused return value from HandleOptionArgumentCompletion

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 22 02:14:42 PDT 2019


Author: teemperor
Date: Thu Aug 22 02:14:42 2019
New Revision: 369635

URL: http://llvm.org/viewvc/llvm-project?rev=369635&view=rev
Log:
[lldb][NFC] Remove unused return value from HandleOptionArgumentCompletion

Modified:
    lldb/trunk/include/lldb/Interpreter/Options.h
    lldb/trunk/source/Commands/CommandObjectPlatform.cpp
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Interpreter/Options.cpp

Modified: lldb/trunk/include/lldb/Interpreter/Options.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=369635&r1=369634&r2=369635&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Options.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Options.h Thu Aug 22 02:14:42 2019
@@ -187,14 +187,7 @@ public:
   ///
   /// \param[in] interpreter
   ///    The command interpreter doing the completion.
-  ///
-  /// FIXME: This is the wrong return value, since we also need to
-  /// make a distinction between total number of matches, and the window the
-  /// user wants returned.
-  ///
-  /// \return
-  ///     \btrue if we were in an option, \bfalse otherwise.
-  virtual bool
+  virtual void
   HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request,
                                  OptionElementVector &opt_element_vector,
                                  int opt_element_index,

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=369635&r1=369634&r2=369635&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Thu Aug 22 02:14:42 2019
@@ -1432,7 +1432,7 @@ public:
       return llvm::makeArrayRef(g_platform_process_attach_options);
     }
 
-    bool HandleOptionArgumentCompletion(
+    void HandleOptionArgumentCompletion(
         CompletionRequest &request, OptionElementVector &opt_element_vector,
         int opt_element_index, CommandInterpreter &interpreter) override {
       int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
@@ -1442,7 +1442,7 @@ public:
 
       // Are we in the name?
       if (GetDefinitions()[opt_defs_index].short_option != 'n')
-        return false;
+        return;
 
       // Look to see if there is a -P argument provided, and if so use that
       // plugin, otherwise use the default plugin.
@@ -1452,7 +1452,7 @@ public:
 
       PlatformSP platform_sp(interpreter.GetPlatform(true));
       if (!platform_sp)
-        return false;
+        return;
 
       ProcessInstanceInfoList process_infos;
       ProcessInstanceInfoMatch match_info;
@@ -1464,14 +1464,14 @@ public:
       platform_sp->FindProcesses(match_info, process_infos);
       const uint32_t num_matches = process_infos.GetSize();
       if (num_matches == 0)
-        return false;
+        return;
 
       for (uint32_t i = 0; i < num_matches; ++i) {
         request.AddCompletion(
             llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
                             process_infos.GetProcessNameLengthAtIndex(i)));
       }
-      return false;
+      return;
     }
 
     // Options table: Required for subclasses of Options.

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=369635&r1=369634&r2=369635&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Thu Aug 22 02:14:42 2019
@@ -320,7 +320,7 @@ public:
       return llvm::makeArrayRef(g_process_attach_options);
     }
 
-    bool HandleOptionArgumentCompletion(
+    void HandleOptionArgumentCompletion(
         CompletionRequest &request, OptionElementVector &opt_element_vector,
         int opt_element_index, CommandInterpreter &interpreter) override {
       int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
@@ -330,7 +330,7 @@ public:
 
       // Are we in the name?
       if (GetDefinitions()[opt_defs_index].short_option != 'n')
-        return false;
+        return;
 
       // Look to see if there is a -P argument provided, and if so use that
       // plugin, otherwise use the default plugin.
@@ -340,7 +340,7 @@ public:
 
       PlatformSP platform_sp(interpreter.GetPlatform(true));
       if (!platform_sp)
-        return false;
+        return;
       ProcessInstanceInfoList process_infos;
       ProcessInstanceInfoMatch match_info;
       if (partial_name) {
@@ -351,14 +351,12 @@ public:
           platform_sp->FindProcesses(match_info, process_infos);
           const size_t num_matches = process_infos.GetSize();
           if (num_matches == 0)
-            return false;
+            return;
           for (size_t i = 0; i < num_matches; ++i) {
             request.AddCompletion(
                 llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
                                 process_infos.GetProcessNameLengthAtIndex(i)));
           }
-
-      return false;
     }
 
     // Instance variables to hold the values for command options.

Modified: lldb/trunk/source/Interpreter/Options.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=369635&r1=369634&r2=369635&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Options.cpp (original)
+++ lldb/trunk/source/Interpreter/Options.cpp Thu Aug 22 02:14:42 2019
@@ -751,7 +751,7 @@ bool Options::HandleOptionCompletion(Com
   return false;
 }
 
-bool Options::HandleOptionArgumentCompletion(
+void Options::HandleOptionArgumentCompletion(
     CompletionRequest &request, OptionElementVector &opt_element_vector,
     int opt_element_index, CommandInterpreter &interpreter) {
   auto opt_defs = GetDefinitions();
@@ -764,7 +764,6 @@ bool Options::HandleOptionArgumentComple
 
   const auto &enum_values = opt_defs[opt_defs_index].enum_values;
   if (!enum_values.empty()) {
-    bool return_value = false;
     std::string match_string(
         request.GetParsedLine().GetArgumentAtIndex(opt_arg_pos),
         request.GetParsedLine().GetArgumentAtIndex(opt_arg_pos) +
@@ -774,10 +773,8 @@ bool Options::HandleOptionArgumentComple
       if (strstr(enum_value.string_value, match_string.c_str()) ==
           enum_value.string_value) {
         request.AddCompletion(enum_value.string_value);
-        return_value = true;
       }
     }
-    return return_value;
   }
 
   // If this is a source file or symbol type completion, and  there is a -shlib
@@ -833,7 +830,7 @@ bool Options::HandleOptionArgumentComple
     }
   }
 
-  return CommandCompletions::InvokeCommonCompletionCallbacks(
+  CommandCompletions::InvokeCommonCompletionCallbacks(
       interpreter, completion_mask, request, filter_up.get());
 }
 




More information about the lldb-commits mailing list