Author: Fangrui Song Date: 2022-12-17T05:01:54Z New Revision: 9464bd8c78d142225957abbf38ed3c2abaa9e180
URL: https://github.com/llvm/llvm-project/commit/9464bd8c78d142225957abbf38ed3c2abaa9e180 DIFF: https://github.com/llvm/llvm-project/commit/9464bd8c78d142225957abbf38ed3c2abaa9e180.diff LOG: [lldb] llvm::Optional::value => operator*/operator-> std::optional::value() has undesired exception checking semantics and is unavailable in some older Xcode. The call sites block std::optional migration. Added: Modified: lldb/include/lldb/Target/MemoryRegionInfo.h lldb/source/API/SBMemoryRegionInfo.cpp lldb/source/Breakpoint/BreakpointResolverFileLine.cpp lldb/source/Core/DumpDataExtractor.cpp lldb/source/Core/ValueObjectChild.cpp lldb/source/Host/common/File.cpp lldb/source/Host/common/Terminal.cpp lldb/source/Plugins/ABI/X86/ABIX86.cpp lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp lldb/source/Target/UnixSignals.cpp lldb/source/Utility/SelectHelper.cpp lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp lldb/unittests/Process/minidump/MinidumpParserTest.cpp lldb/unittests/Target/FindFileTest.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Target/MemoryRegionInfo.h b/lldb/include/lldb/Target/MemoryRegionInfo.h index cf38b6ea3345f..bfb8cc417b72b 100644 --- a/lldb/include/lldb/Target/MemoryRegionInfo.h +++ b/lldb/include/lldb/Target/MemoryRegionInfo.h @@ -132,7 +132,7 @@ class MemoryRegionInfo { void SetDirtyPageList(std::vector<lldb::addr_t> pagelist) { if (m_dirty_pages) - m_dirty_pages.value().clear(); + m_dirty_pages->clear(); m_dirty_pages = std::move(pagelist); } diff --git a/lldb/source/API/SBMemoryRegionInfo.cpp b/lldb/source/API/SBMemoryRegionInfo.cpp index 23d22fbe86c82..d8aafdc4b47f2 100644 --- a/lldb/source/API/SBMemoryRegionInfo.cpp +++ b/lldb/source/API/SBMemoryRegionInfo.cpp @@ -136,7 +136,7 @@ uint32_t SBMemoryRegionInfo::GetNumDirtyPages() { const llvm::Optional<std::vector<addr_t>> &dirty_page_list = m_opaque_up->GetDirtyPageList(); if (dirty_page_list) - num_dirty_pages = dirty_page_list.value().size(); + num_dirty_pages = dirty_page_list->size(); return num_dirty_pages; } @@ -147,8 +147,8 @@ addr_t SBMemoryRegionInfo::GetDirtyPageAddressAtIndex(uint32_t idx) { addr_t dirty_page_addr = LLDB_INVALID_ADDRESS; const llvm::Optional<std::vector<addr_t>> &dirty_page_list = m_opaque_up->GetDirtyPageList(); - if (dirty_page_list && idx < dirty_page_list.value().size()) - dirty_page_addr = dirty_page_list.value()[idx]; + if (dirty_page_list && idx < dirty_page_list->size()) + dirty_page_addr = (*dirty_page_list)[idx]; return dirty_page_addr; } diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index 3b6509bd8462f..2ee993a56bac1 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -241,12 +241,12 @@ void BreakpointResolverFileLine::DeduceSourceMapping( // Adding back any potentially reverse mapping stripped prefix. // for new_mapping_to. if (m_removed_prefix_opt.has_value()) - llvm::sys::path::append(new_mapping_to, m_removed_prefix_opt.value()); + llvm::sys::path::append(new_mapping_to, *m_removed_prefix_opt); 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.value(); + new_mapping_from = *new_mapping_from_opt; 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.value()); + llvm::sys::path::append(new_mapping_to, *new_mapping_to_opt); } } diff --git a/lldb/source/Core/DumpDataExtractor.cpp b/lldb/source/Core/DumpDataExtractor.cpp index 85b0dd2d943a6..87672bee7d30b 100644 --- a/lldb/source/Core/DumpDataExtractor.cpp +++ b/lldb/source/Core/DumpDataExtractor.cpp @@ -100,7 +100,7 @@ static lldb::offset_t DumpAPInt(Stream *s, const DataExtractor &data, bool is_signed, unsigned radix) { llvm::Optional<llvm::APInt> apint = GetAPInt(data, &offset, byte_size); if (apint) { - std::string apint_str = toString(apint.value(), radix, is_signed); + std::string apint_str = toString(*apint, radix, is_signed); switch (radix) { case 2: s->Write("0b", 2); @@ -669,7 +669,7 @@ lldb::offset_t lldb_private::DumpDataExtractor( llvm::Optional<llvm::APInt> apint = GetAPInt(DE, &offset, semantics_byte_size); if (apint) { - llvm::APFloat apfloat(semantics, apint.value()); + llvm::APFloat apfloat(semantics, *apint); llvm::SmallVector<char, 256> sv; if (format_max_padding) apfloat.toString(sv, format_precision, *format_max_padding); diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index ec29c029c1741..39067387dc978 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -83,7 +83,7 @@ ConstString ValueObjectChild::GetDisplayTypeName() { LazyBool ValueObjectChild::CanUpdateWithInvalidExecutionContext() { if (m_can_update_with_invalid_exe_ctx) - return m_can_update_with_invalid_exe_ctx.value(); + return *m_can_update_with_invalid_exe_ctx; if (m_parent) { ValueObject *opinionated_parent = m_parent->FollowParentChain([](ValueObject *valobj) -> bool { @@ -91,13 +91,11 @@ LazyBool ValueObjectChild::CanUpdateWithInvalidExecutionContext() { eLazyBoolCalculate); }); if (opinionated_parent) - return (m_can_update_with_invalid_exe_ctx = - opinionated_parent->CanUpdateWithInvalidExecutionContext()) - .value(); + return *(m_can_update_with_invalid_exe_ctx = + opinionated_parent->CanUpdateWithInvalidExecutionContext()); } - return (m_can_update_with_invalid_exe_ctx = - this->ValueObject::CanUpdateWithInvalidExecutionContext()) - .value(); + return *(m_can_update_with_invalid_exe_ctx = + this->ValueObject::CanUpdateWithInvalidExecutionContext()); } bool ValueObjectChild::UpdateValue() { diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index 5c69373db22c8..0711c661214c3 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -833,20 +833,19 @@ SerialPort::Create(int fd, OpenOptions options, Options serial_options, if (llvm::Error error = term.SetRaw()) return std::move(error); if (serial_options.BaudRate) { - if (llvm::Error error = term.SetBaudRate(serial_options.BaudRate.value())) + if (llvm::Error error = term.SetBaudRate(*serial_options.BaudRate)) return std::move(error); } if (serial_options.Parity) { - if (llvm::Error error = term.SetParity(serial_options.Parity.value())) + if (llvm::Error error = term.SetParity(*serial_options.Parity)) return std::move(error); } if (serial_options.ParityCheck) { - if (llvm::Error error = - term.SetParityCheck(serial_options.ParityCheck.value())) + if (llvm::Error error = term.SetParityCheck(*serial_options.ParityCheck)) return std::move(error); } if (serial_options.StopBits) { - if (llvm::Error error = term.SetStopBits(serial_options.StopBits.value())) + if (llvm::Error error = term.SetStopBits(*serial_options.StopBits)) return std::move(error); } diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp index 5a6fca95987bf..519355c50598c 100644 --- a/lldb/source/Host/common/Terminal.cpp +++ b/lldb/source/Host/common/Terminal.cpp @@ -281,11 +281,11 @@ llvm::Error Terminal::SetBaudRate(unsigned int baud_rate) { return llvm::createStringError(llvm::inconvertibleErrorCode(), "baud rate %d unsupported by the platform", baud_rate); - if (::cfsetispeed(&fd_termios, val.value()) != 0) + if (::cfsetispeed(&fd_termios, *val) != 0) return llvm::createStringError( std::error_code(errno, std::generic_category()), "setting input baud rate failed"); - if (::cfsetospeed(&fd_termios, val.value()) != 0) + if (::cfsetospeed(&fd_termios, *val) != 0) return llvm::createStringError( std::error_code(errno, std::generic_category()), "setting output baud rate failed"); diff --git a/lldb/source/Plugins/ABI/X86/ABIX86.cpp b/lldb/source/Plugins/ABI/X86/ABIX86.cpp index 1306bded5f37b..13ea522e220c7 100644 --- a/lldb/source/Plugins/ABI/X86/ABIX86.cpp +++ b/lldb/source/Plugins/ABI/X86/ABIX86.cpp @@ -101,8 +101,8 @@ addCombinedRegisters(std::vector<DynamicRegisterInfo::Register> ®s, if (regdata1->subreg_name != regdata2->subreg_name) continue; - uint32_t base_index1 = regdata1->base_index.value(); - uint32_t base_index2 = regdata2->base_index.value(); + uint32_t base_index1 = *regdata1->base_index; + uint32_t base_index2 = *regdata2->base_index; if (regs[base_index1].byte_size != base_size || regs[base_index2].byte_size != base_size) continue; diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp index eae950df862b2..48363a558eac3 100644 --- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp @@ -398,7 +398,7 @@ lldb::InstructionControlFlowKind GetControlFlowKind(bool is_exec_mode_64b, if (!ret) return lldb::eInstructionControlFlowKindUnknown; else - return MapOpcodeIntoControlFlowKind(ret.value()); + return MapOpcodeIntoControlFlowKind(*ret); } } // namespace x86 @@ -1710,13 +1710,13 @@ const char *DisassemblerLLVMC::SymbolLookup(uint64_t value, uint64_t *type_ptr, // then this is a pc-relative address calculation. if (*type_ptr == LLVMDisassembler_ReferenceType_In_ARM64_ADDXri && m_adrp_insn && m_adrp_address == pc - 4 && - (m_adrp_insn.value() & 0x1f) == ((value >> 5) & 0x1f)) { + (*m_adrp_insn & 0x1f) == ((value >> 5) & 0x1f)) { uint32_t addxri_inst; uint64_t adrp_imm, addxri_imm; // Get immlo and immhi bits, OR them together to get the ADRP imm // value. - adrp_imm = ((m_adrp_insn.value() & 0x00ffffe0) >> 3) | - ((m_adrp_insn.value() >> 29) & 0x3); + adrp_imm = + ((*m_adrp_insn & 0x00ffffe0) >> 3) | ((*m_adrp_insn >> 29) & 0x3); // if high bit of immhi after right-shifting set, sign extend if (adrp_imm & (1ULL << 20)) adrp_imm |= ~((1ULL << 21) - 1); diff --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp index a3e604916a0ea..1af60d25f7bc2 100644 --- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp +++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp @@ -339,7 +339,7 @@ bool AtomicSequence(EmulateInstructionRISCV &emulator) { const auto pc = emulator.ReadPC(); if (!pc) return false; - auto current_pc = pc.value(); + auto current_pc = *pc; const auto entry_pc = current_pc; // The first instruction should be LR.W or LR.D diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp index 97b62b4601669..1b152c16eac2a 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp @@ -257,11 +257,11 @@ void CPlusPlusLanguage::MethodName::Parse() { } else { CPlusPlusNameParser parser(m_full.GetStringRef()); if (auto function = parser.ParseAsFunctionDefinition()) { - m_basename = function.value().name.basename; - m_context = function.value().name.context; - m_arguments = function.value().arguments; - m_qualifiers = function.value().qualifiers; - m_return_type = function.value().return_type; + m_basename = function->name.basename; + m_context = function->name.context; + m_arguments = function->arguments; + m_qualifiers = function->qualifiers; + m_return_type = function->return_type; m_parse_error = false; } else { m_parse_error = true; @@ -402,8 +402,8 @@ bool CPlusPlusLanguage::ExtractContextAndIdentifier( CPlusPlusNameParser parser(name); if (auto full_name = parser.ParseAsFullName()) { - identifier = full_name.value().basename; - context = full_name.value().context; + identifier = full_name->basename; + context = full_name->context; return true; } return false; diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index e2afdce45857b..f28555ca0e1ef 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -6539,7 +6539,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp, const llvm::Optional<std::vector<addr_t>> &dirty_page_list = range_info.GetDirtyPageList(); if (dirty_pages_only && dirty_page_list) { - for (addr_t dirtypage : dirty_page_list.value()) { + for (addr_t dirtypage : *dirty_page_list) { page_object obj; obj.addr = dirtypage; obj.size = pagesize; diff --git a/lldb/source/Target/UnixSignals.cpp b/lldb/source/Target/UnixSignals.cpp index 3ece3ee24cbe6..a92138ad2514f 100644 --- a/lldb/source/Target/UnixSignals.cpp +++ b/lldb/source/Target/UnixSignals.cpp @@ -300,13 +300,13 @@ UnixSignals::GetFilteredSignals(llvm::Optional<bool> should_suppress, // If any of filtering conditions are not met, we move on to the next // signal. - if (should_suppress && signal_suppress != should_suppress.value()) + if (should_suppress && signal_suppress != *should_suppress) continue; - if (should_stop && signal_stop != should_stop.value()) + if (should_stop && signal_stop != *should_stop) continue; - if (should_notify && signal_notify != should_notify.value()) + if (should_notify && signal_notify != *should_notify) continue; result.push_back(signo); diff --git a/lldb/source/Utility/SelectHelper.cpp b/lldb/source/Utility/SelectHelper.cpp index 22d35bec0ef30..fe0ee1d44a763 100644 --- a/lldb/source/Utility/SelectHelper.cpp +++ b/lldb/source/Utility/SelectHelper.cpp @@ -198,7 +198,7 @@ lldb_private::Status SelectHelper::Select() { if (m_end_time) { tv_ptr = &tv; const auto remaining_dur = - duration_cast<microseconds>(m_end_time.value() - steady_clock::now()); + duration_cast<microseconds>(*m_end_time - steady_clock::now()); if (remaining_dur.count() > 0) { // Wait for a specific amount of time const auto dur_secs = duration_cast<seconds>(remaining_dur); diff --git a/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp b/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp index 23cdd77e2c734..406c0ae8f4b56 100644 --- a/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp +++ b/lldb/unittests/Instruction/RISCV/TestRISCVEmulator.cpp @@ -566,7 +566,7 @@ TEST_F(RISCVEmulatorTester, TestFloatInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, i.name); - TestF_D_CalInst(this, decode.value(), i.rs1_val, i.rs2_val, i.rd_val); + TestF_D_CalInst(this, *decode, i.rs1_val, i.rs2_val, i.rd_val); } } @@ -604,7 +604,7 @@ TEST_F(RISCVEmulatorTester, TestDoubleInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, i.name); - TestF_D_CalInst(this, decode.value(), i.rs1_val, i.rs2_val, i.rd_val); + TestF_D_CalInst(this, *decode, i.rs1_val, i.rs2_val, i.rd_val); } } @@ -704,7 +704,7 @@ TEST_F(RISCVEmulatorTester, TestFloatLSInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, "FLW"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(this->fpr.fpr[DecodeRD(FLWInst)], bits); this->fpr.fpr[DecodeRS2(FSWInst)] = bits; @@ -712,7 +712,7 @@ TEST_F(RISCVEmulatorTester, TestFloatLSInst) { ASSERT_TRUE(decode.has_value()); name = decode->pattern.name; ASSERT_EQ(name, "FSW"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(*(uint32_t *)(this->memory + 16), bits); } @@ -728,7 +728,7 @@ TEST_F(RISCVEmulatorTester, TestDoubleLSInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, "FLD"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(this->fpr.fpr[DecodeRD(FLDInst)], bits); this->fpr.fpr[DecodeRS2(FSDInst)] = bits; @@ -736,7 +736,7 @@ TEST_F(RISCVEmulatorTester, TestDoubleLSInst) { ASSERT_TRUE(decode.has_value()); name = decode->pattern.name; ASSERT_EQ(name, "FSD"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(*(uint64_t *)(this->memory + 16), bits); } @@ -750,7 +750,7 @@ TEST_F(RISCVEmulatorTester, TestFMV_X_WInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, "FMV_X_W"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(this->gpr.gpr[DecodeRD(FMV_X_WInst)], exp_bits); } @@ -764,7 +764,7 @@ TEST_F(RISCVEmulatorTester, TestFMV_X_DInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, "FMV_X_D"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(this->gpr.gpr[DecodeRD(FMV_X_DInst)], exp_bits); } @@ -778,7 +778,7 @@ TEST_F(RISCVEmulatorTester, TestFMV_W_XInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, "FMV_W_X"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(this->fpr.fpr[DecodeRD(FMV_W_XInst)], exp_bits); } @@ -792,6 +792,6 @@ TEST_F(RISCVEmulatorTester, TestFMV_D_XInst) { ASSERT_TRUE(decode.has_value()); std::string name = decode->pattern.name; ASSERT_EQ(name, "FMV_D_X"); - ASSERT_TRUE(this->Execute(decode.value(), false)); + ASSERT_TRUE(this->Execute(*decode, false)); ASSERT_EQ(this->fpr.fpr[DecodeRD(FMV_D_XInst)], bits); } diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index b396bdb25076b..c570c08d7c546 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -192,12 +192,11 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo) { auto result = async_result.get(); ASSERT_TRUE(result.has_value()); ASSERT_EQ(1u, result->size()); - EXPECT_EQ("/foo/bar.so", result.value()[0].GetFileSpec().GetPath()); - EXPECT_EQ(triple, result.value()[0].GetArchitecture().GetTriple()); - EXPECT_EQ(UUID("@ABCDEFGHIJKLMNO", 16), - result.value()[0].GetUUID()); - EXPECT_EQ(0u, result.value()[0].GetObjectOffset()); - EXPECT_EQ(1234u, result.value()[0].GetObjectSize()); + EXPECT_EQ("/foo/bar.so", (*result)[0].GetFileSpec().GetPath()); + EXPECT_EQ(triple, (*result)[0].GetArchitecture().GetTriple()); + EXPECT_EQ(UUID("@ABCDEFGHIJKLMNO", 16), (*result)[0].GetUUID()); + EXPECT_EQ(0u, (*result)[0].GetObjectOffset()); + EXPECT_EQ(1234u, (*result)[0].GetObjectSize()); } TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) { @@ -217,12 +216,11 @@ TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfo_UUID20) { auto result = async_result.get(); ASSERT_TRUE(result.has_value()); ASSERT_EQ(1u, result->size()); - EXPECT_EQ("/foo/bar.so", result.value()[0].GetFileSpec().GetPath()); - EXPECT_EQ(triple, result.value()[0].GetArchitecture().GetTriple()); - EXPECT_EQ(UUID("@ABCDEFGHIJKLMNOPQRS", 20), - result.value()[0].GetUUID()); - EXPECT_EQ(0u, result.value()[0].GetObjectOffset()); - EXPECT_EQ(1234u, result.value()[0].GetObjectSize()); + EXPECT_EQ("/foo/bar.so", (*result)[0].GetFileSpec().GetPath()); + EXPECT_EQ(triple, (*result)[0].GetArchitecture().GetTriple()); + EXPECT_EQ(UUID("@ABCDEFGHIJKLMNOPQRS", 20), (*result)[0].GetUUID()); + EXPECT_EQ(0u, (*result)[0].GetObjectOffset()); + EXPECT_EQ(1234u, (*result)[0].GetObjectSize()); } TEST_F(GDBRemoteCommunicationClientTest, GetModulesInfoInvalidResponse) { diff --git a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp index 9efc0b0bc0b6d..6b38baab1815f 100644 --- a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp +++ b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp @@ -219,7 +219,7 @@ TEST_F(MinidumpParserTest, GetPid) { llvm::Succeeded()); llvm::Optional<lldb::pid_t> pid = parser->GetPid(); ASSERT_TRUE(pid.has_value()); - ASSERT_EQ(16001UL, pid.value()); + ASSERT_EQ(16001UL, *pid); } TEST_F(MinidumpParserTest, GetFilteredModuleList) { @@ -545,14 +545,14 @@ TEST_F(MinidumpParserTest, GetMiscInfoWindows) { ASSERT_NE(nullptr, misc_info); llvm::Optional<lldb::pid_t> pid = misc_info->GetPid(); ASSERT_TRUE(pid.has_value()); - ASSERT_EQ(4440UL, pid.value()); + ASSERT_EQ(4440UL, *pid); } TEST_F(MinidumpParserTest, GetPidWindows) { SetUpData("fizzbuzz_no_heap.dmp"); llvm::Optional<lldb::pid_t> pid = parser->GetPid(); ASSERT_TRUE(pid.has_value()); - ASSERT_EQ(4440UL, pid.value()); + ASSERT_EQ(4440UL, *pid); } // wow64 @@ -560,7 +560,7 @@ TEST_F(MinidumpParserTest, GetPidWow64) { SetUpData("fizzbuzz_wow64.dmp"); llvm::Optional<lldb::pid_t> pid = parser->GetPid(); ASSERT_TRUE(pid.has_value()); - ASSERT_EQ(7836UL, pid.value()); + ASSERT_EQ(7836UL, *pid); } // Register tests diff --git a/lldb/unittests/Target/FindFileTest.cpp b/lldb/unittests/Target/FindFileTest.cpp index b74d557e61023..0921325c3b3d8 100644 --- a/lldb/unittests/Target/FindFileTest.cpp +++ b/lldb/unittests/Target/FindFileTest.cpp @@ -56,7 +56,7 @@ static void TestFileFindings(const PathMappingList &map, llvm::Optional<FileSpec> remapped; EXPECT_TRUE(bool(remapped = map.FindFile(match.original))); - EXPECT_TRUE(FileSpec(remapped.value()).GetPath() == + EXPECT_TRUE(FileSpec(*remapped).GetPath() == ConstString(match.remapped).GetStringRef()); } } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits