From 75c3d6f49c450a8b522a6731c317e75b73a2f5a3 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 28 Apr 2020 19:20:06 -0700 Subject: [PATCH] [lldb/Platform] Synchronize access to SDK String Map. The SwiftASTContext queries this function in parallel and requires synchronization. --- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp | 1 + lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 5252d37..6a00afb 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1762,6 +1762,7 @@ PlatformDarwin::FindXcodeContentsDirectoryInPath(llvm::StringRef path) { } std::string PlatformDarwin::GetSDKPath(XcodeSDK sdk) { + std::lock_guard guard(m_sdk_path_mutex); std::string &path = m_sdk_path[sdk.GetString()]; if (!path.empty()) return path; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h index d3b4181..e4f7173 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -171,6 +171,7 @@ protected: std::string m_developer_directory; llvm::StringMap m_sdk_path; + std::mutex m_sdk_path_mutex; private: DISALLOW_COPY_AND_ASSIGN(PlatformDarwin); -- 2.7.4