pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lldb-netbsd: Switch std::call_once to llvm::call_once (the 1st round)



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Fri Jan 27 20:09:40 2017 +0100
Changeset:	45c49f99e4383097911a8aee3c48bb450376e235

Modified Files:
	lldb-netbsd/distinfo
	lldb-netbsd/patches/patch-source_Plugins_Process_Utility_NetBSDSignals.cpp
Added Files:
	lldb-netbsd/patches/patch-include_lldb_Core_Debugger.h
	lldb-netbsd/patches/patch-source_Commands_CommandObjectPlatform.cpp
	lldb-netbsd/patches/patch-source_Core_ConstString.cpp
	lldb-netbsd/patches/patch-source_Core_Debugger.cpp
	lldb-netbsd/patches/patch-source_Core_ModuleList.cpp
	lldb-netbsd/patches/patch-source_Host_common_Editline.cpp
	lldb-netbsd/patches/patch-source_Host_common_HostInfoBase.cpp
	lldb-netbsd/patches/patch-source_Host_linux_HostInfoLinux.cpp
	lldb-netbsd/patches/patch-source_Host_windows_HostInfoWindows.cpp
	lldb-netbsd/patches/patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp
	lldb-netbsd/patches/patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp
	lldb-netbsd/patches/patch-source_Plugins_Language_Go_GoLanguage.cpp
	lldb-netbsd/patches/patch-source_Plugins_Language_Java_JavaLanguage.cpp
	lldb-netbsd/patches/patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp
	lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp
	lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp
	lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp
	lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp
	lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp
	lldb-netbsd/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp
	lldb-netbsd/patches/patch-source_Symbol_ClangASTContext.cpp
	lldb-netbsd/patches/patch-source_Symbol_GoASTContext.cpp
	lldb-netbsd/patches/patch-source_Target_Language.cpp
	lldb-netbsd/patches/patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp

Log Message:
lldb-netbsd: Switch std::call_once to llvm::call_once (the 1st round)

Currently libstdc++ has broken std::call_once on NetBSD, switch all occurrences
of if to standard llvm::call_once that can be used to walkaround the breakage.

Sponsored by <The NetBSD Foundation>

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=45c49f99e4383097911a8aee3c48bb450376e235

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 lldb-netbsd/distinfo                               |  37 ++++-
 .../patches/patch-include_lldb_Core_Debugger.h     |  12 ++
 ...patch-source_Commands_CommandObjectPlatform.cpp |  27 ++++
 .../patches/patch-source_Core_ConstString.cpp      |  34 ++++
 lldb-netbsd/patches/patch-source_Core_Debugger.cpp |  35 +++++
 .../patches/patch-source_Core_ModuleList.cpp       |  29 ++++
 .../patches/patch-source_Host_common_Editline.cpp  |  23 +++
 .../patch-source_Host_common_HostInfoBase.cpp      | 175 +++++++++++++++++++++
 .../patch-source_Host_linux_HostInfoLinux.cpp      |  34 ++++
 .../patch-source_Host_windows_HostInfoWindows.cpp  |  23 +++
 ...pressionParser_Clang_ClangModulesDeclVendor.cpp |  24 +++
 ...lugins_Language_CPlusPlus_CPlusPlusLanguage.cpp |  61 +++++++
 ...patch-source_Plugins_Language_Go_GoLanguage.cpp |  38 +++++
 ...h-source_Plugins_Language_Java_JavaLanguage.cpp |  33 ++++
 ...h-source_Plugins_Language_ObjC_ObjCLanguage.cpp |  25 +++
 ...gins_Platform_MacOSX_PlatformAppleSimulator.cpp |  15 ++
 ...urce_Plugins_Platform_MacOSX_PlatformDarwin.cpp |  42 +++++
 ...urce_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp |  24 +++
 ...ce_Plugins_Process_Linux_NativeProcessLinux.cpp |  16 ++
 ...ce_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp |  24 +++
 ...ource_Plugins_Process_POSIX_ProcessPOSIXLog.cpp |  30 ++++
 ...ource_Plugins_Process_Utility_NetBSDSignals.cpp |   2 +-
 ...ugins_Process_Windows_Common_ProcessWindows.cpp |  24 +++
 ...ns_Process_Windows_Common_ProcessWindowsLog.cpp |  27 ++++
 ...rce_Plugins_Process_elf-core_ProcessElfCore.cpp |  32 ++++
 ...remote_GDBRemoteCommunicationServerPlatform.cpp |  33 ++++
 ...Plugins_Process_gdb-remote_ProcessGDBRemote.cpp |  30 ++++
 ...gins_Process_gdb-remote_ProcessGDBRemoteLog.cpp |  31 ++++
 ...e_Plugins_Process_mach-core_ProcessMachCore.cpp |  24 +++
 ...ce_Plugins_Process_minidump_ProcessMinidump.cpp |  31 ++++
 ...criptInterpreter_None_ScriptInterpreterNone.cpp |  30 ++++
 ...tInterpreter_Python_ScriptInterpreterPython.cpp |  28 ++++
 ...ce_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp |  28 ++++
 .../patch-source_Symbol_ClangASTContext.cpp        |  26 +++
 .../patches/patch-source_Symbol_GoASTContext.cpp   |  29 ++++
 .../patches/patch-source_Target_Language.cpp       |  40 +++++
 ..._source_MacOSX_DarwinLog_DarwinLogCollector.cpp |  26 +++
 37 files changed, 1200 insertions(+), 2 deletions(-)

