[lldb/Platform] Synchronize access to SDK String Map.

The SwiftASTContext queries this function in parallel and requires
synchronization.
This commit is contained in:
Jonas Devlieghere 2020-04-28 19:20:06 -07:00
parent b14c37a29a
commit 75c3d6f49c
2 changed files with 2 additions and 0 deletions

View File

@ -1762,6 +1762,7 @@ PlatformDarwin::FindXcodeContentsDirectoryInPath(llvm::StringRef path) {
}
std::string PlatformDarwin::GetSDKPath(XcodeSDK sdk) {
std::lock_guard<std::mutex> guard(m_sdk_path_mutex);
std::string &path = m_sdk_path[sdk.GetString()];
if (!path.empty())
return path;

View File

@ -171,6 +171,7 @@ protected:
std::string m_developer_directory;
llvm::StringMap<std::string> m_sdk_path;
std::mutex m_sdk_path_mutex;
private:
DISALLOW_COPY_AND_ASSIGN(PlatformDarwin);