[lldb] Fix deprecation warnings for hasValue and getValue in mac-only code paths

No behavior change.
This commit is contained in:
Nico Weber 2022-09-28 20:11:58 -04:00
parent dcb94010eb
commit faaff2cdce
3 changed files with 21 additions and 20 deletions

View File

@ -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<std::mutex> 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();
}

View File

@ -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::

View File

@ -138,15 +138,15 @@ lldb_private::Status SelectHelper::Select() {
llvm::SmallVector<fd_set, 1> write_fdset;
llvm::SmallVector<fd_set, 1> 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();
}