Skip to content

Commit 767c955

Browse files
authored
Merge pull request #21 from dcci/repl-crashes
Fix a couple of SwiftREPL crashes.
2 parents dc55182 + fa88d6b commit 767c955

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

lldb/source/Expression/REPL.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ void REPL::IOHandlerComplete(IOHandler &io_handler,
475475
// Strip spaces from the line and see if we had only spaces
476476
if (request.GetRawLineUntilCursor().trim().empty()) {
477477
// Only spaces on this line, so just indent
478-
request.AddCompletion(m_indent_str);
478+
request.AddCompletion(m_indent_str, "", CompletionMode::Partial);
479479
return;
480480
}
481481

lldb/source/Plugins/ExpressionParser/Swift/SwiftREPL.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,6 @@ int SwiftREPL::CompleteCode(const std::string &current_code,
553553
llvm::dyn_cast_or_null<SwiftASTContext>(&*type_system_or_err);
554554
if (target_swift_ast)
555555
m_swift_ast_sp.reset(new SwiftASTContext(*target_swift_ast));
556-
auto &ctx = *m_swift_ast_sp.get()->GetASTContext();
557-
swift::registerIDERequestFunctions(ctx.evaluator);
558-
swift::registerTypeCheckerRequestFunctions(ctx.evaluator);
559-
swift::createTypeChecker(ctx);
560556
}
561557
SwiftASTContext *swift_ast = m_swift_ast_sp.get();
562558

lldb/source/Symbol/SwiftASTContext.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3467,6 +3467,7 @@ swift::ASTContext *SwiftASTContext::GetASTContext() {
34673467

34683468
// Set up the required state for the evaluator in the TypeChecker.
34693469
(void)swift::createTypeChecker(*m_ast_context_ap);
3470+
registerIDERequestFunctions(m_ast_context_ap->evaluator);
34703471
registerParseRequestFunctions(m_ast_context_ap->evaluator);
34713472
registerTypeCheckerRequestFunctions(m_ast_context_ap->evaluator);
34723473

0 commit comments

Comments
 (0)