From 2fe8327406050d2585d2ced910a678e28caefcf5 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 7 Jan 2023 14:18:35 -0800 Subject: [lldb] Use std::optional instead of llvm::Optional (NFC) This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to clean up the "using" declarations, #include "llvm/ADT/Optional.h", etc. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 --- lldb/source/Breakpoint/BreakpointResolverFileLine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lldb/source/Breakpoint/BreakpointResolverFileLine.cpp') diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 4b108a0..890b38a 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -25,7 +25,7 @@ using namespace lldb_private; BreakpointResolverFileLine::BreakpointResolverFileLine( const BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue, const SourceLocationSpec &location_spec, - llvm::Optional removed_prefix_opt) + std::optional removed_prefix_opt) : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver, offset), m_location_spec(location_spec), m_skip_prologue(skip_prologue), m_removed_prefix_opt(removed_prefix_opt) {} @@ -205,7 +205,7 @@ void BreakpointResolverFileLine::DeduceSourceMapping( // of "a" after consuming "b" from the back. auto check_suffix = [path_separator](llvm::StringRef a, llvm::StringRef b, - bool case_sensitive) -> llvm::Optional { + bool case_sensitive) -> std::optional { if (case_sensitive ? a.consume_back(b) : a.consume_back_insensitive(b)) { if (a.empty() || a.endswith(path_separator)) { return a; @@ -244,14 +244,14 @@ void BreakpointResolverFileLine::DeduceSourceMapping( if (m_removed_prefix_opt.has_value()) llvm::sys::path::append(new_mapping_to, *m_removed_prefix_opt); - llvm::Optional new_mapping_from_opt = + std::optional 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; if (new_mapping_to.empty()) new_mapping_to = "."; } else { - llvm::Optional new_mapping_to_opt = + std::optional new_mapping_to_opt = check_suffix(request_file_dir, sc_file_dir, case_sensitive); if (new_mapping_to_opt) { new_mapping_from = "."; @@ -291,7 +291,7 @@ Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback( // same file spec in their line_entry and treat each set separately. const uint32_t line = m_location_spec.GetLine().value_or(0); - const llvm::Optional column = m_location_spec.GetColumn(); + const std::optional column = m_location_spec.GetColumn(); const size_t num_comp_units = context.module_sp->GetNumCompileUnits(); for (size_t i = 0; i < num_comp_units; i++) { -- cgit v1.1