[llvm-objdump] Use std::optional in llvm-objdump.cpp (NFC)

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
This commit is contained in:
Kazu Hirata 2022-11-26 18:58:05 -08:00
parent a3bbbca8b6
commit 0428cf9ef1
1 changed files with 4 additions and 3 deletions

View File

@ -86,6 +86,7 @@
#include <algorithm>
#include <cctype>
#include <cstring>
#include <optional>
#include <system_error>
#include <unordered_map>
#include <utility>
@ -902,7 +903,7 @@ addMissingWasmCodeSymbols(const WasmObjectFile &Obj,
static void addPltEntries(const ObjectFile &Obj,
std::map<SectionRef, SectionSymbolsTy> &AllSymbols,
StringSaver &Saver) {
Optional<SectionRef> Plt;
std::optional<SectionRef> Plt;
for (const SectionRef &Section : Obj.sections()) {
Expected<StringRef> SecNameOrErr = Section.getName();
if (!SecNameOrErr) {
@ -2585,7 +2586,7 @@ static void printRawClangAST(const ObjectFile *Obj) {
ClangASTSectionName = "clangast";
}
Optional<object::SectionRef> ClangASTSection;
std::optional<object::SectionRef> ClangASTSection;
for (auto Sec : ToolSectionFilter(*Obj)) {
StringRef Name;
if (Expected<StringRef> NameOrErr = Sec.getName())
@ -2620,7 +2621,7 @@ static void printFaultMaps(const ObjectFile *Obj) {
return;
}
Optional<object::SectionRef> FaultMapSection;
std::optional<object::SectionRef> FaultMapSection;
for (auto Sec : ToolSectionFilter(*Obj)) {
StringRef Name;