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/ObjectYAML | |
| parent | ed88e60b373383322c4b7465d43dc6c06092facb (diff) | |
| download | llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.gz llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.tar.bz2 llvm-aadaaface2ec96ee30d92bf46faa41dd9e68b64d.zip | |
[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/ObjectYAML')
| -rw-r--r-- | llvm/lib/ObjectYAML/ELFEmitter.cpp | 10 | ||||
| -rw-r--r-- | llvm/lib/ObjectYAML/ELFYAML.cpp | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp index f5611ed1197b..88d430f89312 100644 --- a/llvm/lib/ObjectYAML/ELFEmitter.cpp +++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp @@ -775,7 +775,7 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders, if (!S->Offset) S->Offset = alignToOffset(CBA, sizeof(typename ELFT::uint), - /*Offset=*/None); + /*Offset=*/std::nullopt); else S->Offset = alignToOffset(CBA, /*Align=*/1, S->Offset); @@ -1015,8 +1015,8 @@ void ELFState<ELFT>::initSymtabSectionHeader(Elf_Shdr &SHeader, assignSectionAddress(SHeader, YAMLSec); - SHeader.sh_offset = - alignToOffset(CBA, SHeader.sh_addralign, RawSec ? RawSec->Offset : None); + SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign, + RawSec ? RawSec->Offset : std::nullopt); if (RawSec && (RawSec->Content || RawSec->Size)) { assert(Symbols.empty()); @@ -1043,7 +1043,7 @@ void ELFState<ELFT>::initStrtabSectionHeader(Elf_Shdr &SHeader, StringRef Name, dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign, - YAMLSec ? YAMLSec->Offset : None); + YAMLSec ? YAMLSec->Offset : std::nullopt); if (RawSec && (RawSec->Content || RawSec->Size)) { SHeader.sh_size = writeContent(CBA, RawSec->Content, RawSec->Size); @@ -1097,7 +1097,7 @@ void ELFState<ELFT>::initDWARFSectionHeader(Elf_Shdr &SHeader, StringRef Name, SHeader.sh_type = YAMLSec ? YAMLSec->Type : ELF::SHT_PROGBITS; SHeader.sh_addralign = YAMLSec ? (uint64_t)YAMLSec->AddressAlign : 1; SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign, - YAMLSec ? YAMLSec->Offset : None); + YAMLSec ? YAMLSec->Offset : std::nullopt); ELFYAML::RawContentSection *RawSec = dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec); diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp index b94377a4e24a..504a6837a1a1 100644 --- a/llvm/lib/ObjectYAML/ELFYAML.cpp +++ b/llvm/lib/ObjectYAML/ELFYAML.cpp @@ -1202,7 +1202,7 @@ struct NormalizedOther { Optional<uint8_t> denormalize(IO &) { if (!Other) - return None; + return std::nullopt; uint8_t Ret = 0; for (StOtherPiece &Val : *Other) Ret |= toValue(Val); |
