[Lldb-commits] [lldb] 75c3d6f - [lldb/Platform] Synchronize access to SDK String Map.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 28 19:22:09 PDT 2020


Author: Jonas Devlieghere
Date: 2020-04-28T19:21:58-07:00
New Revision: 75c3d6f49c450a8b522a6731c317e75b73a2f5a3

URL: https://github.com/llvm/llvm-project/commit/75c3d6f49c450a8b522a6731c317e75b73a2f5a3
DIFF: https://github.com/llvm/llvm-project/commit/75c3d6f49c450a8b522a6731c317e75b73a2f5a3.diff

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

The SwiftASTContext queries this function in parallel and requires
synchronization.

Added: 
    

Modified: 
    lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 5252d37a01c5..6a00afba68ca 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<std::mutex> 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 d3b4181aafa0..e4f717380e8b 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -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);


        


More information about the lldb-commits mailing list