diff options
| author | Kamil Rytarowski <n54@gmx.com> | 2017-02-06 17:55:02 +0000 |
|---|---|---|
| committer | Kamil Rytarowski <n54@gmx.com> | 2017-02-06 17:55:02 +0000 |
| commit | c5f28e2a05f2ebff09e1cd02a5faa84369c5c655 (patch) | |
| tree | 2b060755745a90c26bf922b6baca662106b581cd /lldb/source/Plugins | |
| parent | d3464bf9adc283bd5f75756bf99074f195117509 (diff) | |
| download | bcm5719-llvm-c5f28e2a05f2ebff09e1cd02a5faa84369c5c655.tar.gz bcm5719-llvm-c5f28e2a05f2ebff09e1cd02a5faa84369c5c655.zip | |
Switch std::call_once to llvm::call_once
Summary:
The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms.
This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger.
Sponsored by <The NetBSD Foundation>
Reviewers: labath, joerg, emaste, mehdi_amini, clayborg
Reviewed By: labath, clayborg
Subscribers: #lldb
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D29288
llvm-svn: 294202
Diffstat (limited to 'lldb/source/Plugins')
23 files changed, 81 insertions, 53 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 3d3ba301cef..af50b0bdf9c 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/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::DumpDiagnostics(Stream &error_stream) { static FileSpec GetResourceDir() { static FileSpec g_cached_resource_dir; - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { HostInfo::GetLLDBPath(lldb::ePathTypeClangDir, g_cached_resource_dir); }); diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 7aea29d361a..e862313ae9e 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/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> CPlusPlusLanguage::GetTypeScavenger() { } lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() { - static std::once_flag g_initialize; + static llvm::once_flag g_initialize; static TypeCategoryImplSP g_category; - std::call_once(g_initialize, [this]() -> void { + llvm::call_once(g_initialize, [this]() -> void { DataVisualization::Categories::GetCategory(GetPluginName(), g_category); if (g_category) { LoadLibCxxFormatters(g_category); @@ -1052,11 +1053,11 @@ lldb::TypeCategoryImplSP CPlusPlusLanguage::GetFormatters() { HardcodedFormatters::HardcodedSummaryFinder CPlusPlusLanguage::GetHardcodedSummaries() { - static std::once_flag g_initialize; + static llvm::once_flag g_initialize; static ConstString g_vectortypes("VectorTypes"); static HardcodedFormatters::HardcodedSummaryFinder g_formatters; - std::call_once(g_initialize, []() -> void { + llvm::call_once(g_initialize, []() -> void { g_formatters.push_back( [](lldb_private::ValueObject &valobj, lldb::DynamicValueType, FormatManager &) -> TypeSummaryImpl::SharedPointer { @@ -1116,11 +1117,11 @@ CPlusPlusLanguage::GetHardcodedSummaries() { HardcodedFormatters::HardcodedSyntheticFinder CPlusPlusLanguage::GetHardcodedSynthetics() { - static std::once_flag g_initialize; + static llvm::once_flag g_initialize; static ConstString g_vectortypes("VectorTypes"); static HardcodedFormatters::HardcodedSyntheticFinder g_formatters; - std::call_once(g_initialize, []() -> void { + llvm::call_once(g_initialize, []() -> void { g_formatters.push_back([](lldb_private::ValueObject &valobj, lldb::DynamicValueType, FormatManager & diff --git a/lldb/source/Plugins/Language/Go/GoLanguage.cpp b/lldb/source/Plugins/Language/Go/GoLanguage.cpp index a1f97c21c94..66b4530abc7 100644 --- a/lldb/source/Plugins/Language/Go/GoLanguage.cpp +++ b/lldb/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(lldb::LanguageType language) { HardcodedFormatters::HardcodedSummaryFinder GoLanguage::GetHardcodedSummaries() { - static std::once_flag g_initialize; + static llvm::once_flag g_initialize; static HardcodedFormatters::HardcodedSummaryFinder g_formatters; - std::call_once(g_initialize, []() -> void { + llvm::call_once(g_initialize, []() -> void { g_formatters.push_back( [](lldb_private::ValueObject &valobj, lldb::DynamicValueType, FormatManager &) -> TypeSummaryImpl::SharedPointer { @@ -104,10 +105,10 @@ GoLanguage::GetHardcodedSummaries() { HardcodedFormatters::HardcodedSyntheticFinder GoLanguage::GetHardcodedSynthetics() { - static std::once_flag g_initialize; + static llvm::once_flag g_initialize; static HardcodedFormatters::HardcodedSyntheticFinder g_formatters; - std::call_once(g_initialize, []() -> void { + llvm::call_once(g_initialize, []() -> void { g_formatters.push_back( [](lldb_private::ValueObject &valobj, lldb::DynamicValueType, FormatManager &fmt_mgr) -> SyntheticChildren::SharedPointer { diff --git a/lldb/source/Plugins/Language/Java/JavaLanguage.cpp b/lldb/source/Plugins/Language/Java/JavaLanguage.cpp index 4a825c41efa..b17862f0b6a 100644 --- a/lldb/source/Plugins/Language/Java/JavaLanguage.cpp +++ b/lldb/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(ValueObject &valobj) { } lldb::TypeCategoryImplSP JavaLanguage::GetFormatters() { - static std::once_flag g_initialize; + static llvm::once_flag g_initialize; static TypeCategoryImplSP g_category; - std::call_once(g_initialize, [this]() -> void { + llvm::call_once(g_initialize, [this]() -> void { DataVisualization::Categories::GetCategory(GetPluginName(), g_category); if (g_category) { llvm::StringRef array_regexp("^.*\\[\\]&?$"); diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp index b02d90a0f38..193c5864d01 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp +++ b/lldb/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(TypeCategoryImplSP objc_category_sp) { } lldb::TypeCategoryImplSP ObjCLanguage::GetFormatters() { - static std::once_flag g_initialize; + static llvm::once_flag g_initialize; static TypeCategoryImplSP g_category; - std::call_once(g_initialize, [this]() -> void { + llvm::call_once(g_initialize, [this]() -> void { DataVisualization::Categories::GetCategory(GetPluginName(), g_category); if (g_category) { LoadCoreMediaFormatters(g_category); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 4f593a45317..aecf9ae24d0 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -242,8 +242,8 @@ FileSpec PlatformAppleSimulator::GetCoreSimulatorPath() { void PlatformAppleSimulator::LoadCoreSimulator() { #if defined(__APPLE__) - static std::once_flag g_load_core_sim_flag; - std::call_once(g_load_core_sim_flag, [this] { + static llvm::once_flag g_load_core_sim_flag; + llvm::call_once(g_load_core_sim_flag, [this] { const std::string core_sim_path(GetCoreSimulatorPath().GetPath()); if (core_sim_path.size()) dlopen(core_sim_path.c_str(), RTLD_LAZY); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 27a42226b2f..77abd6d104a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/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 FileSpec &fspec) { static FileSpec GetXcodeContentsPath() { static FileSpec g_xcode_filespec; - static std::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + static llvm::once_flag g_once_flag; + llvm::call_once(g_once_flag, []() { FileSpec fspec; @@ -1693,8 +1694,8 @@ lldb_private::FileSpec PlatformDarwin::LocateExecutable(const char *basename) { // Find the global list of directories that we will search for // executables once so we don't keep doing the work over and over. - static std::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + static llvm::once_flag g_once_flag; + llvm::call_once(g_once_flag, []() { // When locating executables, trust the DEVELOPER_DIR first if it is set FileSpec xcode_contents_dir = GetXcodeContentsPath(); diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp index b26e3eee19a..1a3ac23de27 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ b/lldb/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::TargetSP target_sp, } void ProcessFreeBSD::Initialize() { - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); ProcessPOSIXLog::Initialize(GetPluginNameStatic()); diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 7682d9efc24..fc0e312c6c7 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/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; + static llvm::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/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index a757bba70d1..121418dad5d 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/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; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance, DebuggerInitialize); diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp index 9ced11c7ca2..0c5a518d1c9 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIXLog.cpp +++ b/lldb/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; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, [name]() { + llvm::call_once(g_once_flag, [name]() { Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories}; Log::RegisterLogChannel(name, log_callbacks); diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp index 50f787f7849..28068d9a1eb 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ b/lldb/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(lldb::TargetSP target_sp, } void ProcessWindows::Initialize() { - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); }); diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp index 242c1996bdd..3434808e94e 100644 --- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.cpp +++ b/lldb/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/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp index ddef3ce112b..87cde70023d 100644 --- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ b/lldb/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; + static llvm::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/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp index 7751eeea72d..67e4c653946 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp +++ b/lldb/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 GDBRemoteCommunicationServerPlatform::FreePortForProcess(lldb::pid_t pid) { const FileSpec &GDBRemoteCommunicationServerPlatform::GetDomainSocketDir() { static FileSpec g_domainsocket_dir; - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { const char *domainsocket_dir_env = ::getenv("LLDB_DEBUGSERVER_DOMAINSOCKET_DIR"); if (domainsocket_dir_env != nullptr) diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 6766da919ae..122cd9f7eb7 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/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::KillDebugserverProcess() { } void ProcessGDBRemote::Initialize() { - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance, DebuggerInitialize); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp index 899037ae98a..7735cc0ba99 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp +++ b/lldb/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; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { Log::Callbacks log_callbacks = {DisableLog, EnableLog, ListLogCategories}; Log::RegisterLogChannel(g_name, log_callbacks); diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp index f83499cdb23..237824ba3d3 100644 --- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ b/lldb/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::GetMemoryRegionInfo(addr_t load_addr, void ProcessMachCore::Clear() { m_thread_list.Clear(); } void ProcessMachCore::Initialize() { - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance); }); diff --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp index 46d8df8b16f..0b86b1efd8e 100644 --- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp +++ b/lldb/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; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), ProcessMinidump::CreateInstance); diff --git a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp b/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp index 8a440f2ed4e..f68576e6084 100644 --- a/lldb/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp +++ b/lldb/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::ExecuteInterpreterLoop() { } void ScriptInterpreterNone::Initialize() { - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), lldb::eScriptLanguageNone, CreateInstance); diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 56ddae14bcb..fdc13fbc8ac 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -326,9 +326,9 @@ ScriptInterpreterPython::~ScriptInterpreterPython() { } void ScriptInterpreterPython::Initialize() { - static std::once_flag g_once_flag; + static llvm::once_flag g_once_flag; - std::call_once(g_once_flag, []() { + llvm::call_once(g_once_flag, []() { PluginManager::RegisterPlugin(GetPluginNameStatic(), GetPluginDescriptionStatic(), lldb::eScriptLanguagePython, CreateInstance); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 1d3c4b461d5..7ca38dbea1c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/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,9 @@ uint32_t SymbolFileDWARF::CalculateAbilities() { 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/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index 40608989fb0..d396dc8899f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/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; }; |

