Skip to content

Commit 71d5efd

Browse files
committed
Merge commit 'refs/am/changes/54710f0bc2fb4468de89b52fad45f4940c43831a_swift/master-next' into HEAD
Conflicts: lldb/source/Commands/CommandObjectExpression.cpp
2 parents 5bc035f + 54710f0 commit 71d5efd

File tree

1 file changed

+47
-57
lines changed

1 file changed

+47
-57
lines changed

lldb/source/Commands/CommandObjectExpression.cpp

Lines changed: 47 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -632,68 +632,58 @@ bool CommandObjectExpression::DoExecute(llvm::StringRef command,
632632
return false;
633633

634634
if (m_repl_option.GetOptionValue().GetCurrentValue()) {
635-
Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
636-
637-
// BEGIN SWIFT
638-
// If we weren't passed in a target, let's see if the dummy target can
639-
// make a REPL:
640-
if (!target)
641-
target = &GetDummyTarget();
642-
// END SWIFT
643-
644-
if (target) {
645-
// Drop into REPL
646-
m_expr_lines.clear();
647-
m_expr_line_count = 0;
648-
649-
Debugger &debugger = target->GetDebugger();
650-
651-
// Check if the LLDB command interpreter is sitting on top of a REPL
652-
// that launched it...
653-
if (debugger.CheckTopIOHandlerTypes(IOHandler::Type::CommandInterpreter,
654-
IOHandler::Type::REPL)) {
655-
// the LLDB command interpreter is sitting on top of a REPL that
656-
// launched it, so just say the command interpreter is done and
657-
// fall back to the existing REPL
658-
m_interpreter.GetIOHandler(false)->SetIsDone(true);
659-
} else {
660-
// We are launching the REPL on top of the current LLDB command
661-
// interpreter, so just push one
662-
bool initialize = false;
663-
Status repl_error;
664-
REPLSP repl_sp(target->GetREPL(repl_error, m_command_options.language,
665-
nullptr, false));
666-
667-
if (!repl_sp) {
668-
initialize = true;
669-
repl_sp = target->GetREPL(repl_error, m_command_options.language,
670-
nullptr, true);
671-
if (!repl_error.Success()) {
672-
result.SetError(repl_error);
673-
return result.Succeeded();
674-
}
635+
Target &target = GetSelectedOrDummyTarget();
636+
// Drop into REPL
637+
m_expr_lines.clear();
638+
m_expr_line_count = 0;
639+
640+
Debugger &debugger = target.GetDebugger();
641+
642+
// Check if the LLDB command interpreter is sitting on top of a REPL
643+
// that launched it...
644+
if (debugger.CheckTopIOHandlerTypes(IOHandler::Type::CommandInterpreter,
645+
IOHandler::Type::REPL)) {
646+
// the LLDB command interpreter is sitting on top of a REPL that
647+
// launched it, so just say the command interpreter is done and
648+
// fall back to the existing REPL
649+
m_interpreter.GetIOHandler(false)->SetIsDone(true);
650+
} else {
651+
// We are launching the REPL on top of the current LLDB command
652+
// interpreter, so just push one
653+
bool initialize = false;
654+
Status repl_error;
655+
REPLSP repl_sp(target.GetREPL(repl_error, m_command_options.language,
656+
nullptr, false));
657+
658+
if (!repl_sp) {
659+
initialize = true;
660+
repl_sp = target.GetREPL(repl_error, m_command_options.language,
661+
nullptr, true);
662+
if (!repl_error.Success()) {
663+
result.SetError(repl_error);
664+
return result.Succeeded();
675665
}
666+
}
676667

677-
if (repl_sp) {
678-
if (initialize) {
679-
repl_sp->SetEvaluateOptions(
680-
GetExprOptions(exe_ctx, m_command_options));
681-
repl_sp->SetFormatOptions(m_format_options);
682-
repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
683-
}
668+
if (repl_sp) {
669+
if (initialize) {
670+
repl_sp->SetEvaluateOptions(
671+
GetExprOptions(exe_ctx, m_command_options));
672+
repl_sp->SetFormatOptions(m_format_options);
673+
repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
674+
}
684675

685-
IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
676+
IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
686677

687-
io_handler_sp->SetIsDone(false);
678+
io_handler_sp->SetIsDone(false);
688679

689-
debugger.PushIOHandler(io_handler_sp);
690-
} else {
691-
repl_error.SetErrorStringWithFormat(
692-
"Couldn't create a REPL for %s",
693-
Language::GetNameForLanguageType(m_command_options.language));
694-
result.SetError(repl_error);
695-
return result.Succeeded();
696-
}
680+
debugger.PushIOHandler(io_handler_sp);
681+
} else {
682+
repl_error.SetErrorStringWithFormat(
683+
"Couldn't create a REPL for %s",
684+
Language::GetNameForLanguageType(m_command_options.language));
685+
result.SetError(repl_error);
686+
return result.Succeeded();
697687
}
698688
}
699689
}

0 commit comments

Comments
 (0)