Skip to content

Commit 4aaf969

Browse files
Merge pull request #9640 from adrian-prantl/cherry-pick-swift-release-6.1-lldb-Acquire-the-map-lock-after-deriving-the-lookup-key
[Cherry-pick into swift/release/6.1] [lldb] Acquire the map lock after deriving the lookup key
2 parents 4ac4822 + da6ebe8 commit 4aaf969

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,7 +1912,6 @@ SwiftASTContext *TypeSystemSwiftTypeRefForExpressions::GetSwiftASTContext(
19121912
SwiftASTContext *TypeSystemSwiftTypeRef::GetSwiftASTContextOrNull(
19131913
const SymbolContext &sc) const {
19141914
std::lock_guard<std::mutex> guard(m_swift_ast_context_lock);
1915-
19161915
const char *key = nullptr;
19171916
auto it = m_swift_ast_context_map.find(key);
19181917
if (it != m_swift_ast_context_map.end())
@@ -1922,9 +1921,9 @@ SwiftASTContext *TypeSystemSwiftTypeRef::GetSwiftASTContextOrNull(
19221921

19231922
SwiftASTContext *TypeSystemSwiftTypeRefForExpressions::GetSwiftASTContextOrNull(
19241923
const SymbolContext &sc) const {
1925-
std::lock_guard<std::mutex> guard(m_swift_ast_context_lock);
1926-
19271924
const char *key = DeriveKeyFor(sc);
1925+
1926+
std::lock_guard<std::mutex> guard(m_swift_ast_context_lock);
19281927
auto it = m_swift_ast_context_map.find(key);
19291928
if (it != m_swift_ast_context_map.end())
19301929
return llvm::cast_or_null<SwiftASTContext>(it->second.typesystem.get());

0 commit comments

Comments
 (0)