Skip to content

Commit

Permalink
Merge commit 'refs/am/changes/8f5afa76236c29a8aa653b3cd9cbeea9e0c12bd…
Browse files Browse the repository at this point in the history
…c_swift/swift-5.2-branch' into HEAD
  • Loading branch information
Teemperor committed Jan 30, 2020
2 parents bd59665 + 8f5afa7 commit ae46c3d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lldb/include/lldb/Expression/REPL.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lldb/include/lldb/Utility/CompletionRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class CompletionRequest {

llvm::StringRef GetRawLine() const { return m_command; }
llvm::StringRef GetRawLineUntilCursor() const {
return m_command.substr(0, m_cursor_index);
return m_command.substr(0, m_raw_cursor_pos);
}

unsigned GetRawCursorPos() const { return m_raw_cursor_pos; }
Expand Down
8 changes: 7 additions & 1 deletion lldb/packages/Python/lldbsuite/test/lldbpexpect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import absolute_import

# System modules
import os
import sys

# Third-party modules
Expand Down Expand Up @@ -30,16 +31,21 @@ def expect_prompt(self):
def launch(self, executable=None, extra_args=None, timeout=30, dimensions=None):
logfile = getattr(sys.stdout, 'buffer',
sys.stdout) if self.TraceOn() else None

args = ['--no-lldbinit', '--no-use-colors']
for cmd in self.setUpCommands():
args += ['-O', cmd]
if executable is not None:
args += ['--file', executable]
if extra_args is not None:
args.extend(extra_args)

env = dict(os.environ)
env["TERM"]="vt100"

self.child = pexpect.spawn(
lldbtest_config.lldbExec, args=args, logfile=logfile,
timeout=timeout, dimensions=dimensions)
timeout=timeout, dimensions=dimensions, env=env)
self.expect_prompt()
for cmd in self.setUpCommands():
self.child.expect_exact(cmd)
Expand Down
9 changes: 1 addition & 8 deletions lldb/source/Expression/REPL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,7 @@ void REPL::IOHandlerComplete(IOHandler &io_handler,
current_code.append("\n");
current_code += request.GetRawLineUntilCursor();

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) {
Expand Down
1 change: 1 addition & 0 deletions lldb/unittests/Utility/CompletionRequestTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ TEST(CompletionRequest, Constructor) {
EXPECT_EQ(request.GetRawCursorPos(), cursor_pos);
EXPECT_EQ(request.GetCursorIndex(), arg_index);
EXPECT_EQ(request.GetCursorCharPosition(), arg_cursor_pos);
EXPECT_EQ(request.GetRawLineUntilCursor(), "a b");

EXPECT_EQ(request.GetPartialParsedLine().GetArgumentCount(), 2u);
EXPECT_STREQ(request.GetPartialParsedLine().GetArgumentAtIndex(1), "b");
Expand Down

0 comments on commit ae46c3d

Please sign in to comment.