diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-02 21:11:44 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-02 21:11:44 -0800 |
commit | aadaaface2ec96ee30d92bf46faa41dd9e68b64d (patch) | |
tree | e8da5e8b9e241f764c8fcd8d047b1a3b4f22ce3e /llvm/lib/Object/MachOObjectFile.cpp | |
parent | ed88e60b373383322c4b7465d43dc6c06092facb (diff) | |
download | llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.zip llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.gz llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.bz2 |
[llvm] 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
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index f3ca2e9..e6ff7cb 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -4889,12 +4889,12 @@ MachOObjectFile::getLinkOptHintsLoadCommand() const { ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const { if (!DyldInfoLoadCmd) - return None; + return std::nullopt; auto DyldInfoOrErr = getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); if (!DyldInfoOrErr) - return None; + return std::nullopt; MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); const uint8_t *Ptr = reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.rebase_off)); @@ -4903,12 +4903,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const { ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const { if (!DyldInfoLoadCmd) - return None; + return std::nullopt; auto DyldInfoOrErr = getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); if (!DyldInfoOrErr) - return None; + return std::nullopt; MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); const uint8_t *Ptr = reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.bind_off)); @@ -4917,12 +4917,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const { ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const { if (!DyldInfoLoadCmd) - return None; + return std::nullopt; auto DyldInfoOrErr = getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); if (!DyldInfoOrErr) - return None; + return std::nullopt; MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); const uint8_t *Ptr = reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.weak_bind_off)); @@ -4931,12 +4931,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const { ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const { if (!DyldInfoLoadCmd) - return None; + return std::nullopt; auto DyldInfoOrErr = getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); if (!DyldInfoOrErr) - return None; + return std::nullopt; MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); const uint8_t *Ptr = reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.lazy_bind_off)); @@ -4945,12 +4945,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const { ArrayRef<uint8_t> MachOObjectFile::getDyldInfoExportsTrie() const { if (!DyldInfoLoadCmd) - return None; + return std::nullopt; auto DyldInfoOrErr = getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd); if (!DyldInfoOrErr) - return None; + return std::nullopt; MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get(); const uint8_t *Ptr = reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.export_off)); @@ -4961,7 +4961,7 @@ Expected<Optional<MachO::linkedit_data_command>> MachOObjectFile::getChainedFixupsLoadCommand() const { // Load the dyld chained fixups load command. if (!DyldChainedFixupsLoadCmd) - return llvm::None; + return std::nullopt; auto DyldChainedFixupsOrErr = getStructOrErr<MachO::linkedit_data_command>( *this, DyldChainedFixupsLoadCmd); if (!DyldChainedFixupsOrErr) @@ -4972,7 +4972,7 @@ MachOObjectFile::getChainedFixupsLoadCommand() const { // If the load command is present but the data offset has been zeroed out, // as is the case for dylib stubs, return None (no error). if (!DyldChainedFixups.dataoff) - return llvm::None; + return std::nullopt; return DyldChainedFixups; } @@ -4982,7 +4982,7 @@ MachOObjectFile::getChainedFixupsHeader() const { if (!CFOrErr) return CFOrErr.takeError(); if (!CFOrErr->has_value()) - return llvm::None; + return std::nullopt; const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr; @@ -5236,12 +5236,12 @@ MachOObjectFile::getDyldChainedFixupTargets() const { ArrayRef<uint8_t> MachOObjectFile::getDyldExportsTrie() const { if (!DyldExportsTrieLoadCmd) - return None; + return std::nullopt; auto DyldExportsTrieOrError = getStructOrErr<MachO::linkedit_data_command>( *this, DyldExportsTrieLoadCmd); if (!DyldExportsTrieOrError) - return None; + return std::nullopt; MachO::linkedit_data_command DyldExportsTrie = DyldExportsTrieOrError.get(); const uint8_t *Ptr = reinterpret_cast<const uint8_t *>(getPtr(*this, DyldExportsTrie.dataoff)); @@ -5265,7 +5265,7 @@ SmallVector<uint64_t> MachOObjectFile::getFunctionStarts() const { ArrayRef<uint8_t> MachOObjectFile::getUuid() const { if (!UuidLoadCmd) - return None; + return std::nullopt; // Returning a pointer is fine as uuid doesn't need endian swapping. const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid); return makeArrayRef(reinterpret_cast<const uint8_t *>(Ptr), 16); |