pkgsrc-WIP-changes archive

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

lldb-git: Recreate llvm::call_once patch



Module Name:	pkgsrc-wip
Committed By:	Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By:	kamil
Date:		Fri Feb 3 23:51:19 2017 +0100
Changeset:	39d820e75003fd2447fa35793d9242ee4d805272

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

Log Message:
lldb-git: Recreate llvm::call_once patch

It needs more work. lldb(1) hangs.

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=39d820e75003fd2447fa35793d9242ee4d805272

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

diffstat:
 lldb-git/Makefile                                  |   2 -
 lldb-git/distinfo                                  |  36 +++++
 .../patches/patch-include_lldb_Core_Debugger.h     |  22 +++
 ...patch-source_Commands_CommandObjectPlatform.cpp |  23 +++
 lldb-git/patches/patch-source_Core_Debugger.cpp    |  21 +++
 lldb-git/patches/patch-source_Core_ModuleList.cpp  |  24 +++
 .../patches/patch-source_Host_common_Editline.cpp  |  24 +++
 .../patch-source_Host_common_HostInfoBase.cpp      | 179 +++++++++++++++++++++
 .../patch-source_Host_linux_HostInfoLinux.cpp      |  35 ++++
 .../patch-source_Host_windows_HostInfoWindows.cpp  |  23 +++
 ...pressionParser_Clang_ClangModulesDeclVendor.cpp |  24 +++
 ...lugins_Language_CPlusPlus_CPlusPlusLanguage.cpp |  53 ++++++
 ...patch-source_Plugins_Language_Go_GoLanguage.cpp |  38 +++++
 ...h-source_Plugins_Language_Java_JavaLanguage.cpp |  25 +++
 ...h-source_Plugins_Language_ObjC_ObjCLanguage.cpp |  26 +++
 ...gins_Platform_MacOSX_PlatformAppleSimulator.cpp |  15 ++
 ...urce_Plugins_Platform_MacOSX_PlatformDarwin.cpp |  34 ++++
 ...urce_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp |  25 +++
 ...ce_Plugins_Process_Linux_NativeProcessLinux.cpp |  16 ++
 ...ce_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp |  25 +++
 ...ource_Plugins_Process_POSIX_ProcessPOSIXLog.cpp |  25 +++
 ...ugins_Process_Windows_Common_ProcessWindows.cpp |  24 +++
 ...ns_Process_Windows_Common_ProcessWindowsLog.cpp |  27 ++++
 ...rce_Plugins_Process_elf-core_ProcessElfCore.cpp |  24 +++
 ...remote_GDBRemoteCommunicationServerPlatform.cpp |  24 +++
 ...Plugins_Process_gdb-remote_ProcessGDBRemote.cpp |  24 +++
 ...gins_Process_gdb-remote_ProcessGDBRemoteLog.cpp |  25 +++
 ...e_Plugins_Process_mach-core_ProcessMachCore.cpp |  24 +++
 ...ce_Plugins_Process_minidump_ProcessMinidump.cpp |  25 +++
 ...criptInterpreter_None_ScriptInterpreterNone.cpp |  25 +++
 ...tInterpreter_Python_ScriptInterpreterPython.cpp |  16 ++
 ...ce_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp |  26 +++
 ...urce_Plugins_SymbolFile_DWARF_SymbolFileDWARF.h |  21 +++
 .../patch-source_Symbol_ClangASTContext.cpp        |  43 +++++
 .../patches/patch-source_Symbol_GoASTContext.cpp   |  24 +++
 lldb-git/patches/patch-source_Target_Language.cpp  |  37 +++++
 .../patches/patch-source_Utility_ConstString.cpp   |  25 +++
 ..._source_MacOSX_DarwinLog_DarwinLogCollector.cpp |  17 ++
 38 files changed, 1124 insertions(+), 2 deletions(-)

diffs:
diff --git a/lldb-git/Makefile b/lldb-git/Makefile
index 39acf08191..37054b55a8 100644
--- a/lldb-git/Makefile
+++ b/lldb-git/Makefile
@@ -51,8 +51,6 @@ REPLACE_PYTHON+=	scripts/shush
 TEST_TARGET=		check-lldb
 TEST_ENV+=		LD_LIBRARY_PATH=${WRKDIR}/build/lib
 
-MAKE_FLAGS+=		VERBOSE=1
-
 post-extract:
 	${RUN} mkdir -p ${WRKDIR}/build
 