diffs:
diff --git a/lldb-netbsd/distinfo b/lldb-netbsd/distinfo
index 4db16c8..8cf6e6c 100644
--- a/lldb-netbsd/distinfo
+++ b/lldb-netbsd/distinfo
@@ -14,26 +14,61 @@ RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-cmake_LLDBDependencies.cmake) = 81673d8624ca7a9ad60bcaf530587fbfbd695dca
 SHA1 (patch-cmake_modules_AddLLDB.cmake) = 39de9d6ff91641b9c625dbb95c2618f336be28c4
+SHA1 (patch-include_lldb_Core_Debugger.h) = 20d7995866bfe129ab532e470509d8ff9f4ebdea
 SHA1 (patch-include_lldb_Host_netbsd_HostThreadNetBSD.h) = 79f207cdb9da2ef57d39eeb307ec6d10cf828925
 SHA1 (patch-include_lldb_Host_netbsd_ProcessLauncherNetBSD.h) = fe65d50b595974e69ec9bd331dda30abfd3482dd
 SHA1 (patch-source_CMakeLists.txt) = 5dacabc3f39c23bdfd432b5a4895866157b97aa0
+SHA1 (patch-source_Commands_CommandObjectPlatform.cpp) = 41efff0af1f21e42dc7c6291e12698a3585ad743
+SHA1 (patch-source_Core_ConstString.cpp) = 97165809067ed09aeb42395fa352bf7b14cd5afb
+SHA1 (patch-source_Core_Debugger.cpp) = 1548c96130453b7d9623def91057384230cc4ac5
+SHA1 (patch-source_Core_ModuleList.cpp) = e5a0cd12c70b26c397960e94189a4c37495b8f70
 SHA1 (patch-source_Host_CMakeLists.txt) = b7b5fbf2354e05c33c63bf47ffa1ef58f58727ef
+SHA1 (patch-source_Host_common_Editline.cpp) = 33d356079c71e78abe423b338fd5dedbfa2d1c15
 SHA1 (patch-source_Host_common_Host.cpp) = 4d9b4f9ef3c2600c46e5f5d5f1f11aa59f15e87f
+SHA1 (patch-source_Host_common_HostInfoBase.cpp) = 84ef02d17a7a87c86cf30dd83ed2af2d4429dfe2
 SHA1 (patch-source_Host_common_NativeProcessProtocol.cpp) = 23cc7da280b2123cf0206f3d5660d2647935edbc
+SHA1 (patch-source_Host_linux_HostInfoLinux.cpp) = 87c56f543d8ced086439db729d1d06cf3667d6b1
 SHA1 (patch-source_Host_netbsd_HostInfoNetBSD.cpp) = fd4035ec03f08ebba0c9f81e5a05939da436ec58
 SHA1 (patch-source_Host_netbsd_HostThreadNetBSD.cpp) = a1b0fbdad062309a845cfefe4469614fbbe9d20e
 SHA1 (patch-source_Host_netbsd_ProcessLauncherNetBSD.cpp) = 8f2999d3c57bb2776b048e112ec6b800fb0cea20
 SHA1 (patch-source_Host_netbsd_ThisThread.cpp) = f0d32c81bc1b8fe9aeb86519ea46ba2cb16571c2
+SHA1 (patch-source_Host_windows_HostInfoWindows.cpp) = c6e2b33793ad465185658980233eaf65006ae7e1
 SHA1 (patch-source_Initialization_SystemInitializerCommon.cpp) = 80c850b980fe2902f10e441df7a18f428dd1154a
+SHA1 (patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp) = d7b20ebdc172d2943ee223a22d142bbee438225c
+SHA1 (patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp) = 5f97ef77b852ded977b5f837529c5b77aa7f9cda
+SHA1 (patch-source_Plugins_Language_Go_GoLanguage.cpp) = 74ff151f0ce3a773a033ba8298a413db2ae17128
+SHA1 (patch-source_Plugins_Language_Java_JavaLanguage.cpp) = f7814e3ffe7a707b0ed67f8936fc2615e55be907
+SHA1 (patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp) = 7e80af39a9e2f7bb293c774a3a2fd081acc1eae4
+SHA1 (patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp) = 70955caefbeeae6f938337bc35aac8cc57a143b7
+SHA1 (patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp) = 4526689abb29e3736a58023deb67dcf0f4194dce
 SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.cpp) = 129e853c1f93f063a0d30c737bcd82e3e589539b
 SHA1 (patch-source_Plugins_Platform_NetBSD_PlatformNetBSD.h) = 4327a21e79378b8f35adb07614adb41c37bbaf61
 SHA1 (patch-source_Plugins_Process_CMakeLists.txt) = c0168f81da56d9896eb414e6b8bb7262de04ac33
+SHA1 (patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp) = 88979d77c473c903e514e8907961cb30e0fd5289
+SHA1 (patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp) = 09607391fd890b50c6d96d94ac17203611d03a79
+SHA1 (patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp) = f6e315807e5ae0b2df706356cf8ddd7a2b914601
 SHA1 (patch-source_Plugins_Process_NetBSD_CMakeLists.txt) = df17afdf71c29d945c887e318718904793cd48ad
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.cpp) = 46ca5bd672a87e9af6eef44989ead304b542f518
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeProcessNetBSD.h) = bdd9fe37e47de8fa626c7eacf81e07d47a76787c
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.cpp) = a92c655c447cc0829fdb48786f474929f09e1a71
 SHA1 (patch-source_Plugins_Process_NetBSD_NativeThreadNetBSD.h) = d251c4f1b52089f96d435a99f45353aa3992924a
