Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lldb/source/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2286,6 +2286,9 @@ Target::GetScratchTypeSystemForLanguage(lldb::LanguageType language,
// thread) is holding a read lock to the scratch context and
// replacing it could cause a use-after-free later on.
if (GetSwiftScratchContextLock().try_lock()) {
auto unlock = llvm::make_scope_exit([this] {
GetSwiftScratchContextLock().unlock();
});
if (m_use_scratch_typesystem_per_module)
DisplayFallbackSwiftContextErrors(swift_ast_ctx);
else if (StreamSP errs = GetDebugger().GetAsyncErrorStream()) {
Expand Down Expand Up @@ -2335,7 +2338,6 @@ Target::GetScratchTypeSystemForLanguage(lldb::LanguageType language,
llvm::make_error<llvm::StringError>("DIAF", llvm::inconvertibleErrorCode());
}
}
GetSwiftScratchContextLock().unlock();
}
}
} else if (create_on_demand) {
Expand Down