[lldb] Use CompletionRequest in REPL::CompleteCode and remove translation code to...
authorRaphael Isemann <teemperor@gmail.com>
Mon, 27 Jan 2020 20:24:39 +0000 (21:24 +0100)
committerRaphael Isemann <teemperor@gmail.com>
Wed, 29 Jan 2020 07:56:32 +0000 (08:56 +0100)
Any REPL client should just move to CompletionRequest instead of relying on
the translation code from the old API, so let's remove that translation code.

lldb/include/lldb/Expression/REPL.h
lldb/source/Expression/REPL.cpp

index 035ad63271e4205d23a4b26a47171d17dd806d42..e96dfb0499d9da03a369e4bf3d35aaa556ef0069 100644 (file)
@@ -130,8 +130,8 @@ protected:
                                 lldb::ValueObjectSP &valobj_sp,
                                 ExpressionVariable *var = nullptr) = 0;
 
-  virtual int CompleteCode(const std::string &current_code,
-                           StringList &matches) = 0;
+  virtual void CompleteCode(const std::string &current_code,
+                            CompletionRequest &request) = 0;
 
   OptionGroupFormat m_format_options = OptionGroupFormat(lldb::eFormatDefault);
   OptionGroupValueObjectDisplay m_varobj_options;
index 670c0ec98c293f2591da072a9613051782a3fafa..d49b7644d7f6b526d905daefd6dca842d0d4d338 100644 (file)
@@ -488,14 +488,7 @@ void REPL::IOHandlerComplete(IOHandler &io_handler,
   current_code.append("\n");
   current_code += request.GetRawLine();
 
-  StringList matches;
-  int result = CompleteCode(current_code, matches);
-  if (result == -2) {
-    assert(matches.GetSize() == 1);
-    request.AddCompletion(matches.GetStringAtIndex(0), "",
-                          CompletionMode::RewriteLine);
-  } else
-    request.AddCompletions(matches);
+  CompleteCode(current_code, request);
 }
 
 bool QuitCommandOverrideCallback(void *baton, const char **argv) {