summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-07-31 03:48:29 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-07-31 03:48:29 +0000
commitb22860da61ad68edf1f92c6fea8afe11c9c4036b (patch)
tree8aecebf27211864a098391a11947db0bd5d448c2
parent175f0930907c56a80e0500cd201910c36222e788 (diff)
downloadbcm5719-llvm-b22860da61ad68edf1f92c6fea8afe11c9c4036b.tar.gz
bcm5719-llvm-b22860da61ad68edf1f92c6fea8afe11c9c4036b.zip
[CompletionRequest] Remove unimplemented members.
Completion requests have two fields that are essentially unimplemented: `m_match_start_point` and `m_max_return_elements`. This would've been okay, if it wasn't for the fact that this caused a bunch of useless parameters to be passed around. Occasionally there would be a comment or assert saying that they are not supported. This patch removes them. llvm-svn: 367385
-rw-r--r--lldb/include/lldb/Core/IOHandler.h3
-rw-r--r--lldb/include/lldb/Expression/REPL.h1
-rw-r--r--lldb/include/lldb/Host/Editline.h1
-rw-r--r--lldb/include/lldb/Interpreter/CommandInterpreter.h3
-rw-r--r--lldb/include/lldb/Utility/CompletionRequest.h19
-rw-r--r--lldb/source/API/SBCommandInterpreter.cpp3
-rw-r--r--lldb/source/Core/FormatEntity.cpp1
-rw-r--r--lldb/source/Core/IOHandler.cpp19
-rw-r--r--lldb/source/Expression/REPL.cpp4
-rw-r--r--lldb/source/Host/common/Editline.cpp2
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp15
-rw-r--r--lldb/source/Utility/CompletionRequest.cpp5
-rw-r--r--lldb/unittests/Utility/CompletionRequestTest.cpp13
13 files changed, 21 insertions, 68 deletions
diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h
index b7180675cf4..c407b01481c 100644
--- a/lldb/include/lldb/Core/IOHandler.h
+++ b/lldb/include/lldb/Core/IOHandler.h
@@ -200,7 +200,6 @@ public:
virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
StringList &matches, StringList &descriptions);
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
@@ -417,7 +416,6 @@ private:
static int AutoCompleteCallback(const char *current_line, const char *cursor,
const char *last_char,
- int skip_first_n_matches, int max_matches,
StringList &matches, StringList &descriptions,
void *baton);
#endif
@@ -452,7 +450,6 @@ public:
int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
StringList &matches, StringList &descriptions) override;
void IOHandlerInputComplete(IOHandler &io_handler,
diff --git a/lldb/include/lldb/Expression/REPL.h b/lldb/include/lldb/Expression/REPL.h
index 850d2f6f961..0d21772c911 100644
--- a/lldb/include/lldb/Expression/REPL.h
+++ b/lldb/include/lldb/Expression/REPL.h
@@ -105,7 +105,6 @@ public:
int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
StringList &matches, StringList &descriptions) override;
protected:
diff --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h
index a942ede05ce..f16319dfc3c 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -99,7 +99,6 @@ typedef int (*FixIndentationCallbackType)(Editline *editline,
typedef int (*CompleteCallbackType)(const char *current_line,
const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
StringList &matches,
StringList &descriptions, void *baton);
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index c3dd6606e0d..d738bbc8879 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -325,8 +325,7 @@ public:
//
// FIXME: Only max_return_elements == -1 is supported at present.
int HandleCompletion(const char *current_line, const char *cursor,
- const char *last_char, int match_start_point,
- int max_return_elements, StringList &matches,
+ const char *last_char, StringList &matches,
StringList &descriptions);
// This version just returns matches, and doesn't compute the substring. It
diff --git a/lldb/include/lldb/Utility/CompletionRequest.h b/lldb/include/lldb/Utility/CompletionRequest.h
index f5ccb01ca16..c7ad0980f78 100644
--- a/lldb/include/lldb/Utility/CompletionRequest.h
+++ b/lldb/include/lldb/Utility/CompletionRequest.h
@@ -68,18 +68,10 @@ public:
/// the cursor is at the start of the line. The completion starts from
/// this cursor position.
///
- /// \param [in] match_start_point
- /// \param [in] max_return_elements
- /// If there is a match that is expensive to compute, these are here to
- /// allow you to compute the completions in batches. Start the
- /// completion from match_start_point, and return match_return_elements
- /// elements.
- ///
/// \param [out] result
/// The CompletionResult that will be filled with the results after this
/// request has been handled.
CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos,
- int match_start_point, int max_return_elements,
CompletionResult &result);
llvm::StringRef GetRawLine() const { return m_command; }
@@ -98,10 +90,6 @@ public:
void SetCursorCharPosition(int pos) { m_cursor_char_position = pos; }
int GetCursorCharPosition() const { return m_cursor_char_position; }
- int GetMatchStartPoint() const { return m_match_start_point; }
-
- int GetMaxReturnElements() const { return m_max_return_elements; }
-
bool GetWordComplete() { return m_word_complete; }
void SetWordComplete(bool v) { m_word_complete = v; }
@@ -170,13 +158,6 @@ private:
int m_cursor_index;
/// The cursor position in the argument indexed by m_cursor_index.
int m_cursor_char_position;
- /// If there is a match that is expensive
- /// to compute, these are here to allow you to compute the completions in
- /// batches. Start the completion from \amatch_start_point, and return
- /// \amatch_return_elements elements.
- // FIXME: These two values are not implemented.
- int m_match_start_point;
- int m_max_return_elements;
/// \btrue if this is a complete option value (a space will be inserted
/// after the completion.) \bfalse otherwise.
bool m_word_complete = false;
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index c07dffce0ba..1c07e856395 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -372,8 +372,7 @@ int SBCommandInterpreter::HandleCompletionWithDescriptions(
if (IsValid()) {
lldb_private::StringList lldb_matches, lldb_descriptions;
num_completions = m_opaque_ptr->HandleCompletion(
- current_line, cursor, last_char, match_start_point, max_return_elements,
- lldb_matches, lldb_descriptions);
+ current_line, cursor, last_char, lldb_matches, lldb_descriptions);
SBStringList temp_matches_list(&lldb_matches);
matches.AppendList(temp_matches_list);
diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp
index 52a85aa78c6..e88298645d0 100644
--- a/lldb/source/Core/FormatEntity.cpp
+++ b/lldb/source/Core/FormatEntity.cpp
@@ -2350,7 +2350,6 @@ size_t FormatEntity::AutoComplete(CompletionRequest &request) {
llvm::StringRef str = request.GetCursorArgumentPrefix().str();
request.SetWordComplete(false);
- str = str.drop_front(request.GetMatchStartPoint());
const size_t dollar_pos = str.rfind('$');
if (dollar_pos == llvm::StringRef::npos)
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 51cae59639f..a7dbf3c28aa 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -172,8 +172,7 @@ IOHandlerConfirm::~IOHandlerConfirm() = default;
int IOHandlerConfirm::IOHandlerComplete(
IOHandler &io_handler, const char *current_line, const char *cursor,
- const char *last_char, int skip_first_n_matches, int max_matches,
- StringList &matches, StringList &descriptions) {
+ const char *last_char, StringList &matches, StringList &descriptions) {
if (current_line == cursor) {
if (m_default_response) {
matches.AppendString("y");
@@ -221,20 +220,17 @@ void IOHandlerConfirm::IOHandlerInputComplete(IOHandler &io_handler,
int IOHandlerDelegate::IOHandlerComplete(
IOHandler &io_handler, const char *current_line, const char *cursor,
- const char *last_char, int skip_first_n_matches, int max_matches,
- StringList &matches, StringList &descriptions) {
+ const char *last_char, StringList &matches, StringList &descriptions) {
switch (m_completion) {
case Completion::None:
break;
case Completion::LLDBCommand:
return io_handler.GetDebugger().GetCommandInterpreter().HandleCompletion(
- current_line, cursor, last_char, skip_first_n_matches, max_matches,
- matches, descriptions);
+ current_line, cursor, last_char, matches, descriptions);
case Completion::Expression: {
CompletionResult result;
- CompletionRequest request(current_line, cursor - current_line,
- skip_first_n_matches, max_matches, result);
+ CompletionRequest request(current_line, cursor - current_line, result);
CommandCompletions::InvokeCommonCompletionCallbacks(
io_handler.GetDebugger().GetCommandInterpreter(),
CommandCompletions::eVariablePathCompletion, request, nullptr);
@@ -449,13 +445,12 @@ int IOHandlerEditline::FixIndentationCallback(Editline *editline,
int IOHandlerEditline::AutoCompleteCallback(
const char *current_line, const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches, StringList &matches,
- StringList &descriptions, void *baton) {
+ StringList &matches, StringList &descriptions, void *baton) {
IOHandlerEditline *editline_reader = (IOHandlerEditline *)baton;
if (editline_reader)
return editline_reader->m_delegate.IOHandlerComplete(
- *editline_reader, current_line, cursor, last_char, skip_first_n_matches,
- max_matches, matches, descriptions);
+ *editline_reader, current_line, cursor, last_char, matches,
+ descriptions);
return 0;
}
#endif
diff --git a/lldb/source/Expression/REPL.cpp b/lldb/source/Expression/REPL.cpp
index f4ed887729d..ffcfc1adf5b 100644
--- a/lldb/source/Expression/REPL.cpp
+++ b/lldb/source/Expression/REPL.cpp
@@ -435,7 +435,6 @@ void REPL::IOHandlerInputComplete(IOHandler &io_handler, std::string &code) {
int REPL::IOHandlerComplete(IOHandler &io_handler, const char *current_line,
const char *cursor, const char *last_char,
- int skip_first_n_matches, int max_matches,
StringList &matches, StringList &descriptions) {
matches.Clear();
@@ -448,8 +447,7 @@ int REPL::IOHandlerComplete(IOHandler &io_handler, const char *current_line,
// auto complete LLDB commands
const char *lldb_current_line = line.substr(1).data();
return debugger.GetCommandInterpreter().HandleCompletion(
- lldb_current_line, cursor, last_char, skip_first_n_matches, max_matches,
- matches, descriptions);
+ lldb_current_line, cursor, last_char, matches, descriptions);
}
// Strip spaces from the line and see if we had only spaces
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index d3a70aeaa32..4a34f53421e 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -896,8 +896,6 @@ unsigned char Editline::TabCommand(int ch) {
const int num_completions = m_completion_callback(
line_info->buffer, line_info->cursor, line_info->lastchar,
- 0, // Don't skip any matches (start at match zero)
- -1, // Get all the matches
completions, descriptions, m_completion_callback_baton);
if (num_completions == 0)
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 2bc41621af5..bd09f89c02a 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1813,15 +1813,15 @@ int CommandInterpreter::HandleCompletionMatches(CompletionRequest &request) {
return num_command_matches;
}
-int CommandInterpreter::HandleCompletion(
- const char *current_line, const char *cursor, const char *last_char,
- int match_start_point, int max_return_elements, StringList &matches,
- StringList &descriptions) {
+int CommandInterpreter::HandleCompletion(const char *current_line,
+ const char *cursor,
+ const char *last_char,
+ StringList &matches,
+ StringList &descriptions) {
llvm::StringRef command_line(current_line, last_char - current_line);
CompletionResult result;
- CompletionRequest request(command_line, cursor - current_line,
- match_start_point, max_return_elements, result);
+ CompletionRequest request(command_line, cursor - current_line, result);
// Don't complete comments, and if the line we are completing is just the
// history repeat character, substitute the appropriate history line.
const char *first_arg = request.GetParsedLine().GetArgumentAtIndex(0);
@@ -1838,9 +1838,6 @@ int CommandInterpreter::HandleCompletion(
}
}
- // Only max_return_elements == -1 is supported at present:
- lldbassert(max_return_elements == -1);
-
int num_command_matches = HandleCompletionMatches(request);
result.GetMatches(matches);
result.GetDescriptions(descriptions);
diff --git a/lldb/source/Utility/CompletionRequest.cpp b/lldb/source/Utility/CompletionRequest.cpp
index c62ec4f56ff..ca109a9a716 100644
--- a/lldb/source/Utility/CompletionRequest.cpp
+++ b/lldb/source/Utility/CompletionRequest.cpp
@@ -13,12 +13,9 @@ using namespace lldb_private;
CompletionRequest::CompletionRequest(llvm::StringRef command_line,
unsigned raw_cursor_pos,
- int match_start_point,
- int max_return_elements,
CompletionResult &result)
: m_command(command_line), m_raw_cursor_pos(raw_cursor_pos),
- m_match_start_point(match_start_point),
- m_max_return_elements(max_return_elements), m_result(result) {
+ m_result(result) {
// We parse the argument up to the cursor, so the last argument in
// parsed_line is the one containing the cursor, and the cursor is after the
diff --git a/lldb/unittests/Utility/CompletionRequestTest.cpp b/lldb/unittests/Utility/CompletionRequestTest.cpp
index 40675dfde7d..e250f3daa26 100644
--- a/lldb/unittests/Utility/CompletionRequestTest.cpp
+++ b/lldb/unittests/Utility/CompletionRequestTest.cpp
@@ -16,21 +16,16 @@ TEST(CompletionRequest, Constructor) {
const unsigned cursor_pos = 3;
const int arg_index = 1;
const int arg_cursor_pos = 1;
- const int match_start = 2345;
- const int match_max_return = 12345;
StringList matches;
CompletionResult result;
- CompletionRequest request(command, cursor_pos, match_start, match_max_return,
- result);
+ CompletionRequest request(command, cursor_pos, result);
result.GetMatches(matches);
EXPECT_STREQ(request.GetRawLine().str().c_str(), command.c_str());
EXPECT_EQ(request.GetRawCursorPos(), cursor_pos);
EXPECT_EQ(request.GetCursorIndex(), arg_index);
EXPECT_EQ(request.GetCursorCharPosition(), arg_cursor_pos);
- EXPECT_EQ(request.GetMatchStartPoint(), match_start);
- EXPECT_EQ(request.GetMaxReturnElements(), match_max_return);
EXPECT_EQ(request.GetWordComplete(), false);
EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
@@ -43,7 +38,7 @@ TEST(CompletionRequest, DuplicateFiltering) {
StringList matches;
CompletionResult result;
- CompletionRequest request(command, cursor_pos, 0, 0, result);
+ CompletionRequest request(command, cursor_pos, result);
result.GetMatches(matches);
EXPECT_EQ(0U, request.GetNumberOfMatches());
@@ -106,7 +101,7 @@ TEST(CompletionRequest, DuplicateFilteringWithComments) {
StringList matches, descriptions;
CompletionResult result;
- CompletionRequest request(command, cursor_pos, 0, 0, result);
+ CompletionRequest request(command, cursor_pos, result);
result.GetMatches(matches);
result.GetDescriptions(descriptions);
@@ -182,7 +177,7 @@ TEST(CompletionRequest, TestCompletionOwnership) {
StringList matches;
CompletionResult result;
- CompletionRequest request(command, cursor_pos, 0, 0, result);
+ CompletionRequest request(command, cursor_pos, result);
std::string Temporary = "bar";
request.AddCompletion(Temporary);
OpenPOWER on IntegriCloud