[Lldb-commits] [lldb] r294202 - Switch std::call_once to llvm::call_once

Kamil Rytarowski via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 6 09:55:04 PST 2017


Author: kamil
Date: Mon Feb  6 11:55:02 2017
New Revision: 294202

URL: http://llvm.org/viewvc/llvm-project?rev=294202&view=rev
Log:
Switch std::call_once to llvm::call_once

Summary:
The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms.

This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, mehdi_amini, clayborg

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D29288

Modified:
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/source/Commands/CommandObjectPlatform.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/ModuleList.cpp
    lldb/trunk/source/Host/common/Editline.cpp
    lldb/trunk/source/Host/common/HostInfoBase.cpp
    lldb/trunk/source/Host/linux/HostInfoLinux.cpp
    lldb/trunk/source/Host/windows/HostInfoWindows.cpp
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
    lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
    lldb/trunk/source/Plugins/Language/Go/GoLanguage.cpp
    lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp
    lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
    lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
    lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
    lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
    lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
    lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
    lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
    lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
    lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
    lldb/trunk/source/Symbol/ClangASTContext.cpp
    lldb/trunk/source/Symbol/GoASTContext.cpp
    lldb/trunk/source/Target/Language.cpp
    lldb/trunk/source/Utility/ConstString.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Mon Feb  6 11:55:02 2017
@@ -34,6 +34,8 @@
 #include "lldb/Target/TargetList.h"
 #include "lldb/lldb-public.h"
 
