Author: teemperor Date: Wed Sep 25 05:55:30 2019 New Revision: 372861 URL: http://llvm.org/viewvc/llvm-project?rev=372861&view=rev Log: [lldb][NFC] Remove CompletionRequest::GetCursorArgument and GetRawLineUntilCursor
They both return the same result as another function (GetCursorArgumentPrefix and GetRawLine). They were only added because the old API allowed to look (in theory) behind the cursor position which is no longer possible. Modified: lldb/trunk/include/lldb/Utility/CompletionRequest.h lldb/trunk/source/Expression/REPL.cpp lldb/trunk/source/Interpreter/Options.cpp Modified: lldb/trunk/include/lldb/Utility/CompletionRequest.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/CompletionRequest.h?rev=372861&r1=372860&r2=372861&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/CompletionRequest.h (original) +++ lldb/trunk/include/lldb/Utility/CompletionRequest.h Wed Sep 25 05:55:30 2019 @@ -103,9 +103,6 @@ public: CompletionResult &result); llvm::StringRef GetRawLine() const { return m_command; } - llvm::StringRef GetRawLineUntilCursor() const { - return m_command.substr(0, m_cursor_index); - } unsigned GetRawCursorPos() const { return m_raw_cursor_pos; } @@ -192,12 +189,8 @@ public: descriptions.GetStringAtIndex(i)); } - llvm::StringRef GetCursorArgument() const { - return GetParsedLine().GetArgumentAtIndex(GetCursorIndex()); - } - llvm::StringRef GetCursorArgumentPrefix() const { - return GetCursorArgument().substr(0, m_cursor_char_position); + return GetParsedLine().GetArgumentAtIndex(GetCursorIndex()); } private: Modified: lldb/trunk/source/Expression/REPL.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/REPL.cpp?rev=372861&r1=372860&r2=372861&view=diff ============================================================================== --- lldb/trunk/source/Expression/REPL.cpp (original) +++ lldb/trunk/source/Expression/REPL.cpp Wed Sep 25 05:55:30 2019 @@ -453,7 +453,7 @@ void REPL::IOHandlerComplete(IOHandler & } // Strip spaces from the line and see if we had only spaces - if (request.GetRawLineUntilCursor().trim().empty()) { + if (request.GetRawLine().trim().empty()) { // Only spaces on this line, so just indent request.AddCompletion(m_indent_str); return; @@ -479,7 +479,7 @@ void REPL::IOHandlerComplete(IOHandler & } current_code.append("\n"); - current_code += request.GetRawLineUntilCursor(); + current_code += request.GetRawLine(); StringList matches; int result = CompleteCode(current_code, matches); Modified: lldb/trunk/source/Interpreter/Options.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Options.cpp?rev=372861&r1=372860&r2=372861&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/Options.cpp (original) +++ lldb/trunk/source/Interpreter/Options.cpp Wed Sep 25 05:55:30 2019 @@ -698,7 +698,7 @@ bool Options::HandleOptionCompletion(Com request.AddCompletion("--" + long_option.str(), opt.usage_text); return true; } else - request.AddCompletion(request.GetCursorArgument()); + request.AddCompletion(request.GetCursorArgumentPrefix()); return true; } else { // FIXME - not handling wrong options yet: _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits