From: Nico Weber Date: Thu, 29 Sep 2022 00:11:58 +0000 (-0400) Subject: [lldb] Fix deprecation warnings for hasValue and getValue in mac-only code paths X-Git-Tag: upstream/17.0.6~32195 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=faaff2cdceac49d2e7c719fe994c5eee343ec818;p=platform%2Fupstream%2Fllvm.git [lldb] Fix deprecation warnings for hasValue and getValue in mac-only code paths No behavior change. --- diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 191ce82..d610ac1 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -104,7 +104,7 @@ void PlatformAppleSimulator::GetStatus(Stream &strm) { strm << " " << device.GetUDID() << ": " << device.GetName() << "\n"; } - if (m_device.hasValue() && m_device->operator bool()) { + if (m_device.has_value() && m_device->operator bool()) { strm << "Current device: " << m_device->GetUDID() << ": " << m_device->GetName(); if (m_device->GetState() == CoreSimulatorSupport::Device::State::Booted) { @@ -226,13 +226,13 @@ PlatformAppleSimulator::DebugProcess(ProcessLaunchInfo &launch_info, FileSpec PlatformAppleSimulator::GetCoreSimulatorPath() { #if defined(__APPLE__) std::lock_guard guard(m_core_sim_path_mutex); - if (!m_core_simulator_framework_path.hasValue()) { + if (!m_core_simulator_framework_path.has_value()) { m_core_simulator_framework_path = FileSpec("/Library/Developer/PrivateFrameworks/CoreSimulator.framework/" "CoreSimulator"); FileSystem::Instance().Resolve(*m_core_simulator_framework_path); } - return m_core_simulator_framework_path.getValue(); + return m_core_simulator_framework_path.value(); #else return FileSpec(); #endif @@ -251,16 +251,17 @@ void PlatformAppleSimulator::LoadCoreSimulator() { #if defined(__APPLE__) CoreSimulatorSupport::Device PlatformAppleSimulator::GetSimulatorDevice() { - if (!m_device.hasValue()) { + if (!m_device.has_value()) { const CoreSimulatorSupport::DeviceType::ProductFamilyID dev_id = m_kind; - std::string developer_dir = HostInfo::GetXcodeDeveloperDirectory().GetPath(); + std::string developer_dir = + HostInfo::GetXcodeDeveloperDirectory().GetPath(); m_device = CoreSimulatorSupport::DeviceSet::GetAvailableDevices( developer_dir.c_str()) .GetFanciest(dev_id); } - if (m_device.hasValue()) - return m_device.getValue(); + if (m_device.has_value()) + return m_device.value(); else return CoreSimulatorSupport::Device(); } diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm index f8c3ed6..46eec34 100644 --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -167,21 +167,21 @@ CoreSimulatorSupport::OSVersion::OSVersion() : OSVersion("", "") {} CoreSimulatorSupport::ModelIdentifier CoreSimulatorSupport::DeviceType::GetModelIdentifier() { - if (!m_model_identifier.hasValue()) { + if (!m_model_identifier.has_value()) { auto utf8_model_id = [[m_dev modelIdentifier] UTF8String]; if (utf8_model_id && *utf8_model_id) m_model_identifier = ModelIdentifier(utf8_model_id); } - if (m_model_identifier.hasValue()) - return m_model_identifier.getValue(); + if (m_model_identifier.has_value()) + return m_model_identifier.value(); else return ModelIdentifier(); } CoreSimulatorSupport::OSVersion CoreSimulatorSupport::DeviceRuntime::GetVersion() { - if (!m_os_version.hasValue()) { + if (!m_os_version.has_value()) { auto utf8_ver_string = [[m_dev versionString] UTF8String]; auto utf8_build_ver = [[m_dev buildVersionString] UTF8String]; if (utf8_ver_string && *utf8_ver_string && utf8_build_ver && @@ -190,8 +190,8 @@ CoreSimulatorSupport::DeviceRuntime::GetVersion() { } } - if (m_os_version.hasValue()) - return m_os_version.getValue(); + if (m_os_version.has_value()) + return m_os_version.value(); return OSVersion(); } @@ -218,18 +218,18 @@ std::string CoreSimulatorSupport::Device::GetUDID() const { } CoreSimulatorSupport::DeviceType CoreSimulatorSupport::Device::GetDeviceType() { - if (!m_dev_type.hasValue()) + if (!m_dev_type.has_value()) m_dev_type = DeviceType([m_dev deviceType]); - return m_dev_type.getValue(); + return m_dev_type.value(); } CoreSimulatorSupport::DeviceRuntime CoreSimulatorSupport::Device::GetDeviceRuntime() { - if (!m_dev_runtime.hasValue()) + if (!m_dev_runtime.has_value()) m_dev_runtime = DeviceRuntime([m_dev runtime]); - return m_dev_runtime.getValue(); + return m_dev_runtime.value(); } bool CoreSimulatorSupport:: diff --git a/lldb/source/Utility/SelectHelper.cpp b/lldb/source/Utility/SelectHelper.cpp index 05dbd1c..22d35be 100644 --- a/lldb/source/Utility/SelectHelper.cpp +++ b/lldb/source/Utility/SelectHelper.cpp @@ -138,15 +138,15 @@ lldb_private::Status SelectHelper::Select() { llvm::SmallVector write_fdset; llvm::SmallVector error_fdset; - if (max_read_fd.hasValue()) { + if (max_read_fd.has_value()) { read_fdset.resize((nfds / FD_SETSIZE) + 1); read_fdset_ptr = read_fdset.data(); } - if (max_write_fd.hasValue()) { + if (max_write_fd.has_value()) { write_fdset.resize((nfds / FD_SETSIZE) + 1); write_fdset_ptr = write_fdset.data(); } - if (max_error_fd.hasValue()) { + if (max_error_fd.has_value()) { error_fdset.resize((nfds / FD_SETSIZE) + 1); error_fdset_ptr = error_fdset.data(); }