Author: Kazu Hirata Date: 2022-12-04T16:51:27-08:00 New Revision: d2a6114f27016065f6c7e7d39c0412e7d8d5e03b
URL: https://github.com/llvm/llvm-project/commit/d2a6114f27016065f6c7e7d39c0412e7d8d5e03b DIFF: https://github.com/llvm/llvm-project/commit/d2a6114f27016065f6c7e7d39c0412e7d8d5e03b.diff LOG: [lldb/unittests] Use std::nullopt instead of None (NFC) This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. 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 Added: Modified: lldb/unittests/Core/SourceLocationSpecTest.cpp lldb/unittests/DataFormatter/StringPrinterTests.cpp lldb/unittests/Host/SocketTest.cpp lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp lldb/unittests/Process/minidump/MinidumpParserTest.cpp lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp lldb/unittests/Signals/UnixSignalsTest.cpp lldb/unittests/Symbol/TestLineEntry.cpp lldb/unittests/Symbol/TestTypeSystemClang.cpp lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp lldb/unittests/Target/MemoryTagMapTest.cpp lldb/unittests/Utility/FileSpecTest.cpp lldb/unittests/Utility/ListenerTest.cpp lldb/unittests/Utility/PredicateTest.cpp lldb/unittests/Utility/ProcessInstanceInfoTest.cpp lldb/unittests/Utility/RegisterValueTest.cpp lldb/unittests/Utility/StringExtractorGDBRemoteTest.cpp lldb/unittests/Utility/TimeoutTest.cpp lldb/unittests/Utility/UriParserTest.cpp lldb/unittests/Utility/UserIDResolverTest.cpp lldb/unittests/tools/lldb-server/tests/TestClient.cpp Removed: ################################################################################ diff --git a/lldb/unittests/Core/SourceLocationSpecTest.cpp b/lldb/unittests/Core/SourceLocationSpecTest.cpp index 089c7640cc010..0cf1683906eed 100644 --- a/lldb/unittests/Core/SourceLocationSpecTest.cpp +++ b/lldb/unittests/Core/SourceLocationSpecTest.cpp @@ -51,7 +51,7 @@ TEST(SourceLocationSpecTest, FileLineColumnComponents) { EXPECT_TRUE(without_column); EXPECT_EQ(fs, without_column.GetFileSpec()); EXPECT_EQ(line, without_column.GetLine().value_or(0)); - EXPECT_EQ(llvm::None, without_column.GetColumn()); + EXPECT_EQ(std::nullopt, without_column.GetColumn()); EXPECT_FALSE(without_column.GetCheckInlines()); EXPECT_TRUE(without_column.GetExactMatch()); EXPECT_STREQ("check inlines = false, exact match = true, decl = /foo/bar:19", diff --git a/lldb/unittests/DataFormatter/StringPrinterTests.cpp b/lldb/unittests/DataFormatter/StringPrinterTests.cpp index a7fa6e8a13190..24c0ff41b5db2 100644 --- a/lldb/unittests/DataFormatter/StringPrinterTests.cpp +++ b/lldb/unittests/DataFormatter/StringPrinterTests.cpp @@ -41,7 +41,7 @@ static Optional<std::string> format(StringRef input, endian::InlHostByteOrder(), sizeof(void *))); const bool success = StringPrinter::ReadBufferAndDumpToStream<elem_ty>(opts); if (!success) - return llvm::None; + return std::nullopt; return out.GetString().str(); } diff --git a/lldb/unittests/Host/SocketTest.cpp b/lldb/unittests/Host/SocketTest.cpp index a209600141ff3..78e1e11df0656 100644 --- a/lldb/unittests/Host/SocketTest.cpp +++ b/lldb/unittests/Host/SocketTest.cpp @@ -179,7 +179,7 @@ TEST_P(SocketTest, DomainGetConnectURI) { CreateDomainConnectedSockets(domain_path, &socket_a_up, &socket_b_up); std::string uri(socket_a_up->GetRemoteConnectionURI()); - EXPECT_EQ((URI{"unix-connect", "", llvm::None, domain_path}), + EXPECT_EQ((URI{"unix-connect", "", std::nullopt, domain_path}), URI::Parse(uri)); EXPECT_EQ(socket_b_up->GetRemoteConnectionURI(), ""); diff --git a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp index 519dbd22a0b81..68a8980d692a4 100644 --- a/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp +++ b/lldb/unittests/ObjectFile/Breakpad/BreakpadRecordsTest.cpp @@ -25,9 +25,9 @@ TEST(Record, classify) { EXPECT_EQ(Record::StackWin, Record::classify("STACK WIN")); // Any obviously incorrect lines will be classified as such. - EXPECT_EQ(llvm::None, Record::classify("STACK")); - EXPECT_EQ(llvm::None, Record::classify("STACK CODE_ID")); - EXPECT_EQ(llvm::None, Record::classify("CODE_ID")); + EXPECT_EQ(std::nullopt, Record::classify("STACK")); + EXPECT_EQ(std::nullopt, Record::classify("STACK CODE_ID")); + EXPECT_EQ(std::nullopt, Record::classify("CODE_ID")); // Any line which does not start with a known keyword will be classified as a // line record, as those are the only ones that start without a keyword. @@ -41,10 +41,10 @@ TEST(ModuleRecord, parse) { ModuleRecord::parse( "MODULE Linux x86_64 404142434445464748494a4b4c4d4e4f0 a.out")); - EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE")); - EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE Linux")); - EXPECT_EQ(llvm::None, ModuleRecord::parse("MODULE Linux x86_64")); - EXPECT_EQ(llvm::None, + EXPECT_EQ(std::nullopt, ModuleRecord::parse("MODULE")); + EXPECT_EQ(std::nullopt, ModuleRecord::parse("MODULE Linux")); + EXPECT_EQ(std::nullopt, ModuleRecord::parse("MODULE Linux x86_64")); + EXPECT_EQ(std::nullopt, ModuleRecord::parse("MODULE Linux x86_64 deadbeefbaadf00d")); } @@ -53,15 +53,15 @@ TEST(InfoRecord, parse) { InfoRecord::parse("INFO CODE_ID 404142434445464748494a4b4c4d4e4f")); EXPECT_EQ(InfoRecord(UUID()), InfoRecord::parse("INFO CODE_ID 47 a.exe")); - EXPECT_EQ(llvm::None, InfoRecord::parse("INFO")); - EXPECT_EQ(llvm::None, InfoRecord::parse("INFO CODE_ID")); + EXPECT_EQ(std::nullopt, InfoRecord::parse("INFO")); + EXPECT_EQ(std::nullopt, InfoRecord::parse("INFO CODE_ID")); } TEST(FileRecord, parse) { EXPECT_EQ(FileRecord(47, "foo"), FileRecord::parse("FILE 47 foo")); - EXPECT_EQ(llvm::None, FileRecord::parse("FILE 47")); - EXPECT_EQ(llvm::None, FileRecord::parse("FILE")); - EXPECT_EQ(llvm::None, FileRecord::parse("")); + EXPECT_EQ(std::nullopt, FileRecord::parse("FILE 47")); + EXPECT_EQ(std::nullopt, FileRecord::parse("FILE")); + EXPECT_EQ(std::nullopt, FileRecord::parse("")); } TEST(FuncRecord, parse) { @@ -70,20 +70,20 @@ TEST(FuncRecord, parse) { EXPECT_EQ(FuncRecord(false, 0x47, 0x7, 0x8, "foo"), FuncRecord::parse("FUNC 47 7 8 foo")); - EXPECT_EQ(llvm::None, FuncRecord::parse("PUBLIC 47 7 8 foo")); - EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC 47 7 8")); - EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC 47 7")); - EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC 47")); - EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC m")); - EXPECT_EQ(llvm::None, FuncRecord::parse("FUNC")); + EXPECT_EQ(std::nullopt, FuncRecord::parse("PUBLIC 47 7 8 foo")); + EXPECT_EQ(std::nullopt, FuncRecord::parse("FUNC 47 7 8")); + EXPECT_EQ(std::nullopt, FuncRecord::parse("FUNC 47 7")); + EXPECT_EQ(std::nullopt, FuncRecord::parse("FUNC 47")); + EXPECT_EQ(std::nullopt, FuncRecord::parse("FUNC m")); + EXPECT_EQ(std::nullopt, FuncRecord::parse("FUNC")); } TEST(InlineOriginRecord, parse) { EXPECT_EQ(InlineOriginRecord(47, "foo"), InlineOriginRecord::parse("INLINE_ORIGIN 47 foo")); - EXPECT_EQ(llvm::None, InlineOriginRecord::parse("INLINE_ORIGIN 47")); - EXPECT_EQ(llvm::None, InlineOriginRecord::parse("INLINE_ORIGIN")); - EXPECT_EQ(llvm::None, InlineOriginRecord::parse("")); + EXPECT_EQ(std::nullopt, InlineOriginRecord::parse("INLINE_ORIGIN 47")); + EXPECT_EQ(std::nullopt, InlineOriginRecord::parse("INLINE_ORIGIN")); + EXPECT_EQ(std::nullopt, InlineOriginRecord::parse("")); } TEST(InlineRecord, parse) { @@ -92,20 +92,20 @@ TEST(InlineRecord, parse) { EXPECT_EQ(record1, InlineRecord::parse("INLINE 0 1 2 3 4 5")); record1.Ranges.emplace_back(6, 7); EXPECT_EQ(record1, InlineRecord::parse("INLINE 0 1 2 3 4 5 6 7")); - EXPECT_EQ(llvm::None, InlineRecord::parse("INLINE 0 1 2 3")); - EXPECT_EQ(llvm::None, InlineRecord::parse("INLINE 0 1 2 3 4 5 6")); - EXPECT_EQ(llvm::None, InlineRecord::parse("INLNIE 0")); - EXPECT_EQ(llvm::None, InlineRecord::parse("")); - EXPECT_EQ(llvm::None, InlineRecord::parse("FUNC")); + EXPECT_EQ(std::nullopt, InlineRecord::parse("INLINE 0 1 2 3")); + EXPECT_EQ(std::nullopt, InlineRecord::parse("INLINE 0 1 2 3 4 5 6")); + EXPECT_EQ(std::nullopt, InlineRecord::parse("INLNIE 0")); + EXPECT_EQ(std::nullopt, InlineRecord::parse("")); + EXPECT_EQ(std::nullopt, InlineRecord::parse("FUNC")); } TEST(LineRecord, parse) { EXPECT_EQ(LineRecord(0x47, 0x74, 47, 74), LineRecord::parse("47 74 47 74")); - EXPECT_EQ(llvm::None, LineRecord::parse("47 74 47")); - EXPECT_EQ(llvm::None, LineRecord::parse("47 74")); - EXPECT_EQ(llvm::None, LineRecord::parse("47")); - EXPECT_EQ(llvm::None, LineRecord::parse("")); - EXPECT_EQ(llvm::None, LineRecord::parse("FUNC")); + EXPECT_EQ(std::nullopt, LineRecord::parse("47 74 47")); + EXPECT_EQ(std::nullopt, LineRecord::parse("47 74")); + EXPECT_EQ(std::nullopt, LineRecord::parse("47")); + EXPECT_EQ(std::nullopt, LineRecord::parse("")); + EXPECT_EQ(std::nullopt, LineRecord::parse("FUNC")); } TEST(PublicRecord, parse) { @@ -114,11 +114,11 @@ TEST(PublicRecord, parse) { EXPECT_EQ(PublicRecord(false, 0x47, 0x8, "foo"), PublicRecord::parse("PUBLIC 47 8 foo")); - EXPECT_EQ(llvm::None, PublicRecord::parse("FUNC 47 8 foo")); - EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47 8")); - EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC 47")); - EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC m")); - EXPECT_EQ(llvm::None, PublicRecord::parse("PUBLIC")); + EXPECT_EQ(std::nullopt, PublicRecord::parse("FUNC 47 8 foo")); + EXPECT_EQ(std::nullopt, PublicRecord::parse("PUBLIC 47 8")); + EXPECT_EQ(std::nullopt, PublicRecord::parse("PUBLIC 47")); + EXPECT_EQ(std::nullopt, PublicRecord::parse("PUBLIC m")); + EXPECT_EQ(std::nullopt, PublicRecord::parse("PUBLIC")); } TEST(StackCFIRecord, parse) { @@ -129,19 +129,19 @@ TEST(StackCFIRecord, parse) { EXPECT_EQ(StackCFIRecord(0x47, 0x8, ".cfa: $esp 4 +"), StackCFIRecord::parse("STACK CFI INIT 47 8 .cfa: $esp 4 + ")); - EXPECT_EQ(StackCFIRecord(0x47, llvm::None, ".cfa: $esp 4 +"), + EXPECT_EQ(StackCFIRecord(0x47, std::nullopt, ".cfa: $esp 4 +"), StackCFIRecord::parse("STACK CFI 47 .cfa: $esp 4 +")); // The validity of the register value expressions is not checked EXPECT_EQ(StackCFIRecord(0x47, 0x8, ".cfa: ^ ^ ^"), StackCFIRecord::parse("STACK CFI INIT 47 8 .cfa: ^ ^ ^")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK CFI INIT 47")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK CFI INIT")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK CFI")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("STACK")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("FILE 47 foo")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("42 47")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("STACK CFI INIT 47")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("STACK CFI INIT")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("STACK CFI")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("STACK")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("FILE 47 foo")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("42 47")); } TEST(StackWinRecord, parse) { @@ -149,28 +149,29 @@ TEST(StackWinRecord, parse) { StackWinRecord(0x47, 0x8, 3, 4, 5, llvm::StringRef("$eip $esp ^ =")), StackWinRecord::parse("STACK WIN 4 47 8 1 2 3 4 5 6 1 $eip $esp ^ =")); - EXPECT_EQ(llvm::None, StackWinRecord::parse( - "STACK WIN 0 47 8 1 0 0 0 0 0 1 $eip $esp ^ =")); - EXPECT_EQ(llvm::None, + EXPECT_EQ(std::nullopt, StackWinRecord::parse( + "STACK WIN 0 47 8 1 0 0 0 0 0 1 $eip $esp ^ =")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0 0 0 0 0 1")); - EXPECT_EQ(llvm::None, StackWinRecord::parse( - "STACK WIN 3 47 8 1 0 0 0 0 0 1 $eip $esp ^ =")); - EXPECT_EQ(llvm::None, + EXPECT_EQ(std::nullopt, StackWinRecord::parse( + "STACK WIN 3 47 8 1 0 0 0 0 0 1 $eip $esp ^ =")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 3 47 8 1 0 0 0 0 0 0 1")); - EXPECT_EQ(llvm::None, StackWinRecord::parse( - "STACK WIN 4 47 8 1 0 0 0 0 1 $eip $esp ^ =")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0 0 0 0")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0 0 0")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0 0")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47 8 1 0")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47 8 1")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47 8")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4 47")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN 4")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK WIN")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("STACK")); - EXPECT_EQ(llvm::None, StackWinRecord::parse("")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("FILE 47 foo")); - EXPECT_EQ(llvm::None, StackCFIRecord::parse("42 47")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse( + "STACK WIN 4 47 8 1 0 0 0 0 1 $eip $esp ^ =")); + EXPECT_EQ(std::nullopt, + StackWinRecord::parse("STACK WIN 4 47 8 1 0 0 0 0 0")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0 0 0")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0 0")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47 8 1 0 0")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47 8 1 0")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47 8 1")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47 8")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4 47")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN 4")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK WIN")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("STACK")); + EXPECT_EQ(std::nullopt, StackWinRecord::parse("")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("FILE 47 foo")); + EXPECT_EQ(std::nullopt, StackCFIRecord::parse("42 47")); } diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp index 9f20708e42881..99d1e12359e72 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp @@ -71,7 +71,8 @@ class GDBRemoteClientBaseTest : public GDBRemoteTest { void WaitForRunEvent() { EventSP event_sp; listener_sp->GetEventForBroadcasterWithType( - &client, TestClient::eBroadcastBitRunPacketSent, event_sp, llvm::None); + &client, TestClient::eBroadcastBitRunPacketSent, event_sp, + std::nullopt); } }; diff --git a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp index 80a9d9878ed57..b396bdb25076b 100644 --- a/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp +++ b/lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp @@ -458,14 +458,14 @@ TEST_F(GDBRemoteCommunicationClientTest, GetQOffsets) { EXPECT_EQ((QOffsets{true, {0x1234, 0x2345}}), GetQOffsets("TextSeg=1234;DataSeg=2345")); - EXPECT_EQ(llvm::None, GetQOffsets("E05")); - EXPECT_EQ(llvm::None, GetQOffsets("Text=bogus")); - EXPECT_EQ(llvm::None, GetQOffsets("Text=1234")); - EXPECT_EQ(llvm::None, GetQOffsets("Text=1234;Data=1234;")); - EXPECT_EQ(llvm::None, GetQOffsets("Text=1234;Data=1234;Bss=1234;")); - EXPECT_EQ(llvm::None, GetQOffsets("TEXTSEG=1234")); - EXPECT_EQ(llvm::None, GetQOffsets("TextSeg=0x1234")); - EXPECT_EQ(llvm::None, GetQOffsets("TextSeg=12345678123456789")); + EXPECT_EQ(std::nullopt, GetQOffsets("E05")); + EXPECT_EQ(std::nullopt, GetQOffsets("Text=bogus")); + EXPECT_EQ(std::nullopt, GetQOffsets("Text=1234")); + EXPECT_EQ(std::nullopt, GetQOffsets("Text=1234;Data=1234;")); + EXPECT_EQ(std::nullopt, GetQOffsets("Text=1234;Data=1234;Bss=1234;")); + EXPECT_EQ(std::nullopt, GetQOffsets("TEXTSEG=1234")); + EXPECT_EQ(std::nullopt, GetQOffsets("TextSeg=0x1234")); + EXPECT_EQ(std::nullopt, GetQOffsets("TextSeg=12345678123456789")); } static void @@ -522,26 +522,28 @@ TEST_F(GDBRemoteCommunicationClientTest, ReadMemoryTags) { std::vector<uint8_t>{0x1, 0x2}); // Empty response is an error - check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "", llvm::None); + check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "", std::nullopt); // Usual error response check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "E01", - llvm::None); + std::nullopt); // Leading m missing - check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "01", llvm::None); + check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "01", + std::nullopt); // Anything other than m is an error check_qmemtags(client, server, 17, 1, "qMemTags:def0,11:1", "z01", - llvm::None); + std::nullopt); // Decoding tag data doesn't use all the chars in the packet check_qmemtags(client, server, 32, 1, "qMemTags:def0,20:1", "m09zz", - llvm::None); + std::nullopt); // Data that is not hex bytes check_qmemtags(client, server, 32, 1, "qMemTags:def0,20:1", "mhello", - llvm::None); + std::nullopt); // Data is not a complete hex char - check_qmemtags(client, server, 32, 1, "qMemTags:def0,20:1", "m9", llvm::None); + check_qmemtags(client, server, 32, 1, "qMemTags:def0,20:1", "m9", + std::nullopt); // Data has a trailing hex char check_qmemtags(client, server, 32, 1, "qMemTags:def0,20:1", "m01020", - llvm::None); + std::nullopt); } static void check_Qmemtags(TestClient &client, MockServer &server, diff --git a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp index ec6378dd5b820..9efc0b0bc0b6d 100644 --- a/lldb/unittests/Process/minidump/MinidumpParserTest.cpp +++ b/lldb/unittests/Process/minidump/MinidumpParserTest.cpp @@ -278,17 +278,17 @@ TEST_F(MinidumpParserTest, FindMemoryRange) { ... )"), llvm::Succeeded()); - EXPECT_EQ(llvm::None, parser->FindMemoryRange(0x00)); - EXPECT_EQ(llvm::None, parser->FindMemoryRange(0x2a)); + EXPECT_EQ(std::nullopt, parser->FindMemoryRange(0x00)); + EXPECT_EQ(std::nullopt, parser->FindMemoryRange(0x2a)); EXPECT_EQ((minidump::Range{0x401d46, llvm::ArrayRef<uint8_t>{0x54, 0x21}}), parser->FindMemoryRange(0x401d46)); - EXPECT_EQ(llvm::None, parser->FindMemoryRange(0x401d46 + 2)); + EXPECT_EQ(std::nullopt, parser->FindMemoryRange(0x401d46 + 2)); EXPECT_EQ( (minidump::Range{0x7ffceb34a000, llvm::ArrayRef<uint8_t>{0xc8, 0x4d, 0x04, 0xbc, 0xe9}}), parser->FindMemoryRange(0x7ffceb34a000 + 2)); - EXPECT_EQ(llvm::None, parser->FindMemoryRange(0x7ffceb34a000 + 5)); + EXPECT_EQ(std::nullopt, parser->FindMemoryRange(0x7ffceb34a000 + 5)); } TEST_F(MinidumpParserTest, GetMemory) { @@ -536,7 +536,7 @@ TEST_F(MinidumpParserTest, GetLinuxProcStatus_no_stream) { ... )"), llvm::Succeeded()); - EXPECT_EQ(llvm::None, parser->GetLinuxProcStatus()); + EXPECT_EQ(std::nullopt, parser->GetLinuxProcStatus()); } TEST_F(MinidumpParserTest, GetMiscInfoWindows) { diff --git a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp index 51ff7e4d3c8b6..2a5718aa255e8 100644 --- a/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp +++ b/lldb/unittests/ScriptInterpreter/Python/PythonTestSuite.cpp @@ -232,7 +232,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess( llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread( const char *python_function_name, const char *session_dictionary_name, lldb::ThreadSP thread) { - return llvm::None; + return std::nullopt; } bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget( @@ -244,7 +244,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget( llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame( const char *python_function_name, const char *session_dictionary_name, lldb::StackFrameSP frame) { - return llvm::None; + return std::nullopt; } bool lldb_private::LLDBSWIGPythonRunScriptKeywordValue( diff --git a/lldb/unittests/Signals/UnixSignalsTest.cpp b/lldb/unittests/Signals/UnixSignalsTest.cpp index 5b07cf45d099b..6439e9e8ad700 100644 --- a/lldb/unittests/Signals/UnixSignalsTest.cpp +++ b/lldb/unittests/Signals/UnixSignalsTest.cpp @@ -128,31 +128,35 @@ TEST(UnixSignalsTest, VersionChange) { TEST(UnixSignalsTest, GetFilteredSignals) { TestSignals signals; - auto all_signals = signals.GetFilteredSignals(None, None, None); + auto all_signals = + signals.GetFilteredSignals(std::nullopt, std::nullopt, std::nullopt); std::vector<int32_t> expected = {2, 4, 8, 16}; EXPECT_EQ_ARRAYS(expected, all_signals); - auto supressed = signals.GetFilteredSignals(true, None, None); + auto supressed = signals.GetFilteredSignals(true, std::nullopt, std::nullopt); expected = {4, 8, 16}; EXPECT_EQ_ARRAYS(expected, supressed); - auto not_supressed = signals.GetFilteredSignals(false, None, None); + auto not_supressed = + signals.GetFilteredSignals(false, std::nullopt, std::nullopt); expected = {2}; EXPECT_EQ_ARRAYS(expected, not_supressed); - auto stopped = signals.GetFilteredSignals(None, true, None); + auto stopped = signals.GetFilteredSignals(std::nullopt, true, std::nullopt); expected = {2, 8}; EXPECT_EQ_ARRAYS(expected, stopped); - auto not_stopped = signals.GetFilteredSignals(None, false, None); + auto not_stopped = + signals.GetFilteredSignals(std::nullopt, false, std::nullopt); expected = {4, 16}; EXPECT_EQ_ARRAYS(expected, not_stopped); - auto notified = signals.GetFilteredSignals(None, None, true); + auto notified = signals.GetFilteredSignals(std::nullopt, std::nullopt, true); expected = {2, 4, 8}; EXPECT_EQ_ARRAYS(expected, notified); - auto not_notified = signals.GetFilteredSignals(None, None, false); + auto not_notified = + signals.GetFilteredSignals(std::nullopt, std::nullopt, false); expected = {16}; EXPECT_EQ_ARRAYS(expected, not_notified); diff --git a/lldb/unittests/Symbol/TestLineEntry.cpp b/lldb/unittests/Symbol/TestLineEntry.cpp index 8af3c5c2bd53e..144df6f6a683e 100644 --- a/lldb/unittests/Symbol/TestLineEntry.cpp +++ b/lldb/unittests/Symbol/TestLineEntry.cpp @@ -53,7 +53,7 @@ void LineEntryTest::SetUp() { // TODO: Handle SourceLocationSpec column information llvm::Expected<SymbolContextList> LineEntryTest::GetLineEntriesForLine( - uint32_t line, llvm::Optional<uint16_t> column = llvm::None) { + uint32_t line, llvm::Optional<uint16_t> column = std::nullopt) { SymbolContextList sc_comp_units; SymbolContextList sc_line_entries; FileSpec file_spec("inlined-functions.cpp"); diff --git a/lldb/unittests/Symbol/TestTypeSystemClang.cpp b/lldb/unittests/Symbol/TestTypeSystemClang.cpp index d0a33100f6182..4668ff6612917 100644 --- a/lldb/unittests/Symbol/TestTypeSystemClang.cpp +++ b/lldb/unittests/Symbol/TestTypeSystemClang.cpp @@ -517,8 +517,8 @@ TEST_F(TestTypeSystemClang, TemplateArguments) { EXPECT_EQ( m_ast->GetTypeTemplateArgument(t.GetOpaqueQualType(), 0, expand_pack), int_type); - EXPECT_EQ(llvm::None, m_ast->GetIntegralTemplateArgument( - t.GetOpaqueQualType(), 0, expand_pack)); + EXPECT_EQ(std::nullopt, m_ast->GetIntegralTemplateArgument( + t.GetOpaqueQualType(), 0, expand_pack)); EXPECT_EQ( m_ast->GetTemplateArgumentKind(t.GetOpaqueQualType(), 1, expand_pack), @@ -528,7 +528,7 @@ TEST_F(TestTypeSystemClang, TemplateArguments) { CompilerType()); auto result = m_ast->GetIntegralTemplateArgument(t.GetOpaqueQualType(), 1, expand_pack); - ASSERT_NE(llvm::None, result); + ASSERT_NE(std::nullopt, result); EXPECT_EQ(arg, result->value); EXPECT_EQ(int_type, result->type); } @@ -971,7 +971,7 @@ TEST(TestScratchTypeSystemClang, InferSubASTFromLangOpts) { TEST_F(TestTypeSystemClang, GetExeModuleWhenMissingSymbolFile) { CompilerType compiler_type = m_ast->GetBasicTypeFromAST(lldb::eBasicTypeInt); - lldb_private::Type t(0, nullptr, ConstString("MyType"), llvm::None, nullptr, + lldb_private::Type t(0, nullptr, ConstString("MyType"), std::nullopt, nullptr, 0, {}, {}, compiler_type, lldb_private::Type::ResolveState::Full); // Test that getting the execution module when no type system is present diff --git a/lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp b/lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp index 4878bbf56caad..4f7d57a5eec1f 100644 --- a/lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp +++ b/lldb/unittests/SymbolFile/DWARF/DWARFIndexCachingTest.cpp @@ -39,8 +39,8 @@ static void EncodeDecode(const DIERef &object) { TEST(DWARFIndexCachingTest, DIERefEncodeDecode) { // Tests DIERef::Encode(...) and DIERef::Decode(...) - EncodeDecode(DIERef(llvm::None, DIERef::Section::DebugInfo, 0x11223344)); - EncodeDecode(DIERef(llvm::None, DIERef::Section::DebugTypes, 0x11223344)); + EncodeDecode(DIERef(std::nullopt, DIERef::Section::DebugInfo, 0x11223344)); + EncodeDecode(DIERef(std::nullopt, DIERef::Section::DebugTypes, 0x11223344)); EncodeDecode(DIERef(100, DIERef::Section::DebugInfo, 0x11223344)); EncodeDecode(DIERef(200, DIERef::Section::DebugTypes, 0x11223344)); } @@ -80,7 +80,7 @@ TEST(DWARFIndexCachingTest, NameToDIEEncodeDecode) { // Make sure an empty NameToDIE map encodes and decodes correctly. EncodeDecode(map); map.Insert(ConstString("hello"), - DIERef(llvm::None, DIERef::Section::DebugInfo, 0x11223344)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, 0x11223344)); map.Insert(ConstString("workd"), DIERef(100, DIERef::Section::DebugInfo, 0x11223344)); map.Finalize(); @@ -117,84 +117,84 @@ TEST(DWARFIndexCachingTest, ManualDWARFIndexIndexSetEncodeDecode) { // be encoded and decoded correctly. set.function_basenames.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.function_basenames.Clear(); // Make sure an IndexSet with only items in IndexSet::function_fullnames can // be encoded and decoded correctly. set.function_fullnames.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.function_fullnames.Clear(); // Make sure an IndexSet with only items in IndexSet::function_methods can // be encoded and decoded correctly. set.function_methods.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.function_methods.Clear(); // Make sure an IndexSet with only items in IndexSet::function_selectors can // be encoded and decoded correctly. set.function_selectors.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.function_selectors.Clear(); // Make sure an IndexSet with only items in IndexSet::objc_class_selectors can // be encoded and decoded correctly. set.objc_class_selectors.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.objc_class_selectors.Clear(); // Make sure an IndexSet with only items in IndexSet::globals can // be encoded and decoded correctly. set.globals.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.globals.Clear(); // Make sure an IndexSet with only items in IndexSet::types can // be encoded and decoded correctly. set.types.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.types.Clear(); // Make sure an IndexSet with only items in IndexSet::namespaces can // be encoded and decoded correctly. set.namespaces.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); set.namespaces.Clear(); // Make sure that an IndexSet with item in all NameToDIE maps can be // be encoded and decoded correctly. set.function_basenames.Insert( ConstString("a"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); set.function_fullnames.Insert( ConstString("b"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); set.function_methods.Insert( ConstString("c"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); set.function_selectors.Insert( ConstString("d"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); set.objc_class_selectors.Insert( ConstString("e"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); set.globals.Insert( ConstString("f"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); set.types.Insert( ConstString("g"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); set.namespaces.Insert( ConstString("h"), - DIERef(llvm::None, DIERef::Section::DebugInfo, ++die_offset)); + DIERef(std::nullopt, DIERef::Section::DebugInfo, ++die_offset)); EncodeDecode(set); } @@ -240,7 +240,7 @@ TEST(DWARFIndexCachingTest, CacheSignatureTests) { sig.m_obj_mod_time = 0x456789ab; EXPECT_TRUE(sig.IsValid()); EncodeDecode(sig, /*encode_result=*/true); - sig.m_mod_time = llvm::None; + sig.m_mod_time = std::nullopt; EXPECT_TRUE(sig.IsValid()); EncodeDecode(sig, /*encode_result=*/true); diff --git a/lldb/unittests/Target/MemoryTagMapTest.cpp b/lldb/unittests/Target/MemoryTagMapTest.cpp index 831d4337a2896..a8ac43ee474de 100644 --- a/lldb/unittests/Target/MemoryTagMapTest.cpp +++ b/lldb/unittests/Target/MemoryTagMapTest.cpp @@ -47,10 +47,10 @@ TEST(MemoryTagMapTest, GetTags) { // Last granule of the range is not tagged EXPECT_THAT(tag_map.GetTags(0, 48), - ::testing::ContainerEq(TagsVec{0, 1, llvm::None})); + ::testing::ContainerEq(TagsVec{0, 1, std::nullopt})); EXPECT_THAT(tag_map.GetTags(16, 32), - ::testing::ContainerEq(TagsVec{1, llvm::None})); + ::testing::ContainerEq(TagsVec{1, std::nullopt})); // Reading beyond that address gives you no tags at all EXPECT_THAT(tag_map.GetTags(32, 16), ::testing::ContainerEq(TagsVec{})); @@ -65,7 +65,7 @@ TEST(MemoryTagMapTest, GetTags) { // Here the length pushes the range into the next granule. When aligned // this produces 2 granules. EXPECT_THAT(tag_map.GetTags(30, 4), - ::testing::ContainerEq(TagsVec{1, llvm::None})); + ::testing::ContainerEq(TagsVec{1, std::nullopt})); // A range can also have gaps at the beginning or in the middle. // Add more tags, 1 granule away from the first range. @@ -73,9 +73,9 @@ TEST(MemoryTagMapTest, GetTags) { // Untagged first granule EXPECT_THAT(tag_map.GetTags(32, 32), - ::testing::ContainerEq(TagsVec{llvm::None, 3})); + ::testing::ContainerEq(TagsVec{std::nullopt, 3})); // Untagged middle granule EXPECT_THAT(tag_map.GetTags(16, 48), - ::testing::ContainerEq(TagsVec{1, llvm::None, 3})); + ::testing::ContainerEq(TagsVec{1, std::nullopt, 3})); } diff --git a/lldb/unittests/Utility/FileSpecTest.cpp b/lldb/unittests/Utility/FileSpecTest.cpp index 5457c364c2f2c..76781246322cc 100644 --- a/lldb/unittests/Utility/FileSpecTest.cpp +++ b/lldb/unittests/Utility/FileSpecTest.cpp @@ -202,9 +202,9 @@ TEST(FileSpecTest, GuessPathStyle) { FileSpec::GuessPathStyle(R"(\\net\foo.txt)")); EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(Z:\)")); EXPECT_EQ(FileSpec::Style::windows, FileSpec::GuessPathStyle(R"(Z:/)")); - EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo.txt")); - EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("foo/bar.txt")); - EXPECT_EQ(llvm::None, FileSpec::GuessPathStyle("Z:")); + EXPECT_EQ(std::nullopt, FileSpec::GuessPathStyle("foo.txt")); + EXPECT_EQ(std::nullopt, FileSpec::GuessPathStyle("foo/bar.txt")); + EXPECT_EQ(std::nullopt, FileSpec::GuessPathStyle("Z:")); } TEST(FileSpecTest, GetPath) { diff --git a/lldb/unittests/Utility/ListenerTest.cpp b/lldb/unittests/Utility/ListenerTest.cpp index bf38955a8e76f..e586d99fd6305 100644 --- a/lldb/unittests/Utility/ListenerTest.cpp +++ b/lldb/unittests/Utility/ListenerTest.cpp @@ -98,16 +98,16 @@ TEST(ListenerTest, GetEventWait) { // broadcast sends. std::future<void> async_broadcast = std::async(std::launch::async, delayed_broadcast); - EXPECT_TRUE(listener_sp->GetEvent(event_sp, llvm::None)); + EXPECT_TRUE(listener_sp->GetEvent(event_sp, std::nullopt)); async_broadcast.get(); async_broadcast = std::async(std::launch::async, delayed_broadcast); - EXPECT_TRUE( - listener_sp->GetEventForBroadcaster(&broadcaster, event_sp, llvm::None)); + EXPECT_TRUE(listener_sp->GetEventForBroadcaster(&broadcaster, event_sp, + std::nullopt)); async_broadcast.get(); async_broadcast = std::async(std::launch::async, delayed_broadcast); EXPECT_TRUE(listener_sp->GetEventForBroadcasterWithType( - &broadcaster, event_mask, event_sp, llvm::None)); + &broadcaster, event_mask, event_sp, std::nullopt)); async_broadcast.get(); } diff --git a/lldb/unittests/Utility/PredicateTest.cpp b/lldb/unittests/Utility/PredicateTest.cpp index 8752e9361cae1..76d8f7677ea9d 100644 --- a/lldb/unittests/Utility/PredicateTest.cpp +++ b/lldb/unittests/Utility/PredicateTest.cpp @@ -28,6 +28,6 @@ TEST(Predicate, WaitForValueEqualTo) { TEST(Predicate, WaitForValueNotEqualTo) { Predicate<int> P(0); EXPECT_EQ(0, P.WaitForValueNotEqualTo(1)); - EXPECT_EQ(llvm::None, + EXPECT_EQ(std::nullopt, P.WaitForValueNotEqualTo(0, std::chrono::milliseconds(10))); } diff --git a/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp b/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp index 413969066bbe1..7fad6b995aaea 100644 --- a/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp +++ b/lldb/unittests/Utility/ProcessInstanceInfoTest.cpp @@ -19,13 +19,13 @@ class DummyUserIDResolver : public UserIDResolver { llvm::Optional<std::string> DoGetUserName(id_t uid) override { if (uid % 2) return ("user" + llvm::Twine(uid)).str(); - return llvm::None; + return std::nullopt; } llvm::Optional<std::string> DoGetGroupName(id_t gid) override { if (gid % 2) return ("group" + llvm::Twine(gid)).str(); - return llvm::None; + return std::nullopt; } }; } // namespace diff --git a/lldb/unittests/Utility/RegisterValueTest.cpp b/lldb/unittests/Utility/RegisterValueTest.cpp index 5dd39ca04a27f..9e22d3ab4c96f 100644 --- a/lldb/unittests/Utility/RegisterValueTest.cpp +++ b/lldb/unittests/Utility/RegisterValueTest.cpp @@ -28,7 +28,7 @@ TEST(RegisterValueTest, GetScalarValue) { Scalar S; if (V.GetScalarValue(S)) return S; - return llvm::None; + return std::nullopt; }; EXPECT_EQ(Get(RV(uint8_t(47))), Scalar(47)); EXPECT_EQ(Get(RV(uint16_t(4747))), Scalar(4747)); diff --git a/lldb/unittests/Utility/StringExtractorGDBRemoteTest.cpp b/lldb/unittests/Utility/StringExtractorGDBRemoteTest.cpp index 922167c342d90..016992bd58ced 100644 --- a/lldb/unittests/Utility/StringExtractorGDBRemoteTest.cpp +++ b/lldb/unittests/Utility/StringExtractorGDBRemoteTest.cpp @@ -7,104 +7,104 @@ TEST(StringExtractorGDBRemoteTest, GetPidTid) { StringExtractorGDBRemote ex(""); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); // invalid/short values ex.Reset("narf"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset(";1234"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset(".1234"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("pnarf"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p;1234"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p.1234"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p1234."); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p1234.;1234"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("-2"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p1234.-2"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p-2"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p-2.1234"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); // overflow ex.Reset("p10000000000000000"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p10000000000000000.0"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("10000000000000000"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p0.10000000000000000"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); ex.Reset("p10000000000000000.10000000000000000"); - EXPECT_EQ(ex.GetPidTid(0), llvm::None); + EXPECT_EQ(ex.GetPidTid(0), std::nullopt); // invalid: all processes but specific thread ex.Reset("p-1.0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p-1.1234"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p-1.123456789ABCDEF0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); // unsupported: pid/tid 0 ex.Reset("0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p0.0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p0.-1"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p0.1234"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p0.123456789ABCDEF0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p1234.0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); ex.Reset("p123456789ABCDEF0.0"); - EXPECT_EQ(ex.GetPidTid(100), llvm::None); + EXPECT_EQ(ex.GetPidTid(100), std::nullopt); // pure thread id diff --git a/lldb/unittests/Utility/TimeoutTest.cpp b/lldb/unittests/Utility/TimeoutTest.cpp index 222ee5db17742..028b8cb083154 100644 --- a/lldb/unittests/Utility/TimeoutTest.cpp +++ b/lldb/unittests/Utility/TimeoutTest.cpp @@ -14,7 +14,7 @@ using namespace lldb_private; using namespace std::chrono; TEST(TimeoutTest, Construction) { - EXPECT_FALSE(Timeout<std::micro>(llvm::None)); + EXPECT_FALSE(Timeout<std::micro>(std::nullopt)); EXPECT_TRUE(bool(Timeout<std::micro>(seconds(0)))); EXPECT_EQ(seconds(0), *Timeout<std::micro>(seconds(0))); EXPECT_EQ(seconds(3), *Timeout<std::micro>(seconds(3))); @@ -23,7 +23,7 @@ TEST(TimeoutTest, Construction) { TEST(TimeoutTest, Format) { EXPECT_EQ("<infinite>", - llvm::formatv("{0}", Timeout<std::milli>(llvm::None)).str()); + llvm::formatv("{0}", Timeout<std::milli>(std::nullopt)).str()); EXPECT_EQ("1000 ms", llvm::formatv("{0}", Timeout<std::milli>(seconds(1))).str()); } diff --git a/lldb/unittests/Utility/UriParserTest.cpp b/lldb/unittests/Utility/UriParserTest.cpp index 4ce89ab8e06ca..9923d3a9af936 100644 --- a/lldb/unittests/Utility/UriParserTest.cpp +++ b/lldb/unittests/Utility/UriParserTest.cpp @@ -4,7 +4,7 @@ using namespace lldb_private; TEST(UriParserTest, Minimal) { - EXPECT_EQ((URI{"x", "y", llvm::None, "/"}), URI::Parse("x://y")); + EXPECT_EQ((URI{"x", "y", std::nullopt, "/"}), URI::Parse("x://y")); } TEST(UriParserTest, MinimalPort) { @@ -12,7 +12,7 @@ TEST(UriParserTest, MinimalPort) { } TEST(UriParserTest, MinimalPath) { - EXPECT_EQ((URI{"x", "y", llvm::None, "/"}), URI::Parse("x://y/")); + EXPECT_EQ((URI{"x", "y", std::nullopt, "/"}), URI::Parse("x://y/")); } TEST(UriParserTest, MinimalPortPath) { @@ -20,7 +20,7 @@ TEST(UriParserTest, MinimalPortPath) { } TEST(UriParserTest, LongPath) { - EXPECT_EQ((URI{"x", "y", llvm::None, "/abc/def/xyz"}), + EXPECT_EQ((URI{"x", "y", std::nullopt, "/abc/def/xyz"}), URI::Parse("x://y/abc/def/xyz")); } @@ -41,20 +41,20 @@ TEST(UriParserTest, BracketedHostnamePort) { } TEST(UriParserTest, BracketedHostname) { - EXPECT_EQ((URI{"connect", "192.168.100.132", llvm::None, "/"}), + EXPECT_EQ((URI{"connect", "192.168.100.132", std::nullopt, "/"}), URI::Parse("connect://[192.168.100.132]")); } TEST(UriParserTest, BracketedHostnameWithPortIPv4) { // Android device over IPv4: port is a part of the hostname. - EXPECT_EQ((URI{"connect", "192.168.100.132:1234", llvm::None, "/"}), + EXPECT_EQ((URI{"connect", "192.168.100.132:1234", std::nullopt, "/"}), URI::Parse("connect://[192.168.100.132:1234]")); } TEST(UriParserTest, BracketedHostnameWithPortIPv6) { // Android device over IPv6: port is a part of the hostname. EXPECT_EQ((URI{"connect", "[2601:600:107f:db64:a42b:4faa:284]:1234", - llvm::None, "/"}), + std::nullopt, "/"}), URI::Parse("connect://[[2601:600:107f:db64:a42b:4faa:284]:1234]")); } @@ -64,31 +64,33 @@ TEST(UriParserTest, BracketedHostnameWithColon) { } TEST(UriParserTest, SchemeHostSeparator) { - EXPECT_EQ(llvm::None, URI::Parse("x:/y")); + EXPECT_EQ(std::nullopt, URI::Parse("x:/y")); } TEST(UriParserTest, SchemeHostSeparator2) { - EXPECT_EQ(llvm::None, URI::Parse("x:y")); + EXPECT_EQ(std::nullopt, URI::Parse("x:y")); } TEST(UriParserTest, SchemeHostSeparator3) { - EXPECT_EQ(llvm::None, URI::Parse("x//y")); + EXPECT_EQ(std::nullopt, URI::Parse("x//y")); } TEST(UriParserTest, SchemeHostSeparator4) { - EXPECT_EQ(llvm::None, URI::Parse("x/y")); + EXPECT_EQ(std::nullopt, URI::Parse("x/y")); } -TEST(UriParserTest, BadPort) { EXPECT_EQ(llvm::None, URI::Parse("x://y:a/")); } +TEST(UriParserTest, BadPort) { + EXPECT_EQ(std::nullopt, URI::Parse("x://y:a/")); +} TEST(UriParserTest, BadPort2) { - EXPECT_EQ(llvm::None, URI::Parse("x://y:5432a/")); + EXPECT_EQ(std::nullopt, URI::Parse("x://y:5432a/")); } -TEST(UriParserTest, Empty) { EXPECT_EQ(llvm::None, URI::Parse("")); } +TEST(UriParserTest, Empty) { EXPECT_EQ(std::nullopt, URI::Parse("")); } TEST(UriParserTest, PortOverflow) { - EXPECT_EQ(llvm::None, + EXPECT_EQ(std::nullopt, URI::Parse("x://" "y:" "0123456789012345678901234567890123456789012345678" diff --git a/lldb/unittests/Utility/UserIDResolverTest.cpp b/lldb/unittests/Utility/UserIDResolverTest.cpp index 7cd89609b358c..4866c078d1f05 100644 --- a/lldb/unittests/Utility/UserIDResolverTest.cpp +++ b/lldb/unittests/Utility/UserIDResolverTest.cpp @@ -24,24 +24,24 @@ TEST(UserIDResolver, GetUserName) { StrictMock<TestUserIDResolver> r; llvm::StringRef user47("foo"); EXPECT_CALL(r, DoGetUserName(47)).Times(1).WillOnce(Return(user47.str())); - EXPECT_CALL(r, DoGetUserName(42)).Times(1).WillOnce(Return(llvm::None)); + EXPECT_CALL(r, DoGetUserName(42)).Times(1).WillOnce(Return(std::nullopt)); // Call functions twice to make sure the caching works. EXPECT_EQ(user47, r.GetUserName(47)); EXPECT_EQ(user47, r.GetUserName(47)); - EXPECT_EQ(llvm::None, r.GetUserName(42)); - EXPECT_EQ(llvm::None, r.GetUserName(42)); + EXPECT_EQ(std::nullopt, r.GetUserName(42)); + EXPECT_EQ(std::nullopt, r.GetUserName(42)); } TEST(UserIDResolver, GetGroupName) { StrictMock<TestUserIDResolver> r; llvm::StringRef group47("foo"); EXPECT_CALL(r, DoGetGroupName(47)).Times(1).WillOnce(Return(group47.str())); - EXPECT_CALL(r, DoGetGroupName(42)).Times(1).WillOnce(Return(llvm::None)); + EXPECT_CALL(r, DoGetGroupName(42)).Times(1).WillOnce(Return(std::nullopt)); // Call functions twice to make sure the caching works. EXPECT_EQ(group47, r.GetGroupName(47)); EXPECT_EQ(group47, r.GetGroupName(47)); - EXPECT_EQ(llvm::None, r.GetGroupName(42)); - EXPECT_EQ(llvm::None, r.GetGroupName(42)); + EXPECT_EQ(std::nullopt, r.GetGroupName(42)); + EXPECT_EQ(std::nullopt, r.GetGroupName(42)); } diff --git a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp index f762fbc1c9c24..232f725baf58a 100644 --- a/lldb/unittests/tools/lldb-server/tests/TestClient.cpp +++ b/lldb/unittests/tools/lldb-server/tests/TestClient.cpp @@ -216,7 +216,7 @@ unsigned int TestClient::GetPcRegisterId() { } Error TestClient::qProcessInfo() { - m_process_info = None; + m_process_info = std::nullopt; auto InfoOr = SendMessage<ProcessInfo>("qProcessInfo"); if (!InfoOr) return InfoOr.takeError(); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits