[Lldb-commits] [lldb] a497e1b - [lldb] Use CompletionRequest in REPL::CompleteCode and remove translation code to old API

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Jan 28 23:56:56 PST 2020


Author: Raphael Isemann
Date: 2020-01-29T08:56:32+01:00
New Revision: a497e1b5ea7a681ef1b40b5c11f411bfe0e807d0

URL: https://github.com/llvm/llvm-project/commit/a497e1b5ea7a681ef1b40b5c11f411bfe0e807d0
DIFF: https://github.com/llvm/llvm-project/commit/a497e1b5ea7a681ef1b40b5c11f411bfe0e807d0.diff

LOG: [lldb] Use CompletionRequest in REPL::CompleteCode and remove translation code to old API

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Expression/REPL.h b/lldb/include/lldb/Expression/REPL.h
index 035ad63271e4..e96dfb0499d9 100644
--- a/lldb/include/lldb/Expression/REPL.h
+++ b/lldb/include/lldb/Expression/REPL.h
@@ -130,8 +130,8 @@ class REPL : public IOHandlerDelegate {
                                 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;

diff  --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index 670c0ec98c29..d49b7644d7f6 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -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) {


        


More information about the lldb-commits mailing list