Skip to content

Commit

Permalink
[lldb/Platform] Synchronize access to SDK String Map.
Browse files Browse the repository at this point in the history
The SwiftASTContext queries this function in parallel and requires
synchronization.
  • Loading branch information
JDevlieghere committed Apr 29, 2020
1 parent b14c37a commit 75c3d6f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class PlatformDarwin : public PlatformPOSIX {

std::string m_developer_directory;
llvm::StringMap<std::string> m_sdk_path;
std::mutex m_sdk_path_mutex;

private:
DISALLOW_COPY_AND_ASSIGN(PlatformDarwin);
Expand Down

0 comments on commit 75c3d6f

Please sign in to comment.