-SHA1 (patch-source_Plugins_Process_Utility_NetBSDSignals.cpp) = b7bee2c33b0cdebc4928e3c5053c7f5915e9aff2
+SHA1 (patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp) = 263b02c4f1be986ac6806e4575d73bbd212579f5
+SHA1 (patch-source_Plugins_Process_Utility_NetBSDSignals.cpp) = fe27031d3b496d91b8f55500a905d067a726eea0
+SHA1 (patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp) = 18b9d17ad1ec21410734bd47b957e5a3a61302a1
+SHA1 (patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp) = 24f6d9139e137a47fb8faad51cb919817897dd3f
+SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = b4cb6dfb073a336b7ce8d26a9c9f7bddd44699ee
+SHA1 (patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp) = 3282168834ca689c4b2b3a022ab2e4320772eec4
+SHA1 (patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp) = a801891e542934ffe39d837d50fc8d7316774a8e
+SHA1 (patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp) = 7e6877baa38faf81130e403e98452a505d940f54
+SHA1 (patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp) = 74a9e7be3a9e33bb18017af1720ebe0b74d4bc7a
+SHA1 (patch-source_Plugins_Process_minidump_ProcessMinidump.cpp) = cab0af49ee18dd69cc66b92d20f6c2defae92dae
+SHA1 (patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp) = e24000a7a5a959c40a54c9623e5c2edb3cd4fea9
+SHA1 (patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp) = f05df4842751fa76a358723b970a5050fb2c39da
+SHA1 (patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp) = 2ca5f09c2d9e03e6c6178b3ec7891b9cc5198287
+SHA1 (patch-source_Symbol_ClangASTContext.cpp) = dd20092f80ddad807cb6a9bbbf985693d3de5ba9
+SHA1 (patch-source_Symbol_GoASTContext.cpp) = 4b03354c97a15c312d507e409aac4138b4dd67f9
+SHA1 (patch-source_Target_Language.cpp) = 409a1ee2dfe6677e383c6ceea735740b2b71c98e
+SHA1 (patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp) = 74d920b49333f79a0a48b003192833ced3862e5d
 SHA1 (patch-tools_lldb-mi_MICmnBase.cpp) = 851c82ac61e1241018755fbd7236af00379ac986
 SHA1 (patch-tools_lldb-mi_MICmnBase.h) = f550d5e10bcf02fb46472733acdbb820791f22e5
 SHA1 (patch-tools_lldb-mi_MIDriver.cpp) = bf1b5399e82bcfe54d6d852f64ed155328f2064d
