[lldb] Use Optional::{has_value,value,value_or}
authorKazu Hirata <kazu@google.com>
Fri, 23 Sep 2022 16:10:40 +0000 (09:10 -0700)
committerKazu Hirata <kazu@google.com>
Fri, 23 Sep 2022 16:10:40 +0000 (09:10 -0700)
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Target/PathMappingList.cpp

index f911697..9e1fbcb 100644 (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());
       }
     }
 
index d2d6082..cbee593 100644 (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);