diff options
author | Kazu Hirata <kazu@google.com> | 2023-01-07 14:18:35 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-01-07 14:18:35 -0800 |
commit | 2fe8327406050d2585d2ced910a678e28caefcf5 (patch) | |
tree | da95c78fa33c17cf7829bbe6f5e0bfa62e0579ae /lldb/source/API | |
parent | f190ce625ab0dc5a5e2b2515e6d26debb34843ab (diff) | |
download | llvm-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/API')
-rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 8 | ||||
-rw-r--r-- | lldb/source/API/SBMemoryRegionInfo.cpp | 4 | ||||
-rw-r--r-- | lldb/source/API/SBType.cpp | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index 5a48dc8..cd6ef3b 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -47,7 +47,7 @@ public: m_auto_repeat_command = auto_repeat_command == nullptr ? std::nullopt - : llvm::Optional<std::string>(auto_repeat_command); + : std::optional<std::string>(auto_repeat_command); // We don't know whether any given command coming from this interface takes // arguments or not so here we're just disabling the basic args check. CommandArgumentData none_arg{eArgTypeNone, eArgRepeatStar}; @@ -60,8 +60,8 @@ public: /// but in short, if std::nullopt is returned, the previous command will be /// repeated, and if an empty string is returned, no commands will be /// executed. - llvm::Optional<std::string> GetRepeatCommand(Args ¤t_command_args, - uint32_t index) override { + std::optional<std::string> GetRepeatCommand(Args ¤t_command_args, + uint32_t index) override { if (!m_auto_repeat_command) return std::nullopt; else @@ -78,7 +78,7 @@ protected: return ret; } std::shared_ptr<lldb::SBCommandPluginInterface> m_backend; - llvm::Optional<std::string> m_auto_repeat_command; + std::optional<std::string> m_auto_repeat_command; }; SBCommandInterpreter::SBCommandInterpreter(CommandInterpreter *interpreter) diff --git a/lldb/source/API/SBMemoryRegionInfo.cpp b/lldb/source/API/SBMemoryRegionInfo.cpp index bf2db7b..cd25be5 100644 --- a/lldb/source/API/SBMemoryRegionInfo.cpp +++ b/lldb/source/API/SBMemoryRegionInfo.cpp @@ -134,7 +134,7 @@ uint32_t SBMemoryRegionInfo::GetNumDirtyPages() { LLDB_INSTRUMENT_VA(this); uint32_t num_dirty_pages = 0; - const llvm::Optional<std::vector<addr_t>> &dirty_page_list = + const std::optional<std::vector<addr_t>> &dirty_page_list = m_opaque_up->GetDirtyPageList(); if (dirty_page_list) num_dirty_pages = dirty_page_list->size(); @@ -146,7 +146,7 @@ addr_t SBMemoryRegionInfo::GetDirtyPageAddressAtIndex(uint32_t idx) { LLDB_INSTRUMENT_VA(this, idx); addr_t dirty_page_addr = LLDB_INVALID_ADDRESS; - const llvm::Optional<std::vector<addr_t>> &dirty_page_list = + const std::optional<std::vector<addr_t>> &dirty_page_list = m_opaque_up->GetDirtyPageList(); if (dirty_page_list && idx < dirty_page_list->size()) dirty_page_addr = (*dirty_page_list)[idx]; diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp index 9870099..1ccc3b0 100644 --- a/lldb/source/API/SBType.cpp +++ b/lldb/source/API/SBType.cpp @@ -121,7 +121,7 @@ uint64_t SBType::GetByteSize() { LLDB_INSTRUMENT_VA(this); if (IsValid()) - if (llvm::Optional<uint64_t> size = + if (std::optional<uint64_t> size = m_opaque_sp->GetCompilerType(false).GetByteSize(nullptr)) return *size; return 0; |