+#include "llvm/Support/Threading.h"
+
 namespace llvm {
 namespace sys {
 class DynamicLibrary;
@@ -374,7 +376,7 @@ protected:
   HostThread m_io_handler_thread;
   Broadcaster m_sync_broadcaster;
   lldb::ListenerSP m_forward_listener_sp;
-  std::once_flag m_clear_once;
+  llvm::once_flag m_clear_once;
 
   //----------------------------------------------------------------------
   // Events for m_sync_broadcaster

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Mon Feb  6 11:55:02 2017
@@ -29,6 +29,7 @@
 #include "lldb/Target/Process.h"
 
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Support/Threading.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -1248,8 +1249,8 @@ protected:
   public:
     CommandOptions()
         : Options(), match_info(), show_args(false), verbose(false) {
-      static std::once_flag g_once_flag;
-      std::call_once(g_once_flag, []() {
+      static llvm::once_flag g_once_flag;
+      llvm::call_once(g_once_flag, []() {
         PosixPlatformCommandOptionValidator *posix_validator =
             new PosixPlatformCommandOptionValidator();
         for (auto &Option : g_platform_process_list_options) {

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Mon Feb  6 11:55:02 2017
@@ -17,6 +17,7 @@
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DynamicLibrary.h"
+#include "llvm/Support/Threading.h"
 
 // Project includes
 #include "lldb/Core/FormatEntity.h"
@@ -762,7 +763,7 @@ void Debugger::Clear() {
   //     static void Debugger::Destroy(lldb::DebuggerSP &debugger_sp);
   //     static void Debugger::Terminate();
   //----------------------------------------------------------------------
-  std::call_once(m_clear_once, [this]() {
+  llvm::call_once(m_clear_once, [this]() {
     ClearIOHandlers();
     StopIOHandlerThread();
     StopEventHandlerThread();

Modified: lldb/trunk/source/Core/ModuleList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Core/ModuleList.cpp (original)
+++ lldb/trunk/source/Core/ModuleList.cpp Mon Feb  6 11:55:02 2017
@@ -26,6 +26,8 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/VariableList.h"
 
+#include "llvm/Support/Threading.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -644,8 +646,8 @@ size_t ModuleList::GetIndexForModule(con
 
 static ModuleList &GetSharedModuleList() {
   static ModuleList *g_shared_module_list = nullptr;
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     // NOTE: Intentionally leak the module list so a program doesn't have to
     // cleanup all modules and object files as it exits. This just wastes time
     // doing a bunch of cleanup that isn't required.

Modified: lldb/trunk/source/Host/common/Editline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Editline.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/Editline.cpp (original)
+++ lldb/trunk/source/Host/common/Editline.cpp Mon Feb  6 11:55:02 2017
@@ -22,6 +22,8 @@
 #include "lldb/Utility/SelectHelper.h"
 #include "lldb/Utility/StreamString.h"
 
+#include "llvm/Support/Threading.h"
+
 using namespace lldb_private;
 using namespace lldb_private::line_editor;
 
@@ -1151,8 +1153,8 @@ Editline::Editline(const char *editline_
     if (term_fd != -1) {
       static std::mutex *g_init_terminal_fds_mutex_ptr = nullptr;
       static std::set<int> *g_init_terminal_fds_ptr = nullptr;
-      static std::once_flag g_once_flag;
-      std::call_once(g_once_flag, [&]() {
+      static llvm::once_flag g_once_flag;
+      llvm::call_once(g_once_flag, [&]() {
         g_init_terminal_fds_mutex_ptr =
             new std::mutex(); // NOTE: Leak to avoid C++ destructor chain issues
         g_init_terminal_fds_ptr = new std::set<int>(); // NOTE: Leak to avoid

Modified: lldb/trunk/source/Host/common/HostInfoBase.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/HostInfoBase.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/HostInfoBase.cpp (original)
+++ lldb/trunk/source/Host/common/HostInfoBase.cpp Mon Feb  6 11:55:02 2017
@@ -22,9 +22,10 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
 
-#include <mutex> // std::once
+#include <mutex>
 #include <thread>
 
 using namespace lldb;
@@ -79,8 +80,8 @@ void HostInfoBase::Terminate() {
 }
 
 uint32_t HostInfoBase::GetNumberCPUS() {
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     g_fields->m_number_cpus = std::thread::hardware_concurrency();
   });
   return g_fields->m_number_cpus;
@@ -89,8 +90,8 @@ uint32_t HostInfoBase::GetNumberCPUS() {
 uint32_t HostInfoBase::GetMaxThreadNameLength() { return 0; }
 
 llvm::StringRef HostInfoBase::GetVendorString() {
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     g_fields->m_vendor_string =
         HostInfo::GetArchitecture().GetTriple().getVendorName().str();
   });
@@ -98,8 +99,8 @@ llvm::StringRef HostInfoBase::GetVendorS
 }
 
 llvm::StringRef HostInfoBase::GetOSString() {
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     g_fields->m_os_string =
         std::move(HostInfo::GetArchitecture().GetTriple().getOSName());
   });
@@ -107,8 +108,8 @@ llvm::StringRef HostInfoBase::GetOSStrin
 }
 
 llvm::StringRef HostInfoBase::GetTargetTriple() {
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     g_fields->m_host_triple =
         HostInfo::GetArchitecture().GetTriple().getTriple();
   });
@@ -116,8 +117,8 @@ llvm::StringRef HostInfoBase::GetTargetT
 }
 
 const ArchSpec &HostInfoBase::GetArchitecture(ArchitectureKind arch_kind) {
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     HostInfo::ComputeHostArchitectureSupport(g_fields->m_host_arch_32,
                                              g_fields->m_host_arch_64);
   });
@@ -144,9 +145,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
   FileSpec *result = nullptr;
   switch (type) {
   case lldb::ePathTypeLLDBShlibDir: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success =
           HostInfo::ComputeSharedLibraryDirectory(g_fields->m_lldb_so_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
@@ -158,9 +159,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_so_dir;
   } break;
   case lldb::ePathTypeSupportExecutableDir: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success = HostInfo::ComputeSupportExeDirectory(
           g_fields->m_lldb_support_exe_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
@@ -173,9 +174,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_support_exe_dir;
   } break;
   case lldb::ePathTypeHeaderDir: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success = HostInfo::ComputeHeaderDirectory(g_fields->m_lldb_headers_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
       if (log)
@@ -186,9 +187,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_headers_dir;
   } break;
   case lldb::ePathTypePythonDir: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success = HostInfo::ComputePythonDirectory(g_fields->m_lldb_python_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
       if (log)
@@ -199,9 +200,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_python_dir;
   } break;
   case lldb::ePathTypeClangDir: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success =
           HostInfo::ComputeClangDirectory(g_fields->m_lldb_clang_resource_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
@@ -214,9 +215,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_clang_resource_dir;
   } break;
   case lldb::ePathTypeLLDBSystemPlugins: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success = HostInfo::ComputeSystemPluginsDirectory(
           g_fields->m_lldb_system_plugin_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
@@ -229,9 +230,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_system_plugin_dir;
   } break;
   case lldb::ePathTypeLLDBUserPlugins: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success = HostInfo::ComputeUserPluginsDirectory(
           g_fields->m_lldb_user_plugin_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
@@ -244,9 +245,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_user_plugin_dir;
   } break;
   case lldb::ePathTypeLLDBTempSystemDir: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success = HostInfo::ComputeProcessTempFileDirectory(
           g_fields->m_lldb_process_tmp_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);
@@ -259,9 +260,9 @@ bool HostInfoBase::GetLLDBPath(lldb::Pat
       result = &g_fields->m_lldb_process_tmp_dir;
   } break;
   case lldb::ePathTypeGlobalLLDBTempSystemDir: {
-    static std::once_flag g_once_flag;
+    static llvm::once_flag g_once_flag;
     static bool success = false;
-    std::call_once(g_once_flag, []() {
+    llvm::call_once(g_once_flag, []() {
       success = HostInfo::ComputeGlobalTempFileDirectory(
           g_fields->m_lldb_global_tmp_dir);
       Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST);

Modified: lldb/trunk/source/Host/linux/HostInfoLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/HostInfoLinux.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/HostInfoLinux.cpp (original)
+++ lldb/trunk/source/Host/linux/HostInfoLinux.cpp Mon Feb  6 11:55:02 2017
@@ -10,6 +10,8 @@
 #include "lldb/Host/linux/HostInfoLinux.h"
 #include "lldb/Core/Log.h"
 
+#include "llvm/Support/Threading.h"
+
 #include <limits.h>
 #include <stdio.h>
 #include <string.h>
@@ -44,8 +46,8 @@ uint32_t HostInfoLinux::GetMaxThreadName
 bool HostInfoLinux::GetOSVersion(uint32_t &major, uint32_t &minor,
                                  uint32_t &update) {
   static bool success = false;
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
 
     struct utsname un;
     if (uname(&un) == 0) {
@@ -100,8 +102,8 @@ bool HostInfoLinux::GetOSKernelDescripti
 llvm::StringRef HostInfoLinux::GetDistributionId() {
   // Try to run 'lbs_release -i', and use that response
   // for the distribution id.
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
 
     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST));
     if (log)

Modified: lldb/trunk/source/Host/windows/HostInfoWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostInfoWindows.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/HostInfoWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp Mon Feb  6 11:55:02 2017
@@ -18,6 +18,7 @@
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
 
 using namespace lldb_private;
@@ -90,8 +91,8 @@ bool HostInfoWindows::GetHostname(std::s
 }
 
 FileSpec HostInfoWindows::GetProgramFileSpec() {
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     std::vector<wchar_t> buffer(PATH_MAX);
     ::GetModuleFileNameW(NULL, buffer.data(), buffer.size());
     std::string path;

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp Mon Feb  6 11:55:02 2017
@@ -21,6 +21,7 @@
 #include "clang/Sema/Lookup.h"
 #include "clang/Serialization/ASTReader.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/Threading.h"
 
 // Project includes
 #include "ClangModulesDeclVendor.h"
@@ -143,9 +144,9 @@ void StoringDiagnosticConsumer::DumpDiag
 static FileSpec GetResourceDir() {
   static FileSpec g_cached_resource_dir;
 
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     HostInfo::GetLLDBPath(lldb::ePathTypeClangDir, g_cached_resource_dir);
   });
 

Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp Mon Feb  6 11:55:02 2017
@@ -21,6 +21,7 @@
 
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Threading.h"
 
 // Project includes
 #include "lldb/Core/FastDemangle.h"
@@ -1036,10 +1037,10 @@ std::unique_ptr<Language::TypeScavenger>
 }
 
 lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
   static TypeCategoryImplSP g_category;
 
-  std::call_once(g_initialize, [this]() -> void {
+  llvm::call_once(g_initialize, [this]() -> void {
     DataVisualization::Categories::GetCategory(GetPluginName(), g_category);
     if (g_category) {
       LoadLibCxxFormatters(g_category);
@@ -1052,11 +1053,11 @@ lldb::TypeCategoryImplSP CPlusPlusLangua
 
 HardcodedFormatters::HardcodedSummaryFinder
 CPlusPlusLanguage::GetHardcodedSummaries() {
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
   static ConstString g_vectortypes("VectorTypes");
   static HardcodedFormatters::HardcodedSummaryFinder g_formatters;
 
-  std::call_once(g_initialize, []() -> void {
+  llvm::call_once(g_initialize, []() -> void {
     g_formatters.push_back(
         [](lldb_private::ValueObject &valobj, lldb::DynamicValueType,
            FormatManager &) -> TypeSummaryImpl::SharedPointer {
@@ -1116,11 +1117,11 @@ CPlusPlusLanguage::GetHardcodedSummaries
 
 HardcodedFormatters::HardcodedSyntheticFinder
 CPlusPlusLanguage::GetHardcodedSynthetics() {
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
   static ConstString g_vectortypes("VectorTypes");
   static HardcodedFormatters::HardcodedSyntheticFinder g_formatters;
 
-  std::call_once(g_initialize, []() -> void {
+  llvm::call_once(g_initialize, []() -> void {
     g_formatters.push_back([](lldb_private::ValueObject &valobj,
                               lldb::DynamicValueType,
                               FormatManager &

Modified: lldb/trunk/source/Plugins/Language/Go/GoLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/Go/GoLanguage.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/Go/GoLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/Go/GoLanguage.cpp Mon Feb  6 11:55:02 2017
@@ -15,6 +15,7 @@
 
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Threading.h"
 
 // Project includes
 #include "GoLanguage.h"
@@ -62,10 +63,10 @@ Language *GoLanguage::CreateInstance(lld
 
 HardcodedFormatters::HardcodedSummaryFinder
 GoLanguage::GetHardcodedSummaries() {
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
   static HardcodedFormatters::HardcodedSummaryFinder g_formatters;
 
-  std::call_once(g_initialize, []() -> void {
+  llvm::call_once(g_initialize, []() -> void {
     g_formatters.push_back(
         [](lldb_private::ValueObject &valobj, lldb::DynamicValueType,
            FormatManager &) -> TypeSummaryImpl::SharedPointer {
@@ -104,10 +105,10 @@ GoLanguage::GetHardcodedSummaries() {
 
 HardcodedFormatters::HardcodedSyntheticFinder
 GoLanguage::GetHardcodedSynthetics() {
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
   static HardcodedFormatters::HardcodedSyntheticFinder g_formatters;
 
-  std::call_once(g_initialize, []() -> void {
+  llvm::call_once(g_initialize, []() -> void {
     g_formatters.push_back(
         [](lldb_private::ValueObject &valobj, lldb::DynamicValueType,
            FormatManager &fmt_mgr) -> SyntheticChildren::SharedPointer {

Modified: lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/Java/JavaLanguage.cpp Mon Feb  6 11:55:02 2017
@@ -15,6 +15,7 @@
 
 // Other libraries and framework includes
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Threading.h"
 
 // Project includes
 #include "JavaFormatterFunctions.h"
@@ -64,10 +65,10 @@ bool JavaLanguage::IsNilReference(ValueO
 }
 
 lldb::TypeCategoryImplSP JavaLanguage::GetFormatters() {
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
   static TypeCategoryImplSP g_category;
 
-  std::call_once(g_initialize, [this]() -> void {
+  llvm::call_once(g_initialize, [this]() -> void {
     DataVisualization::Categories::GetCategory(GetPluginName(), g_category);
     if (g_category) {
       llvm::StringRef array_regexp("^.*\\[\\]&?$");

Modified: lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp (original)
+++ lldb/trunk/source/Plugins/Language/ObjC/ObjCLanguage.cpp Mon Feb  6 11:55:02 2017
@@ -26,6 +26,8 @@
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/StreamString.h"
 
+#include "llvm/Support/Threading.h"
+
 #include "CF.h"
 #include "Cocoa.h"
 #include "CoreMedia.h"
@@ -857,10 +859,10 @@ static void LoadCoreMediaFormatters(Type
 }
 
 lldb::TypeCategoryImplSP ObjCLanguage::GetFormatters() {
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
   static TypeCategoryImplSP g_category;
 
-  std::call_once(g_initialize, [this]() -> void {
+  llvm::call_once(g_initialize, [this]() -> void {
     DataVisualization::Categories::GetCategory(GetPluginName(), g_category);
     if (g_category) {
       LoadCoreMediaFormatters(g_category);

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Mon Feb  6 11:55:02 2017
@@ -242,8 +242,8 @@ FileSpec PlatformAppleSimulator::GetCore
 
 void PlatformAppleSimulator::LoadCoreSimulator() {
 #if defined(__APPLE__)
-  static std::once_flag g_load_core_sim_flag;
-  std::call_once(g_load_core_sim_flag, [this] {
+  static llvm::once_flag g_load_core_sim_flag;
+  llvm::call_once(g_load_core_sim_flag, [this] {
     const std::string core_sim_path(GetCoreSimulatorPath().GetPath());
     if (core_sim_path.size())
       dlopen(core_sim_path.c_str(), RTLD_LAZY);

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Mon Feb  6 11:55:02 2017
@@ -40,6 +40,7 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/Error.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/Threading.h"
 
 #if defined(__APPLE__)
 #include <TargetConditionals.h> // for TARGET_OS_TV, TARGET_OS_WATCH
@@ -1310,8 +1311,8 @@ static FileSpec CheckPathForXcode(const
 
 static FileSpec GetXcodeContentsPath() {
   static FileSpec g_xcode_filespec;
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
 
     FileSpec fspec;
 
@@ -1693,8 +1694,8 @@ lldb_private::FileSpec PlatformDarwin::L
 
   // Find the global list of directories that we will search for
   // executables once so we don't keep doing the work over and over.
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
 
     // When locating executables, trust the DEVELOPER_DIR first if it is set
     FileSpec xcode_contents_dir = GetXcodeContentsPath();

Modified: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp Mon Feb  6 11:55:02 2017
@@ -46,6 +46,8 @@
 
 #include "lldb/Host/posix/Fcntl.h"
 
+#include "llvm/Support/Threading.h"
+
 using namespace lldb;
 using namespace lldb_private;
 
@@ -71,9 +73,9 @@ ProcessFreeBSD::CreateInstance(lldb::Tar
 }
 
 void ProcessFreeBSD::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(), CreateInstance);
     ProcessPOSIXLog::Initialize(GetPluginNameStatic());

Modified: lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/NativeProcessLinux.cpp Mon Feb  6 11:55:02 2017
@@ -75,9 +75,9 @@ using namespace llvm;
 
 static bool ProcessVmReadvSupported() {
   static bool is_supported;
-  static std::once_flag flag;
+  static llvm::once_flag flag;
 
-  std::call_once(flag, [] {
+  llvm::call_once(flag, [] {
     Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
 
     uint32_t source = 0x47424742;

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Mon Feb  6 11:55:02 2017
@@ -39,6 +39,8 @@
 #include "lldb/Target/Thread.h"
 #include "lldb/Utility/StringExtractor.h"
 
+#include "llvm/Support/Threading.h"
+
 #define USEC_PER_SEC 1000000
 
 // Project includes
@@ -718,9 +720,9 @@ Error ProcessKDP::DoSignal(int signo) {
 }
 
 void ProcessKDP::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(), CreateInstance,
                                   DebuggerInitialize);

Modified: lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp Mon Feb  6 11:55:02 2017
@@ -15,6 +15,8 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Interpreter/Args.h"
 
+#include "llvm/Support/Threading.h"
+
 #include "ProcessPOSIXLog.h"
 
 using namespace lldb;
@@ -33,9 +35,9 @@ static Log *GetLog() {
 }
 
 void ProcessPOSIXLog::Initialize(ConstString name) {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, [name]() {
+  llvm::call_once(g_once_flag, [name]() {
     Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories};
 
     Log::RegisterLogChannel(name, log_callbacks);

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp Mon Feb  6 11:55:02 2017
@@ -30,6 +30,7 @@
 
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "DebuggerThread.h"
@@ -102,9 +103,9 @@ ProcessSP ProcessWindows::CreateInstance
 }
 
 void ProcessWindows::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(), CreateInstance);
   });

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp Mon Feb  6 11:55:02 2017
@@ -14,6 +14,7 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Interpreter/Args.h"
 #include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/Threading.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -25,12 +26,12 @@ using namespace lldb_private;
 static bool g_log_enabled = false;
 static Log *g_log = nullptr;
 
-static llvm::ManagedStatic<std::once_flag> g_once_flag;
+static llvm::ManagedStatic<llvm::once_flag> g_once_flag;
 
 void ProcessWindowsLog::Initialize() {
   static ConstString g_name("windows");
 
-  std::call_once(*g_once_flag, []() {
+  llvm::call_once(*g_once_flag, []() {
     Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories};
 
     Log::RegisterLogChannel(g_name, log_callbacks);

Modified: lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/elf-core/ProcessElfCore.cpp Mon Feb  6 11:55:02 2017
@@ -27,6 +27,7 @@
 #include "lldb/Target/UnixSignals.h"
 
 #include "llvm/Support/ELF.h"
+#include "llvm/Support/Threading.h"
 
 #include "Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h"
 #include "Plugins/ObjectFile/ELF/ObjectFileELF.h"
@@ -400,9 +401,9 @@ void ProcessElfCore::Clear() {
 }
 
 void ProcessElfCore::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(), CreateInstance);
   });

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp Mon Feb  6 11:55:02 2017
@@ -20,6 +20,7 @@
 
 // Other libraries and framework includes
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Threading.h"
 
 #include "lldb/Core/Log.h"
 #include "lldb/Core/StreamGDBRemote.h"
@@ -528,9 +529,9 @@ bool GDBRemoteCommunicationServerPlatfor
 
 const FileSpec &GDBRemoteCommunicationServerPlatform::GetDomainSocketDir() {
   static FileSpec g_domainsocket_dir;
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     const char *domainsocket_dir_env =
         ::getenv("LLDB_DEBUGSERVER_DOMAINSOCKET_DIR");
     if (domainsocket_dir_env != nullptr)

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Mon Feb  6 11:55:02 2017
@@ -81,6 +81,7 @@
 
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Threading.h"
 
 #define DEBUGSERVER_BASENAME "debugserver"
 using namespace lldb;
@@ -3434,9 +3435,9 @@ void ProcessGDBRemote::KillDebugserverPr
 }
 
 void ProcessGDBRemote::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(), CreateInstance,
                                   DebuggerInitialize);

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp Mon Feb  6 11:55:02 2017
@@ -14,6 +14,8 @@
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Interpreter/Args.h"
 
+#include "llvm/Support/Threading.h"
+
 #include "ProcessGDBRemote.h"
 
 using namespace lldb;
@@ -34,9 +36,9 @@ static Log *GetLog() {
 
 void ProcessGDBRemoteLog::Initialize() {
   static ConstString g_name("gdb-remote");
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories};
 
     Log::RegisterLogChannel(g_name, log_callbacks);

Modified: lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp (original)
+++ lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Mon Feb  6 11:55:02 2017
@@ -14,6 +14,7 @@
 
 // C++ Includes
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/Threading.h"
 #include <mutex>
 
 // Other libraries and framework includes
@@ -579,9 +580,9 @@ Error ProcessMachCore::GetMemoryRegionIn
 void ProcessMachCore::Clear() { m_thread_list.Clear(); }
 
 void ProcessMachCore::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(), CreateInstance);
   });

Modified: lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp (original)
+++ lldb/trunk/source/Plugins/Process/minidump/ProcessMinidump.cpp Mon Feb  6 11:55:02 2017
@@ -25,6 +25,8 @@
 #include "lldb/Target/UnixSignals.h"
 #include "lldb/Utility/LLDBAssert.h"
 
+#include "llvm/Support/Threading.h"
+
 // C includes
 // C++ includes
 
@@ -92,9 +94,9 @@ ProcessMinidump::~ProcessMinidump() {
 }
 
 void ProcessMinidump::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(),
                                   ProcessMinidump::CreateInstance);

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp Mon Feb  6 11:55:02 2017
@@ -15,6 +15,8 @@
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Utility/Stream.h"
 
+#include "llvm/Support/Threading.h"
+
 #include <mutex>
 
 using namespace lldb;
@@ -39,9 +41,9 @@ void ScriptInterpreterNone::ExecuteInter
 }
 
 void ScriptInterpreterNone::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(),
                                   lldb::eScriptLanguageNone, CreateInstance);

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Mon Feb  6 11:55:02 2017
@@ -326,9 +326,9 @@ ScriptInterpreterPython::~ScriptInterpre
 }
 
 void ScriptInterpreterPython::Initialize() {
-  static std::once_flag g_once_flag;
+  static llvm::once_flag g_once_flag;
 
-  std::call_once(g_once_flag, []() {
+  llvm::call_once(g_once_flag, []() {
     PluginManager::RegisterPlugin(GetPluginNameStatic(),
                                   GetPluginDescriptionStatic(),
                                   lldb::eScriptLanguagePython, CreateInstance);

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Mon Feb  6 11:55:02 2017
@@ -11,6 +11,7 @@
 
 // Other libraries and framework includes
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/Threading.h"
 
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Core/Module.h"
@@ -553,8 +554,9 @@ uint32_t SymbolFileDWARF::CalculateAbili
 const DWARFDataExtractor &
 SymbolFileDWARF::GetCachedSectionData(lldb::SectionType sect_type,
                                       DWARFDataSegment &data_segment) {
-  std::call_once(data_segment.m_flag, &SymbolFileDWARF::LoadSectionData, this,
-                 sect_type, std::ref(data_segment.m_data));
+  llvm::call_once(data_segment.m_flag, [this, sect_type, &data_segment] {
+    this->LoadSectionData(sect_type, std::ref(data_segment.m_data));
+  });
   return data_segment.m_data;
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Mon Feb  6 11:55:02 2017
@@ -21,6 +21,7 @@
 
 // Other libraries and framework includes
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Threading.h"
 
 #include "lldb/Core/Flags.h"
 #include "lldb/Core/RangeMap.h"
@@ -305,7 +306,7 @@ protected:
   typedef llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> ClangTypeToDIE;
 
   struct DWARFDataSegment {
-    std::once_flag m_flag;
+    llvm::once_flag m_flag;
     lldb_private::DWARFDataExtractor m_data;
   };
 

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Mon Feb  6 11:55:02 2017
@@ -14,7 +14,7 @@
 
 // C Includes
 // C++ Includes
-#include <mutex> // std::once
+#include <mutex>
 #include <string>
 #include <vector>
 
@@ -65,6 +65,7 @@
 #endif
 
 #include "llvm/Support/Signals.h"
+#include "llvm/Support/Threading.h"
 
 #include "Plugins/ExpressionParser/Clang/ClangFunctionCaller.h"
 #include "Plugins/ExpressionParser/Clang/ClangUserExpression.h"
@@ -127,8 +128,8 @@ typedef lldb_private::ThreadSafeDenseMap
 
 static ClangASTMap &GetASTMap() {
   static ClangASTMap *g_map_ptr = nullptr;
-  static std::once_flag g_once_flag;
-  std::call_once(g_once_flag, []() {
+  static llvm::once_flag g_once_flag;
+  llvm::call_once(g_once_flag, []() {
     g_map_ptr = new ClangASTMap(); // leaked on purpose to avoid spins
   });
   return *g_map_ptr;
@@ -954,8 +955,8 @@ ClangASTContext::GetBasicTypeEnumeration
   if (name) {
     typedef UniqueCStringMap<lldb::BasicType> TypeNameToBasicTypeMap;
     static TypeNameToBasicTypeMap g_type_map;
-    static std::once_flag g_once_flag;
-    std::call_once(g_once_flag, []() {
+    static llvm::once_flag g_once_flag;
+    llvm::call_once(g_once_flag, []() {
       // "void"
       g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid);
 

Modified: lldb/trunk/source/Symbol/GoASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/GoASTContext.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/GoASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/GoASTContext.cpp Mon Feb  6 11:55:02 2017
@@ -25,6 +25,8 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Target.h"
 
+#include "llvm/Support/Threading.h"
+
 #include "Plugins/ExpressionParser/Go/GoUserExpression.h"
 #include "Plugins/SymbolFile/DWARF/DWARFASTParserGo.h"
 
@@ -593,8 +595,8 @@ GoASTContext::GetBasicTypeEnumeration(ll
   if (name) {
     typedef UniqueCStringMap<lldb::BasicType> TypeNameToBasicTypeMap;
     static TypeNameToBasicTypeMap g_type_map;
-    static std::once_flag g_once_flag;
-    std::call_once(g_once_flag, []() {
+    static llvm::once_flag g_once_flag;
+    llvm::call_once(g_once_flag, []() {
       // "void"
       g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid);
       // "int"

Modified: lldb/trunk/source/Target/Language.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Language.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Target/Language.cpp (original)
+++ lldb/trunk/source/Target/Language.cpp Mon Feb  6 11:55:02 2017
@@ -20,6 +20,8 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/Stream.h"
 
+#include "llvm/Support/Threading.h"
+
 using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::formatters;
@@ -29,9 +31,9 @@ typedef std::map<lldb::LanguageType, Lan
 
 static LanguagesMap &GetLanguagesMap() {
   static LanguagesMap *g_map = nullptr;
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
 
-  std::call_once(g_initialize, [] {
+  llvm::call_once(g_initialize, [] {
     g_map = new LanguagesMap(); // NOTE: INTENTIONAL LEAK due to global
                                 // destructor chain
   });
@@ -40,9 +42,9 @@ static LanguagesMap &GetLanguagesMap() {
 }
 static std::mutex &GetLanguagesMutex() {
   static std::mutex *g_mutex = nullptr;
-  static std::once_flag g_initialize;
+  static llvm::once_flag g_initialize;
 
-  std::call_once(g_initialize, [] {
+  llvm::call_once(g_initialize, [] {
     g_mutex = new std::mutex(); // NOTE: INTENTIONAL LEAK due to global
                                 // destructor chain
   });

Modified: lldb/trunk/source/Utility/ConstString.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ConstString.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ConstString.cpp (original)
+++ lldb/trunk/source/Utility/ConstString.cpp Mon Feb  6 11:55:02 2017
@@ -20,6 +20,7 @@
 #include "llvm/Support/RWMutex.h"
 
 // Project includes
+#include "llvm/Support/Threading.h"
 #include "lldb/Utility/Stream.h"
 
 using namespace lldb_private;
@@ -191,10 +192,10 @@ protected:
 // touch ConstStrings is difficult.  So we leak the pool instead.
 //----------------------------------------------------------------------
 static Pool &StringPool() {
-  static std::once_flag g_pool_initialization_flag;
+  static llvm::once_flag g_pool_initialization_flag;
   static Pool *g_string_pool = nullptr;
 
-  std::call_once(g_pool_initialization_flag,
+  llvm::call_once(g_pool_initialization_flag,
                  []() { g_string_pool = new Pool(); });
 
   return *g_string_pool;

Modified: lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp?rev=294202&r1=294201&r2=294202&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp Mon Feb  6 11:55:02 2017
@@ -46,10 +46,10 @@ static os_activity_stream_set_event_hand
     s_os_activity_stream_set_event_handler;
 
 bool LookupSPICalls() {
-  static std::once_flag s_once_flag;
+  static llvm::once_flag s_once_flag;
   static bool s_has_spi;
 
-  std::call_once(s_once_flag, [] {
+  llvm::call_once(s_once_flag, [] {
     dlopen ("/System/Library/PrivateFrameworks/LoggingSupport.framework/LoggingSupport", RTLD_NOW);
     s_os_activity_stream_for_pid = (os_activity_stream_for_pid_t)dlsym(
         RTLD_DEFAULT, "os_activity_stream_for_pid");




More information about the lldb-commits mailing list