Skip to content

Commit a192d86

Browse files
committed
Don't destroy the scratch context in the Swift REPL after importing new dylibs.
1 parent 572a29f commit a192d86

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

lldb/include/lldb/Target/Target.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ class TargetProperties : public Properties {
173173

174174
bool GetUseAllCompilerFlags() const;
175175

176+
void SetUseAllCompilerFlags(bool b);
177+
176178
ImportStdModule GetImportStdModule() const;
177179

178180
bool GetEnableAutoApplyFixIts() const;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ lldb::REPLSP SwiftREPL::CreateInstanceFromDebugger(Status &err,
146146
return nullptr;
147147
}
148148

149+
// The Swift REPL can't deal with poisoning the scratch context
150+
// in SwiftASTContext::ModulesDidLoad().
151+
target_sp->SetUseAllCompilerFlags(false);
152+
149153
// Limit the breakpoint to our executable module
150154
ModuleSP exe_module_sp(target_sp->GetExecutableModule());
151155
if (!exe_module_sp) {

lldb/source/Target/Target.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4483,6 +4483,11 @@ bool TargetProperties::GetUseAllCompilerFlags() const {
44834483
NULL, idx, g_target_properties[idx].default_uint_value != 0);
44844484
}
44854485

4486+
void TargetProperties::SetUseAllCompilerFlags(bool b) {
4487+
const uint32_t idx = ePropertyUseAllCompilerFlags;
4488+
m_collection_sp->SetPropertyAtIndexAsBoolean(nullptr, idx, b);
4489+
}
4490+
44864491
ImportStdModule TargetProperties::GetImportStdModule() const {
44874492
const uint32_t idx = ePropertyImportStdModule;
44884493
return (ImportStdModule)m_collection_sp->GetPropertyAtIndexAsEnumeration(

0 commit comments

Comments
 (0)