diff --git a/lldb-netbsd/patches/patch-include_lldb_Core_Debugger.h b/lldb-netbsd/patches/patch-include_lldb_Core_Debugger.h
new file mode 100644
index 0000000..f2bd90f
--- /dev/null
+++ b/lldb-netbsd/patches/patch-include_lldb_Core_Debugger.h
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- include/lldb/Core/Debugger.h.orig	2016-12-17 10:34:06.000000000 +0000
++++ include/lldb/Core/Debugger.h
+@@ -374,7 +374,6 @@ protected:
+   HostThread m_io_handler_thread;
+   Broadcaster m_sync_broadcaster;
+   lldb::ListenerSP m_forward_listener_sp;
+-  std::once_flag m_clear_once;
+ 
+   //----------------------------------------------------------------------
+   // Events for m_sync_broadcaster
diff --git a/lldb-netbsd/patches/patch-source_Commands_CommandObjectPlatform.cpp b/lldb-netbsd/patches/patch-source_Commands_CommandObjectPlatform.cpp
new file mode 100644
index 0000000..cd4884a
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Commands_CommandObjectPlatform.cpp
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- source/Commands/CommandObjectPlatform.cpp.orig	2016-12-17 10:29:27.000000000 +0000
++++ source/Commands/CommandObjectPlatform.cpp
+@@ -30,9 +30,11 @@
+ #include "lldb/Utility/Utils.h"
+ 
+ #include "llvm/ADT/SmallString.h"
++#include "llvm/Support/Threading.h"
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ static mode_t ParsePermissionString(const char *) = delete;
+ 
+@@ -1249,8 +1251,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, []() {
++      LLVM_DEFINE_ONCE_FLAG(g_once_flag);
++      llvm::call_once(g_once_flag, []() {
+         PosixPlatformCommandOptionValidator *posix_validator =
+             new PosixPlatformCommandOptionValidator();
+         for (auto &Option : g_platform_process_list_options) {
diff --git a/lldb-netbsd/patches/patch-source_Core_ConstString.cpp b/lldb-netbsd/patches/patch-source_Core_ConstString.cpp
new file mode 100644
index 0000000..a885e19
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Core_ConstString.cpp
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- source/Core/ConstString.cpp.orig	2016-12-17 10:30:30.000000000 +0000
++++ source/Core/ConstString.cpp
+@@ -19,10 +19,15 @@
+ #include "llvm/ADT/StringMap.h"
+ #include "llvm/Support/RWMutex.h"
+ 
++#include "llvm/Support/Atomic.h"
++
+ // Project includes
+ #include "lldb/Core/Stream.h"
+ 
+ using namespace lldb_private;
++//
++using namespace llvm;
++//using namespace sys;
+ 
+ class Pool {
+ public:
+@@ -190,11 +195,11 @@ protected:
+ // global destructor chain is run, and trying to make sure no destructors
+ // touch ConstStrings is difficult.  So we leak the pool instead.
+ //----------------------------------------------------------------------
++LLVM_DEFINE_ONCE_FLAG(g_pool_initialization_flag);
+ static Pool &StringPool() {
+-  static std::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;
diff --git a/lldb-netbsd/patches/patch-source_Core_Debugger.cpp b/lldb-netbsd/patches/patch-source_Core_Debugger.cpp
new file mode 100644
index 0000000..f382549
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Core_Debugger.cpp
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- source/Core/Debugger.cpp.orig	2016-12-17 10:30:30.000000000 +0000
++++ source/Core/Debugger.cpp
+@@ -61,8 +61,11 @@
+ #include "lldb/Utility/AnsiTerminal.h"
+ #include "lldb/lldb-private.h"
+ 
++#include "llvm/Support/Threading.h"
++
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ static lldb::user_id_t g_unique_id = 1;
+ static size_t g_debugger_event_thread_stack_bytes = 8 * 1024 * 1024;
+@@ -710,7 +713,7 @@ Debugger::Debugger(lldb::LogOutputCallba
+       m_input_reader_stack(), m_instance_name(), m_loaded_plugins(),
+       m_event_handler_thread(), m_io_handler_thread(),
+       m_sync_broadcaster(nullptr, "lldb.debugger.sync"),
+-      m_forward_listener_sp(), m_clear_once() {
++      m_forward_listener_sp() {
+   char instance_cstr[256];
+   snprintf(instance_cstr, sizeof(instance_cstr), "debugger_%d", (int)GetID());
+   m_instance_name.SetCString(instance_cstr);
+@@ -762,7 +765,8 @@ void Debugger::Clear() {
+   //     static void Debugger::Destroy(lldb::DebuggerSP &debugger_sp);
+   //     static void Debugger::Terminate();
+   //----------------------------------------------------------------------
+-  std::call_once(m_clear_once, [this]() {
++  LLVM_DEFINE_ONCE_FLAG(m_clear_once);
++  llvm::call_once(m_clear_once, [this]() {
+     ClearIOHandlers();
+     StopIOHandlerThread();
+     StopEventHandlerThread();
diff --git a/lldb-netbsd/patches/patch-source_Core_ModuleList.cpp b/lldb-netbsd/patches/patch-source_Core_ModuleList.cpp
new file mode 100644
index 0000000..030c2f8
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Core_ModuleList.cpp
@@ -0,0 +1,29 @@
+$NetBSD$
+
+--- source/Core/ModuleList.cpp.orig	2016-12-17 10:30:30.000000000 +0000
++++ source/Core/ModuleList.cpp
+@@ -1,4 +1,4 @@
+-//===-- ModuleList.cpp ------------------------------------------*- C++ -*-===//
++~//===-- ModuleList.cpp ------------------------------------------*- C++ -*-===//
+ //
+ //                     The LLVM Compiler Infrastructure
+ //
+@@ -28,6 +28,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ ModuleList::ModuleList()
+     : m_modules(), m_modules_mutex(), m_notifier(nullptr) {}
+@@ -644,8 +645,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, []() {
++  LLVM_DEFINE_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.
diff --git a/lldb-netbsd/patches/patch-source_Host_common_Editline.cpp b/lldb-netbsd/patches/patch-source_Host_common_Editline.cpp
new file mode 100644
index 0000000..4bd372f
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Host_common_Editline.cpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- source/Host/common/Editline.cpp.orig	2016-12-17 10:30:38.000000000 +0000
++++ source/Host/common/Editline.cpp
+@@ -24,6 +24,7 @@
+ 
+ using namespace lldb_private;
+ using namespace lldb_private::line_editor;
++using namespace llvm;
+ 
+ // Workaround for what looks like an OS X-specific issue, but other platforms
+ // may benefit from something similar if issues arise.  The libedit library
+@@ -1160,8 +1161,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, [&]() {
++      LLVM_DEFINE_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
diff --git a/lldb-netbsd/patches/patch-source_Host_common_HostInfoBase.cpp b/lldb-netbsd/patches/patch-source_Host_common_HostInfoBase.cpp
new file mode 100644
index 0000000..f169885
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Host_common_HostInfoBase.cpp
@@ -0,0 +1,175 @@
+$NetBSD$
+
+--- source/Host/common/HostInfoBase.cpp.orig	2016-12-17 10:30:38.000000000 +0000
++++ source/Host/common/HostInfoBase.cpp
+@@ -29,6 +29,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ namespace {
+ //----------------------------------------------------------------------
+@@ -79,8 +80,8 @@ void HostInfoBase::Terminate() {
+ }
+ 
+ uint32_t HostInfoBase::GetNumberCPUS() {
+-  static std::once_flag g_once_flag;
+-  std::call_once(g_once_flag, []() {
++  LLVM_DEFINE_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, []() {
++  LLVM_DEFINE_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, []() {
++  LLVM_DEFINE_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, []() {
++  LLVM_DEFINE_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, []() {
++  LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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;
++    LLVM_DEFINE_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);
diff --git a/lldb-netbsd/patches/patch-source_Host_linux_HostInfoLinux.cpp b/lldb-netbsd/patches/patch-source_Host_linux_HostInfoLinux.cpp
new file mode 100644
index 0000000..5fbfd7c
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Host_linux_HostInfoLinux.cpp
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- source/Host/linux/HostInfoLinux.cpp.orig	2016-12-17 10:30:35.000000000 +0000
++++ source/Host/linux/HostInfoLinux.cpp
+@@ -19,6 +19,7 @@
+ #include <mutex> // std::once
+ 
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ namespace {
+ struct HostInfoLinuxFields {
+@@ -44,8 +45,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, []() {
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
++  llvm::call_once(g_once_flag, []() {
+ 
+     struct utsname un;
+     if (uname(&un) == 0) {
+@@ -100,8 +101,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, []() {
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
++  llvm::call_once(g_once_flag, []() {
+ 
+     Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST));
+     if (log)
diff --git a/lldb-netbsd/patches/patch-source_Host_windows_HostInfoWindows.cpp b/lldb-netbsd/patches/patch-source_Host_windows_HostInfoWindows.cpp
new file mode 100644
index 0000000..cfe8ea3
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Host_windows_HostInfoWindows.cpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- source/Host/windows/HostInfoWindows.cpp.orig	2016-12-17 10:30:35.000000000 +0000
++++ source/Host/windows/HostInfoWindows.cpp
+@@ -21,6 +21,7 @@
+ #include "llvm/Support/raw_ostream.h"
+ 
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ FileSpec HostInfoWindows::m_program_filespec;
+ 
+@@ -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, []() {
++  LLVM_DEFINE_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;
diff --git a/lldb-netbsd/patches/patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp b/lldb-netbsd/patches/patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp
new file mode 100644
index 0000000..3be51a5
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp.orig	2016-12-17 10:29:53.000000000 +0000
++++ source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+@@ -35,6 +35,7 @@
+ #include "lldb/Utility/LLDBAssert.h"
+ 
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ namespace {
+ // Any Clang compiler requires a consumer for diagnostics.  This one stores them
+@@ -143,9 +144,9 @@ void StoringDiagnosticConsumer::DumpDiag
+ static FileSpec GetResourceDir() {
+   static FileSpec g_cached_resource_dir;
+ 
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_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);
+   });
+ 
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp b/lldb-netbsd/patches/patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp
new file mode 100644
index 0000000..aa00d33
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp
@@ -0,0 +1,61 @@
+$NetBSD$
+
+--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp.orig	2016-12-17 10:29:29.000000000 +0000
++++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+@@ -28,6 +28,7 @@
+ #include "lldb/DataFormatters/DataVisualization.h"
+ #include "lldb/DataFormatters/FormattersHelpers.h"
+ #include "lldb/DataFormatters/VectorType.h"
++#include "llvm/Support/Threading.h"
+ 
+ #include "BlockPointer.h"
+ #include "CxxStringTypes.h"
+@@ -38,6 +39,7 @@
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::formatters;
++using namespace llvm;
+ 
+ void CPlusPlusLanguage::Initialize() {
+   PluginManager::RegisterPlugin(GetPluginNameStatic(), "C++ Language",
+@@ -936,10 +938,10 @@ std::unique_ptr<Language::TypeScavenger>
+ }
+ 
+ lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() {
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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);
+@@ -952,11 +954,11 @@ lldb::TypeCategoryImplSP CPlusPlusLangua
+ 
+ HardcodedFormatters::HardcodedSummaryFinder
+ CPlusPlusLanguage::GetHardcodedSummaries() {
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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 {
+@@ -1016,11 +1018,11 @@ CPlusPlusLanguage::GetHardcodedSummaries
+ 
+ HardcodedFormatters::HardcodedSyntheticFinder
+ CPlusPlusLanguage::GetHardcodedSynthetics() {
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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 &
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Language_Go_GoLanguage.cpp b/lldb-netbsd/patches/patch-source_Plugins_Language_Go_GoLanguage.cpp
new file mode 100644
index 0000000..91ccf75
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Language_Go_GoLanguage.cpp
@@ -0,0 +1,38 @@
+$NetBSD$
+
+--- source/Plugins/Language/Go/GoLanguage.cpp.orig	2016-12-17 10:29:28.000000000 +0000
++++ source/Plugins/Language/Go/GoLanguage.cpp
+@@ -27,6 +27,7 @@
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::formatters;
++using namespace llvm;
+ 
+ void GoLanguage::Initialize() {
+   PluginManager::RegisterPlugin(GetPluginNameStatic(), "Go Language",
+@@ -62,10 +63,10 @@ Language *GoLanguage::CreateInstance(lld
+ 
+ HardcodedFormatters::HardcodedSummaryFinder
+ GoLanguage::GetHardcodedSummaries() {
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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;
++  LLVM_DEFINE_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 {
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Language_Java_JavaLanguage.cpp b/lldb-netbsd/patches/patch-source_Plugins_Language_Java_JavaLanguage.cpp
new file mode 100644
index 0000000..24333c1
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Language_Java_JavaLanguage.cpp
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- source/Plugins/Language/Java/JavaLanguage.cpp.orig	2016-12-17 10:29:28.000000000 +0000
++++ source/Plugins/Language/Java/JavaLanguage.cpp
+@@ -15,6 +15,7 @@
+ 
+ // Other libraries and framework includes
+ #include "llvm/ADT/StringRef.h"
++#include "llvm/Support/Threading.h"
+ 
+ // Project includes
+ #include "JavaFormatterFunctions.h"
+@@ -28,6 +29,7 @@
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::formatters;
++using namespace llvm;
+ 
+ void JavaLanguage::Initialize() {
+   PluginManager::RegisterPlugin(GetPluginNameStatic(), "Java Language",
+@@ -64,10 +66,10 @@ bool JavaLanguage::IsNilReference(ValueO
+ }
+ 
+ lldb::TypeCategoryImplSP JavaLanguage::GetFormatters() {
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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("^.*\\[\\]&?$");
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp b/lldb-netbsd/patches/patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp
new file mode 100644
index 0000000..80c5916
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Language/ObjC/ObjCLanguage.cpp.orig	2016-12-17 10:29:29.000000000 +0000
++++ source/Plugins/Language/ObjC/ObjCLanguage.cpp
+@@ -36,6 +36,7 @@
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::formatters;
++using namespace llvm;
+ 
+ void ObjCLanguage::Initialize() {
+   PluginManager::RegisterPlugin(GetPluginNameStatic(), "Objective-C Language",
+@@ -857,10 +858,10 @@ static void LoadCoreMediaFormatters(Type
+ }
+ 
+ lldb::TypeCategoryImplSP ObjCLanguage::GetFormatters() {
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp b/lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp
new file mode 100644
index 0000000..14755f4
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp.orig	2016-12-17 10:29:32.000000000 +0000
++++ source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp
+@@ -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] {
++  LLVM_DEFINE_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);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp b/lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp
new file mode 100644
index 0000000..e824ccf
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp
@@ -0,0 +1,42 @@
+$NetBSD$
+
+--- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp.orig	2016-12-17 10:29:32.000000000 +0000
++++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+@@ -40,6 +40,7 @@
+ #include "lldb/Target/Process.h"
+ #include "lldb/Target/Target.h"
+ #include "llvm/ADT/STLExtras.h"
++#include "llvm/Support/Threading.h"
+ 
+ #if defined(__APPLE__)
+ #include <TargetConditionals.h> // for TARGET_OS_TV, TARGET_OS_WATCH
+@@ -47,6 +48,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ //------------------------------------------------------------------
+ /// Default Constructor
+@@ -1452,8 +1454,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, []() {
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
++  llvm::call_once(g_once_flag, []() {
+ 
+     FileSpec fspec;
+ 
+@@ -1835,8 +1837,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, []() {
++  LLVM_DEFINE_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();
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
new file mode 100644
index 0000000..21f4497
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp.orig	2016-12-17 10:30:05.000000000 +0000
++++ source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+@@ -47,6 +47,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ namespace {
+ UnixSignalsSP &GetFreeBSDSignals() {
+@@ -70,9 +71,9 @@ ProcessFreeBSD::CreateInstance(lldb::Tar
+ }
+ 
+ void ProcessFreeBSD::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_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());
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
new file mode 100644
index 0000000..258a744
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/NativeProcessLinux.cpp.orig	2016-12-17 10:30:08.000000000 +0000
++++ source/Plugins/Process/Linux/NativeProcessLinux.cpp
+@@ -75,9 +75,9 @@ using namespace llvm;
+ 
+ static bool ProcessVmReadvSupported() {
+   static bool is_supported;
+-  static std::once_flag flag;
++  LLVM_DEFINE_ONCE_FLAG(flag);
+ 
+-  std::call_once(flag, [] {
++  llvm::call_once(flag, [] {
+     Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
+ 
+     uint32_t source = 0x47424742;
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp
new file mode 100644
index 0000000..3d6e548
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp.orig	2016-12-17 10:30:04.000000000 +0000
++++ source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+@@ -50,6 +50,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ namespace {
+ 
+@@ -719,9 +720,9 @@ Error ProcessKDP::DoSignal(int signo) {
+ }
+ 
+ void ProcessKDP::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(), CreateInstance,
+                                   DebuggerInitialize);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp
new file mode 100644
index 0000000..6076d5c
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp.orig	2016-12-17 10:29:54.000000000 +0000
++++ source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
+@@ -15,10 +15,13 @@
+ #include "lldb/Core/StreamFile.h"
+ #include "lldb/Interpreter/Args.h"
+ 
++#include "llvm/Support/Threading.h"
++
+ #include "ProcessPOSIXLog.h"
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ // We want to avoid global constructors where code needs to be run so here we
+ // control access to our static g_log_sp by hiding it in a singleton function
+@@ -33,9 +36,9 @@ static Log *GetLog() {
+ }
+ 
+ void ProcessPOSIXLog::Initialize(ConstString name) {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_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);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_Utility_NetBSDSignals.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_Utility_NetBSDSignals.cpp
index 094113e..972773b 100644
--- a/lldb-netbsd/patches/patch-source_Plugins_Process_Utility_NetBSDSignals.cpp
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_Utility_NetBSDSignals.cpp
@@ -1,6 +1,6 @@
 $NetBSD$
 
---- source/Plugins/Process/Utility/NetBSDSignals.cpp.orig	2017-01-24 18:23:17.672929519 +0000
+--- source/Plugins/Process/Utility/NetBSDSignals.cpp.orig	2016-12-17 10:29:59.000000000 +0000
 +++ source/Plugins/Process/Utility/NetBSDSignals.cpp
 @@ -24,7 +24,35 @@ void NetBSDSignals::Reset() {
    //        ===================================================
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp
new file mode 100644
index 0000000..b8be93f
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/Windows/Common/ProcessWindows.cpp.orig	2016-12-17 10:30:06.000000000 +0000
++++ source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+@@ -41,6 +41,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ namespace {
+ std::string GetProcessExecutableName(HANDLE process_handle) {
+@@ -102,9 +103,9 @@ ProcessSP ProcessWindows::CreateInstance
+ }
+ 
+ void ProcessWindows::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(), CreateInstance);
+   });
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp
new file mode 100644
index 0000000..8fd38a6
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp.orig	2016-12-17 10:30:06.000000000 +0000
++++ source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
+@@ -17,6 +17,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ // We want to avoid global constructors where code needs to be run so here we
+ // control access to our static g_log_sp by hiding it in a singleton function
+@@ -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;
++LLVM_DEFINE_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);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
new file mode 100644
index 0000000..a70a2d4
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- source/Plugins/Process/elf-core/ProcessElfCore.cpp.orig	2016-12-17 10:30:06.000000000 +0000
++++ source/Plugins/Process/elf-core/ProcessElfCore.cpp
+@@ -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"
+@@ -36,6 +37,7 @@
+ #include "ThreadElfCore.h"
+ 
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ ConstString ProcessElfCore::GetPluginNameStatic() {
+   static ConstString g_name("elf-core");
+@@ -398,9 +400,9 @@ void ProcessElfCore::Clear() {
+ }
+ 
+ void ProcessElfCore::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(), CreateInstance);
+   });
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp
new file mode 100644
index 0000000..deabbd2
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp.orig	2016-12-17 10:30:03.000000000 +0000
++++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+@@ -36,6 +36,8 @@
+ #include "lldb/Target/UnixSignals.h"
+ #include "lldb/Utility/JSON.h"
+ 
++#include "llvm/Support/Threading.h"
++
+ // Project includes
+ #include "Utility/StringExtractorGDBRemote.h"
+ #include "Utility/UriParser.h"
+@@ -43,6 +45,7 @@
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::process_gdb_remote;
++using namespace llvm;
+ 
+ //----------------------------------------------------------------------
+ // GDBRemoteCommunicationServerPlatform constructor
+@@ -532,9 +535,9 @@ bool GDBRemoteCommunicationServerPlatfor
+ 
+ const FileSpec &GDBRemoteCommunicationServerPlatform::GetDomainSocketDir() {
+   static FileSpec g_domainsocket_dir;
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_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)
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp
new file mode 100644
index 0000000..8e6a7ef
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp.orig	2016-12-17 10:30:03.000000000 +0000
++++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+@@ -81,11 +81,13 @@
+ 
+ #include "llvm/ADT/StringSwitch.h"
+ #include "llvm/Support/raw_ostream.h"
++#include "llvm/Support/Threading.h"
+ 
+ #define DEBUGSERVER_BASENAME "debugserver"
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::process_gdb_remote;
++using namespace llvm;
+ 
+ namespace lldb {
+ // Provide a function that can easily dump the packet history if we know a
+@@ -3427,9 +3429,9 @@ void ProcessGDBRemote::KillDebugserverPr
+ }
+ 
+ void ProcessGDBRemote::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(), CreateInstance,
+                                   DebuggerInitialize);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp
new file mode 100644
index 0000000..588b7f5
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp.orig	2016-12-17 10:30:03.000000000 +0000
++++ source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
+@@ -14,11 +14,14 @@
+ #include "lldb/Core/StreamFile.h"
+ #include "lldb/Interpreter/Args.h"
+ 
++#include "llvm/Support/Threading.h"
++
+ #include "ProcessGDBRemote.h"
+ 
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::process_gdb_remote;
++using namespace llvm;
+ 
+ // We want to avoid global constructors where code needs to be run so here we
+ // control access to our static g_log_sp by hiding it in a singleton function
+@@ -34,9 +37,9 @@ static Log *GetLog() {
+ 
+ void ProcessGDBRemoteLog::Initialize() {
+   static ConstString g_name("gdb-remote");
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_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);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp
new file mode 100644
index 0000000..af19488
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/mach-core/ProcessMachCore.cpp.orig	2016-12-17 10:30:06.000000000 +0000
++++ source/Plugins/Process/mach-core/ProcessMachCore.cpp
+@@ -45,6 +45,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ ConstString ProcessMachCore::GetPluginNameStatic() {
+   static ConstString g_name("mach-o-core");
+@@ -579,9 +580,9 @@ Error ProcessMachCore::GetMemoryRegionIn
+ void ProcessMachCore::Clear() { m_thread_list.Clear(); }
+ 
+ void ProcessMachCore::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(), CreateInstance);
+   });
diff --git a/lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp b/lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp
new file mode 100644
index 0000000..1996095
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- source/Plugins/Process/minidump/ProcessMinidump.cpp.orig	2016-12-17 10:29:54.000000000 +0000
++++ source/Plugins/Process/minidump/ProcessMinidump.cpp
+@@ -25,11 +25,14 @@
+ #include "lldb/Target/UnixSignals.h"
+ #include "lldb/Utility/LLDBAssert.h"
+ 
++#include "llvm/Support/Threading.h"
++
+ // C includes
+ // C++ includes
+ 
+ using namespace lldb_private;
+ using namespace minidump;
++using namespace llvm;
+ 
+ ConstString ProcessMinidump::GetPluginNameStatic() {
+   static ConstString g_name("minidump");
+@@ -92,9 +95,9 @@ ProcessMinidump::~ProcessMinidump() {
+ }
+ 
+ void ProcessMinidump::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(),
+                                   ProcessMinidump::CreateInstance);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp b/lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp
new file mode 100644
index 0000000..fc5fc5c
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp.orig	2016-12-17 10:29:35.000000000 +0000
++++ source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
+@@ -15,10 +15,13 @@
+ #include "lldb/Core/StringList.h"
+ #include "lldb/Interpreter/CommandInterpreter.h"
+ 
++#include "llvm/Support/Threading.h"
++
+ #include <mutex>
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ ScriptInterpreterNone::ScriptInterpreterNone(CommandInterpreter &interpreter)
+     : ScriptInterpreter(interpreter, eScriptLanguageNone) {}
+@@ -39,9 +42,9 @@ void ScriptInterpreterNone::ExecuteInter
+ }
+ 
+ void ScriptInterpreterNone::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(),
+                                   lldb::eScriptLanguageNone, CreateInstance);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp b/lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp
new file mode 100644
index 0000000..12f8e16
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp.orig	2016-12-17 10:29:36.000000000 +0000
++++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+@@ -51,9 +51,11 @@
+ 
+ #include "llvm/ADT/STLExtras.h"
+ #include "llvm/ADT/StringRef.h"
++#include "llvm/Support/Threading.h"
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ static ScriptInterpreterPython::SWIGInitCallback g_swig_init_callback = nullptr;
+ static ScriptInterpreterPython::SWIGBreakpointCallbackFunction
+@@ -338,9 +340,9 @@ ScriptInterpreterPython::~ScriptInterpre
+ }
+ 
+ void ScriptInterpreterPython::Initialize() {
+-  static std::once_flag g_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+ 
+-  std::call_once(g_once_flag, []() {
++  llvm::call_once(g_once_flag, []() {
+     PluginManager::RegisterPlugin(GetPluginNameStatic(),
+                                   GetPluginDescriptionStatic(),
+                                   lldb::eScriptLanguagePython, CreateInstance);
diff --git a/lldb-netbsd/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp b/lldb-netbsd/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp
new file mode 100644
index 0000000..a23210b
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp.orig	2016-12-17 10:29:45.000000000 +0000
++++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+@@ -87,6 +87,7 @@
+ 
+ using namespace lldb;
+ using namespace lldb_private;
++using namespace llvm;
+ 
+ // static inline bool
+ // child_requires_parent_class_union_or_struct_to_be_completed (dw_tag_t tag)
+@@ -1630,13 +1631,13 @@ SymbolFileDWARF::GlobalVariableMap &Symb
+               VariableSP var_sp = globals_sp->GetVariableAtIndex(g);
+               if (var_sp && !var_sp->GetLocationIsConstantValueData()) {
+                 const DWARFExpression &location = var_sp->LocationExpression();
+-                Value location_result;
++                lldb_private::Value location_result;
+                 Error error;
+                 if (location.Evaluate(nullptr, nullptr, nullptr,
+                                       LLDB_INVALID_ADDRESS, nullptr, nullptr,
+                                       location_result, &error)) {
+                   if (location_result.GetValueType() ==
+-                      Value::eValueTypeFileAddress) {
++                      lldb_private::Value::eValueTypeFileAddress) {
+                     lldb::addr_t file_addr =
+                         location_result.GetScalar().ULongLong();
+                     lldb::addr_t byte_size = 1;
diff --git a/lldb-netbsd/patches/patch-source_Symbol_ClangASTContext.cpp b/lldb-netbsd/patches/patch-source_Symbol_ClangASTContext.cpp
new file mode 100644
index 0000000..c259aa8
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Symbol_ClangASTContext.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+--- source/Symbol/ClangASTContext.cpp.orig	2016-12-17 10:30:17.000000000 +0000
++++ source/Symbol/ClangASTContext.cpp
+@@ -127,8 +127,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, []() {
++  LLVM_DEFINE_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 +954,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, []() {
++    LLVM_DEFINE_ONCE_FLAG(g_once_flag);
++    llvm::call_once(g_once_flag, []() {
+       // "void"
+       g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid);
+ 
diff --git a/lldb-netbsd/patches/patch-source_Symbol_GoASTContext.cpp b/lldb-netbsd/patches/patch-source_Symbol_GoASTContext.cpp
new file mode 100644
index 0000000..b7f8f02
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Symbol_GoASTContext.cpp
@@ -0,0 +1,29 @@
+$NetBSD$
+
+--- source/Symbol/GoASTContext.cpp.orig	2016-12-17 10:30:17.000000000 +0000
++++ source/Symbol/GoASTContext.cpp
+@@ -25,10 +25,13 @@
+ #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"
+ 
+ using namespace lldb;
++using namespace llvm;
+ 
+ namespace lldb_private {
+ class GoArray;
+@@ -593,8 +596,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, []() {
++    LLVM_DEFINE_ONCE_FLAG(g_once_flag);
++    llvm::call_once(g_once_flag, []() {
+       // "void"
+       g_type_map.Append(ConstString("void").GetStringRef(), eBasicTypeVoid);
+       // "int"
diff --git a/lldb-netbsd/patches/patch-source_Target_Language.cpp b/lldb-netbsd/patches/patch-source_Target_Language.cpp
new file mode 100644
index 0000000..6d5517d
--- /dev/null
+++ b/lldb-netbsd/patches/patch-source_Target_Language.cpp
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- source/Target/Language.cpp.orig	2016-12-17 10:30:23.000000000 +0000
++++ source/Target/Language.cpp
+@@ -20,18 +20,21 @@
+ #include "lldb/Symbol/TypeList.h"
+ #include "lldb/Target/Target.h"
+ 
++#include "llvm/Support/Threading.h"
++
+ using namespace lldb;
+ using namespace lldb_private;
+ using namespace lldb_private::formatters;
++using namespace llvm;
+ 
+ typedef std::unique_ptr<Language> LanguageUP;
+ typedef std::map<lldb::LanguageType, LanguageUP> LanguagesMap;
+ 
+ static LanguagesMap &GetLanguagesMap() {
+   static LanguagesMap *g_map = nullptr;
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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 +43,9 @@ static LanguagesMap &GetLanguagesMap() {
+ }
+ static std::mutex &GetLanguagesMutex() {
+   static std::mutex *g_mutex = nullptr;
+-  static std::once_flag g_initialize;
++  LLVM_DEFINE_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
+   });
diff --git a/lldb-netbsd/patches/patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp b/lldb-netbsd/patches/patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp
new file mode 100644
index 0000000..8758089
--- /dev/null
+++ b/lldb-netbsd/patches/patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+--- tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp.orig	2016-12-17 10:30:47.000000000 +0000
++++ tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
+@@ -28,6 +28,8 @@
+ #include "RNBDefs.h"
+ #include "RNBRemote.h"
+ 
++using namespace llvm;
++
+ // Use an anonymous namespace for variables and methods that have no
+ // reason to leak out through the interface.
+ namespace {
+@@ -46,10 +48,10 @@ static os_activity_stream_set_event_hand
+     s_os_activity_stream_set_event_handler;
+ 
+ bool LookupSPICalls() {
+-  static std::once_flag s_once_flag;
++  LLVM_DEFINE_ONCE_FLAG(g_once_flag);
+   static bool s_has_spi;
+ 
+-  std::call_once(s_once_flag, [] {
++  llvm::call_once(s_once_flag, [] {
+     s_os_activity_stream_for_pid = (os_activity_stream_for_pid_t)dlsym(
+         RTLD_DEFAULT, "os_activity_stream_for_pid");
+     s_os_activity_stream_resume = (os_activity_stream_resume_t)dlsym(


Home | Main Index | Thread Index | Old Index