From: Jonas Devlieghere Date: Wed, 29 Apr 2020 02:20:06 +0000 (-0700) Subject: [lldb/Platform] Synchronize access to SDK String Map. X-Git-Tag: llvmorg-12-init~7508 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=75c3d6f49c450a8b522a6731c317e75b73a2f5a3;p=platform%2Fupstream%2Fllvm.git [lldb/Platform] Synchronize access to SDK String Map. The SwiftASTContext queries this function in parallel and requires synchronization. --- 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);