diff --git a/lldb-git/distinfo b/lldb-git/distinfo
index 903d12aae9..ceefbcfbda 100644
--- a/lldb-git/distinfo
+++ b/lldb-git/distinfo
@@ -14,6 +14,42 @@ RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
 Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
 SHA1 (patch-CMakeLists.txt) = 18b67230b3c3a00e0a96d55f6c2b1305d5004b75
 SHA1 (patch-cmake_modules_LLDBConfig.cmake) = f2f743a350afbaeeda30d87e08424def3ce70f0c
+SHA1 (patch-include_lldb_Core_Debugger.h) = 136fc7a23b424adf286a0dced98cece5a423d9af
 SHA1 (patch-scripts_Python_finishSwigPythonLLDB.py) = 68e6a027b746ceb6829ac9805be0e31ab10976c1
 SHA1 (patch-scripts_finishSwigWrapperClasses.py) = 453489318a5855e7d750903ab4f877ffb34d9652
 SHA1 (patch-scripts_utilsArgsParse.py) = b9b7a6f17b6e927882ad0aaffcbf5c53c1179499
+SHA1 (patch-source_Commands_CommandObjectPlatform.cpp) = a038fecd3ad31bd6a11095ad7f4ac5b92847c78b
+SHA1 (patch-source_Core_Debugger.cpp) = affa76051734351b7f9cfa6542f918930949ee38
+SHA1 (patch-source_Core_ModuleList.cpp) = 1dc5f5d9309646f5ca0119bbbd30e8d9c3146c4d
+SHA1 (patch-source_Host_common_Editline.cpp) = e31fbfa6b8a56579c1504c5b09a76cdffcd8a915
+SHA1 (patch-source_Host_common_HostInfoBase.cpp) = 2f34f16d3266f56518c0637ad7e10ce1452f567c
+SHA1 (patch-source_Host_linux_HostInfoLinux.cpp) = efd7bbd090b918bb8ddc6edc4e7593cf7c77445b
+SHA1 (patch-source_Host_windows_HostInfoWindows.cpp) = b13f2d0401145310198d4f0ed40d7273c95c92dc
+SHA1 (patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp) = eef9f8a5b4804f62364051a8a0dbbea13c5f4b10
+SHA1 (patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp) = bb8f0b98167b602822b0f319c10fa115c088e2fa
+SHA1 (patch-source_Plugins_Language_Go_GoLanguage.cpp) = 9dcb766d46e213b13d7feda60e00db1853b310d6
+SHA1 (patch-source_Plugins_Language_Java_JavaLanguage.cpp) = 6010d8f1c7af01433ac310b6284307ba9c0e408e
+SHA1 (patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp) = a11841320c84dc924999288cd820aadb404f8688
+SHA1 (patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp) = a9c011f1b4d6f846a5e887816757a834c694d455
+SHA1 (patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp) = 034017d75449bda239d4aede8c4a337be62a775c
+SHA1 (patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp) = e7ca69579e31d3793ac0ba2a85d3cda70e08268e
+SHA1 (patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp) = 883b37dd759954f51c525975eba2895162d6e8d4
+SHA1 (patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp) = ec95aa1b3ffb2182dd72f962600d317399bc0b26
+SHA1 (patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp) = 9b2c481c12a6a2289af26e933fc7ed6a9286c078
+SHA1 (patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp) = 90db20235357b0b1068e002c359ec5e2ff37d8b8
+SHA1 (patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp) = 71b10e6e61d97077a00be5adb6721db44a395f9f
+SHA1 (patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp) = 2ce43ac8303884e6f9ab1480264a68b540c05e5d
+SHA1 (patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp) = 7ae01ae61f8ea49e786c1b64dbdceeba5f48b524
+SHA1 (patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp) = 228924bea36bd4de7ce6cb379faa159f1729e529
+SHA1 (patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp) = 98952ab28a057b2e3f77904b97795d6f40d55b6a
+SHA1 (patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp) = a9ce6650ad60ce6d42241919a1310235e689db48
+SHA1 (patch-source_Plugins_Process_minidump_ProcessMinidump.cpp) = 5bb3d20526a09a7d22dff4611ca25f79df1fbfc5
+SHA1 (patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp) = f548c5f9b614eac02f8487dc8ee33bfb5521c013
+SHA1 (patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp) = fb7f548497fa0eb004b42c7254669c9d86d3abc7
+SHA1 (patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp) = 4598ffd3d986aca7f1189d8da2d5593b389e6def
+SHA1 (patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.h) = 3db332ef2dfd8551c864fa2149571b05a00e8a1b
+SHA1 (patch-source_Symbol_ClangASTContext.cpp) = 4357bd58e77e234fb91603c010e12386414e768e
+SHA1 (patch-source_Symbol_GoASTContext.cpp) = b7d407ae128f00655a032b42629a6ca8bdcf5941
+SHA1 (patch-source_Target_Language.cpp) = b8047399c369af3a860863579d04b1ad122f6cb0
+SHA1 (patch-source_Utility_ConstString.cpp) = 564c2df272d114363ed8e7584dd37513dd61aa0f
+SHA1 (patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp) = 4f6f70ab211d852b0e521ad9e0a8233734707351
diff --git a/lldb-git/patches/patch-include_lldb_Core_Debugger.h b/lldb-git/patches/patch-include_lldb_Core_Debugger.h
new file mode 100644
index 0000000000..2e2ed1a006
--- /dev/null
+++ b/lldb-git/patches/patch-include_lldb_Core_Debugger.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- include/lldb/Core/Debugger.h.orig	2016-12-14 14:10:24.000000000 +0000
++++ include/lldb/Core/Debugger.h
+@@ -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
diff --git a/lldb-git/patches/patch-source_Commands_CommandObjectPlatform.cpp b/lldb-git/patches/patch-source_Commands_CommandObjectPlatform.cpp
new file mode 100644
index 0000000000..dda9d14f7d
--- /dev/null
+++ b/lldb-git/patches/patch-source_Commands_CommandObjectPlatform.cpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- source/Commands/CommandObjectPlatform.cpp.orig	2017-02-02 15:43:50.000000000 +0000
++++ source/Commands/CommandObjectPlatform.cpp
+@@ -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, []() {
++      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-git/patches/patch-source_Core_Debugger.cpp b/lldb-git/patches/patch-source_Core_Debugger.cpp
new file mode 100644
index 0000000000..d971805d93
--- /dev/null
+++ b/lldb-git/patches/patch-source_Core_Debugger.cpp
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- source/Core/Debugger.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Core/Debugger.cpp
+@@ -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();
diff --git a/lldb-git/patches/patch-source_Core_ModuleList.cpp b/lldb-git/patches/patch-source_Core_ModuleList.cpp
new file mode 100644
index 0000000000..5bd0c7f016
--- /dev/null
+++ b/lldb-git/patches/patch-source_Core_ModuleList.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Core/ModuleList.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Core/ModuleList.cpp
+@@ -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, []() {
++  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-git/patches/patch-source_Host_common_Editline.cpp b/lldb-git/patches/patch-source_Host_common_Editline.cpp
new file mode 100644
index 0000000000..9184e55c02
--- /dev/null
+++ b/lldb-git/patches/patch-source_Host_common_Editline.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Host/common/Editline.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Host/common/Editline.cpp
+@@ -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, [&]() {
++      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-git/patches/patch-source_Host_common_HostInfoBase.cpp b/lldb-git/patches/patch-source_Host_common_HostInfoBase.cpp
new file mode 100644
index 0000000000..415a7ff333
--- /dev/null
+++ b/lldb-git/patches/patch-source_Host_common_HostInfoBase.cpp
@@ -0,0 +1,179 @@
+$NetBSD$
+
+--- source/Host/common/HostInfoBase.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Host/common/HostInfoBase.cpp
+@@ -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, []() {
++  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-git/patches/patch-source_Host_linux_HostInfoLinux.cpp b/lldb-git/patches/patch-source_Host_linux_HostInfoLinux.cpp
new file mode 100644
index 0000000000..bcc0102e48
--- /dev/null
+++ b/lldb-git/patches/patch-source_Host_linux_HostInfoLinux.cpp
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- source/Host/linux/HostInfoLinux.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Host/linux/HostInfoLinux.cpp
+@@ -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, []() {
++  LLVM_DEFINE_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, []() {
++  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-git/patches/patch-source_Host_windows_HostInfoWindows.cpp b/lldb-git/patches/patch-source_Host_windows_HostInfoWindows.cpp
new file mode 100644
index 0000000000..17e28e454a
--- /dev/null
+++ b/lldb-git/patches/patch-source_Host_windows_HostInfoWindows.cpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+--- source/Host/windows/HostInfoWindows.cpp.orig	2016-09-10 17:36:23.000000000 +0000
++++ source/Host/windows/HostInfoWindows.cpp
+@@ -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, []() {
++  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-git/patches/patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp b/lldb-git/patches/patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp
new file mode 100644
index 0000000000..a8c734be07
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_ExpressionParser_Clang_ClangModulesDeclVendor.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp b/lldb-git/patches/patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp
new file mode 100644
index 0000000000..e2b5282213
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Language_CPlusPlus_CPlusPlusLanguage.cpp
@@ -0,0 +1,53 @@
+$NetBSD$
+
+--- source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+@@ -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;
++  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);
+@@ -1052,11 +1053,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 {
+@@ -1116,11 +1117,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-git/patches/patch-source_Plugins_Language_Go_GoLanguage.cpp b/lldb-git/patches/patch-source_Plugins_Language_Go_GoLanguage.cpp
new file mode 100644
index 0000000000..8b51c797eb
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Language_Go_GoLanguage.cpp
@@ -0,0 +1,38 @@
+$NetBSD$
+
+--- source/Plugins/Language/Go/GoLanguage.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/Language/Go/GoLanguage.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Language_Java_JavaLanguage.cpp b/lldb-git/patches/patch-source_Plugins_Language_Java_JavaLanguage.cpp
new file mode 100644
index 0000000000..632904597f
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Language_Java_JavaLanguage.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Language/Java/JavaLanguage.cpp.orig	2017-02-02 23:56:41.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"
+@@ -64,10 +65,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-git/patches/patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp b/lldb-git/patches/patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp
new file mode 100644
index 0000000000..981f7ad717
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Language_ObjC_ObjCLanguage.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+--- source/Plugins/Language/ObjC/ObjCLanguage.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/Language/ObjC/ObjCLanguage.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp b/lldb-git/patches/patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp
new file mode 100644
index 0000000000..d28c9c1e63
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Platform_MacOSX_PlatformAppleSimulator.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp.orig	2017-02-02 23:56:41.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-git/patches/patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp b/lldb-git/patches/patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp
new file mode 100644
index 0000000000..b15f708162
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Platform_MacOSX_PlatformDarwin.cpp
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp.orig	2017-02-03 18:58:59.000000000 +0000
++++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+@@ -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, []() {
++  LLVM_DEFINE_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, []() {
++  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-git/patches/patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp b/lldb-git/patches/patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
new file mode 100644
index 0000000000..693f5fde40
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp.orig	2017-01-28 19:35:15.000000000 +0000
++++ source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
new file mode 100644
index 0000000000..950cb6fc13
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Linux_NativeProcessLinux.cpp
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- source/Plugins/Process/Linux/NativeProcessLinux.cpp.orig	2017-02-02 23:56:41.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(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
+ 
+     uint32_t source = 0x47424742;
diff --git a/lldb-git/patches/patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp b/lldb-git/patches/patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp
new file mode 100644
index 0000000000..060df62db8
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_MacOSX-Kernel_ProcessKDP.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp.orig	2017-01-28 19:35:15.000000000 +0000
++++ source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp b/lldb-git/patches/patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp
new file mode 100644
index 0000000000..2d46b597fc
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_POSIX_ProcessPOSIXLog.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp b/lldb-git/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp
new file mode 100644
index 0000000000..afc58c070b
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindows.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/Windows/Common/ProcessWindows.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp b/lldb-git/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp
new file mode 100644
index 0000000000..6254692d5d
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_Windows_Common_ProcessWindowsLog.cpp
@@ -0,0 +1,27 @@
+$NetBSD$
+
+--- source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp.orig	2016-09-10 17:36:23.000000000 +0000
++++ source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp
+@@ -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);
diff --git a/lldb-git/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp b/lldb-git/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
new file mode 100644
index 0000000000..988c324083
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_elf-core_ProcessElfCore.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/elf-core/ProcessElfCore.cpp.orig	2017-02-01 00:44:13.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"
+@@ -400,9 +401,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-git/patches/patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp b/lldb-git/patches/patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp
new file mode 100644
index 0000000000..eca654ba37
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_gdb-remote_GDBRemoteCommunicationServerPlatform.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp b/lldb-git/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp
new file mode 100644
index 0000000000..e2c89e15a6
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemote.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp b/lldb-git/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp
new file mode 100644
index 0000000000..8f7c33e65b
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_gdb-remote_ProcessGDBRemoteLog.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp.orig	2016-10-19 22:25:12.000000000 +0000
++++ source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp b/lldb-git/patches/patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp
new file mode 100644
index 0000000000..d41070c46f
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_mach-core_ProcessMachCore.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Plugins/Process/mach-core/ProcessMachCore.cpp.orig	2016-09-10 17:36:23.000000000 +0000
++++ source/Plugins/Process/mach-core/ProcessMachCore.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp b/lldb-git/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp
new file mode 100644
index 0000000000..2ed067fe1c
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_Process_minidump_ProcessMinidump.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/Process/minidump/ProcessMinidump.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Plugins/Process/minidump/ProcessMinidump.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp b/lldb-git/patches/patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp
new file mode 100644
index 0000000000..aa21fb2f56
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_ScriptInterpreter_None_ScriptInterpreterNone.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
+@@ -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;
++  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-git/patches/patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp b/lldb-git/patches/patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp
new file mode 100644
index 0000000000..60937794ad
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_ScriptInterpreter_Python_ScriptInterpreterPython.cpp
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp.orig	2017-01-28 19:35:15.000000000 +0000
++++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+@@ -338,9 +338,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-git/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp b/lldb-git/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp
new file mode 100644
index 0000000000..c3983edc8e
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+@@ -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,11 @@ 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;
+ }
+ 
diff --git a/lldb-git/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.h b/lldb-git/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.h
new file mode 100644
index 0000000000..9a6e304eac
--- /dev/null
+++ b/lldb-git/patches/patch-source_Plugins_SymbolFile_DWARF_SymbolFileDWARF.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+@@ -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;
+   };
+ 
diff --git a/lldb-git/patches/patch-source_Symbol_ClangASTContext.cpp b/lldb-git/patches/patch-source_Symbol_ClangASTContext.cpp
new file mode 100644
index 0000000000..0c07f3cb2b
--- /dev/null
+++ b/lldb-git/patches/patch-source_Symbol_ClangASTContext.cpp
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- source/Symbol/ClangASTContext.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Symbol/ClangASTContext.cpp
+@@ -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, []() {
++  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 +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, []() {
++    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-git/patches/patch-source_Symbol_GoASTContext.cpp b/lldb-git/patches/patch-source_Symbol_GoASTContext.cpp
new file mode 100644
index 0000000000..f723d4e9b4
--- /dev/null
+++ b/lldb-git/patches/patch-source_Symbol_GoASTContext.cpp
@@ -0,0 +1,24 @@
+$NetBSD$
+
+--- source/Symbol/GoASTContext.cpp.orig	2016-12-14 14:10:24.000000000 +0000
++++ source/Symbol/GoASTContext.cpp
+@@ -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, []() {
++    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-git/patches/patch-source_Target_Language.cpp b/lldb-git/patches/patch-source_Target_Language.cpp
new file mode 100644
index 0000000000..5706ef002d
--- /dev/null
+++ b/lldb-git/patches/patch-source_Target_Language.cpp
@@ -0,0 +1,37 @@
+$NetBSD$
+
+--- source/Target/Language.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Target/Language.cpp
+@@ -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;
++  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 +42,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-git/patches/patch-source_Utility_ConstString.cpp b/lldb-git/patches/patch-source_Utility_ConstString.cpp
new file mode 100644
index 0000000000..3aa25365b4
--- /dev/null
+++ b/lldb-git/patches/patch-source_Utility_ConstString.cpp
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- source/Utility/ConstString.cpp.orig	2017-02-02 23:56:41.000000000 +0000
++++ source/Utility/ConstString.cpp
+@@ -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;
++  LLVM_DEFINE_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-git/patches/patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp b/lldb-git/patches/patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp
new file mode 100644
index 0000000000..55ca341902
--- /dev/null
+++ b/lldb-git/patches/patch-tools_debugserver_source_MacOSX_DarwinLog_DarwinLogCollector.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+--- tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp.orig	2017-01-28 19:35:15.000000000 +0000
++++ tools/debugserver/source/MacOSX/DarwinLog/DarwinLogCollector.cpp
+@@ -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;
++  LLVM_DEFINE_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");


Home | Main Index | Thread Index | Old Index