[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
This commit is contained in:
Kazu Hirata
2023-01-07 14:18:35 -08:00
parent f190ce625a
commit 2fe8327406
387 changed files with 1323 additions and 1324 deletions

View File

@@ -821,7 +821,7 @@ UUID ObjectFileELF::GetUUID() {
return m_uuid;
}
llvm::Optional<FileSpec> ObjectFileELF::GetDebugLink() {
std::optional<FileSpec> ObjectFileELF::GetDebugLink() {
if (m_gnu_debuglink_file.empty())
return std::nullopt;
return FileSpec(m_gnu_debuglink_file);
@@ -1767,7 +1767,7 @@ public:
return llvm::formatv("{0}[{1}]", SegmentName, SegmentCount).str();
}
llvm::Optional<VMRange> GetAddressInfo(const ELFProgramHeader &H) {
std::optional<VMRange> GetAddressInfo(const ELFProgramHeader &H) {
if (H.p_memsz == 0) {
LLDB_LOG(Log, "Ignoring zero-sized {0} segment. Corrupt object file?",
SegmentName);
@@ -1782,7 +1782,7 @@ public:
return VMRange(H.p_vaddr, H.p_memsz);
}
llvm::Optional<SectionAddressInfo> GetAddressInfo(const ELFSectionHeader &H) {
std::optional<SectionAddressInfo> GetAddressInfo(const ELFSectionHeader &H) {
VMRange Range = GetVMRange(H);
SectionSP Segment;
auto It = Segments.find(Range.GetRangeBase());