From b6a01caa64aaac2e5db8d7953a81cbe1a139b81f Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 2 Dec 2022 22:10:37 -0800 Subject: [llvm/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 --- llvm/unittests/Object/ELFObjectFileTest.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'llvm/unittests/Object/ELFObjectFileTest.cpp') diff --git a/llvm/unittests/Object/ELFObjectFileTest.cpp b/llvm/unittests/Object/ELFObjectFileTest.cpp index 877a140..2c8585bf 100644 --- a/llvm/unittests/Object/ELFObjectFileTest.cpp +++ b/llvm/unittests/Object/ELFObjectFileTest.cpp @@ -703,7 +703,8 @@ Sections: }; // Check that we can retrieve the data in the normal case. - DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/None, AllBBAddrMaps); + DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/std::nullopt, + AllBBAddrMaps); DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/0, Section0BBAddrMaps); DoCheckSucceeds(CommonYamlString, /*TextSectionIndex=*/1, Section1BBAddrMaps); // Check that when no bb-address-map section is found for a text section, @@ -723,7 +724,7 @@ Sections: "index: 10"); // Linked sections are not checked when we don't target a specific text // section. - DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/None, + DoCheckSucceeds(InvalidLinkedYamlString, /*TextSectionIndex=*/std::nullopt, AllBBAddrMaps); // Check that we can detect when bb-address-map decoding fails. @@ -732,7 +733,7 @@ Sections: ShSize: 0x8 )"; - DoCheckFails(TruncatedYamlString, /*TextSectionIndex=*/None, + DoCheckFails(TruncatedYamlString, /*TextSectionIndex=*/std::nullopt, "unable to read SHT_LLVM_BB_ADDR_MAP_V0 section with index 3: " "unable to decode LEB128 at offset 0x00000008: malformed " "uleb128, extends past end"); -- cgit v1.1