[lldb] Use Optional::{has_value,value,value_or}

This commit is contained in:
Kazu Hirata 2022-09-23 09:10:40 -07:00
parent 34f8112b79
commit 8600014b78
2 changed files with 5 additions and 5 deletions

View File

@ -240,13 +240,13 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
// Adding back any potentially reverse mapping stripped prefix.
// for new_mapping_to.
if (m_removed_prefix_opt.hasValue())
llvm::sys::path::append(new_mapping_to, m_removed_prefix_opt.getValue());
if (m_removed_prefix_opt.has_value())
llvm::sys::path::append(new_mapping_to, m_removed_prefix_opt.value());
llvm::Optional<llvm::StringRef> new_mapping_from_opt =
check_suffix(sc_file_dir, request_file_dir, case_sensitive);
if (new_mapping_from_opt) {
new_mapping_from = new_mapping_from_opt.getValue();
new_mapping_from = new_mapping_from_opt.value();
if (new_mapping_to.empty())
new_mapping_to = ".";
} else {
@ -254,7 +254,7 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
check_suffix(request_file_dir, sc_file_dir, case_sensitive);
if (new_mapping_to_opt) {
new_mapping_from = ".";
llvm::sys::path::append(new_mapping_to, new_mapping_to_opt.getValue());
llvm::sys::path::append(new_mapping_to, new_mapping_to_opt.value());
}
}

View File

@ -229,7 +229,7 @@ PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const {
if (!path_ref.consume_front(it.second.GetStringRef()))
continue;
auto orig_file = it.first.GetStringRef();
auto orig_style = FileSpec::GuessPathStyle(orig_file).getValueOr(
auto orig_style = FileSpec::GuessPathStyle(orig_file).value_or(
llvm::sys::path::Style::native);
fixed.SetFile(orig_file, orig_style);
AppendPathComponents(fixed, path_ref, orig_style);