aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-01-07 14:18:35 -0800
committerKazu Hirata <kazu@google.com>2023-01-07 14:18:35 -0800
commit2fe8327406050d2585d2ced910a678e28caefcf5 (patch)
treeda95c78fa33c17cf7829bbe6f5e0bfa62e0579ae /lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
parentf190ce625ab0dc5a5e2b2515e6d26debb34843ab (diff)
downloadllvm-2fe8327406050d2585d2ced910a678e28caefcf5.zip
llvm-2fe8327406050d2585d2ced910a678e28caefcf5.tar.gz
llvm-2fe8327406050d2585d2ced910a678e28caefcf5.tar.bz2
[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
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointResolverFileLine.cpp')
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverFileLine.cpp10
1 files changed, 5 insertions, 5 deletions
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<llvm::StringRef> removed_prefix_opt)
+ std::optional<llvm::StringRef> 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<llvm::StringRef> {
+ bool case_sensitive) -> std::optional<llvm::StringRef> {
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<llvm::StringRef> new_mapping_from_opt =
+ std::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;
if (new_mapping_to.empty())
new_mapping_to = ".";
} else {
- llvm::Optional<llvm::StringRef> new_mapping_to_opt =
+ std::optional<llvm::StringRef> 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<uint16_t> column = m_location_spec.GetColumn();
+ const std::optional<uint16_t> 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++) {