uint32_t Symbol;
typename ELFT::uint Offset;
typename ELFT::uint Info;
- Optional<int64_t> Addend;
+ std::optional<int64_t> Addend;
};
template <class ELFT> class MipsGOTParser;
bool NonVisibilityBitsUsed) const {};
virtual void printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
DataRegion<Elf_Word> ShndxTable,
- Optional<StringRef> StrTable, bool IsDynamic,
+ std::optional<StringRef> StrTable, bool IsDynamic,
bool NonVisibilityBitsUsed) const = 0;
virtual void printMipsABIFlags() = 0;
// symbol's section with FunctionSec when specified.
// Returns std::nullopt if no function symbol can be found for the address or
// in case it is not defined in the specified section.
- SmallVector<uint32_t>
- getSymbolIndexesForFunctionAddress(uint64_t SymValue,
- Optional<const Elf_Shdr *> FunctionSec);
+ SmallVector<uint32_t> getSymbolIndexesForFunctionAddress(
+ uint64_t SymValue, std::optional<const Elf_Shdr *> FunctionSec);
bool printFunctionStackSize(uint64_t SymValue,
- Optional<const Elf_Shdr *> FunctionSec,
+ std::optional<const Elf_Shdr *> FunctionSec,
const Elf_Shdr &StackSizeSec, DataExtractor Data,
uint64_t *Offset);
void printStackSize(const Relocation<ELFT> &R, const Elf_Shdr &RelocSec,
DynRegionInfo DynRelaRegion;
DynRegionInfo DynRelrRegion;
DynRegionInfo DynPLTRelRegion;
- Optional<DynRegionInfo> DynSymRegion;
+ std::optional<DynRegionInfo> DynSymRegion;
DynRegionInfo DynSymTabShndxRegion;
DynRegionInfo DynamicTable;
StringRef DynamicStringTable;
std::string getFullSymbolName(const Elf_Sym &Symbol, unsigned SymIndex,
DataRegion<Elf_Word> ShndxTable,
- Optional<StringRef> StrTable,
+ std::optional<StringRef> StrTable,
bool IsDynamic) const;
Expected<unsigned>
getSymbolSectionIndex(const Elf_Sym &Symbol, unsigned SymIndex,
template <class ELFT>
void ELFDumper<ELFT>::printSymbolsHelper(bool IsDynamic) const {
- Optional<StringRef> StrTable;
+ std::optional<StringRef> StrTable;
size_t Entries = 0;
Elf_Sym_Range Syms(nullptr, nullptr);
const Elf_Shdr *SymtabSec = IsDynamic ? DotDynsymSec : DotSymtabSec;
const RelSymbol<ELFT> &RelSym) override;
void printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
DataRegion<Elf_Word> ShndxTable,
- Optional<StringRef> StrTable, bool IsDynamic,
+ std::optional<StringRef> StrTable, bool IsDynamic,
bool NonVisibilityBitsUsed) const override;
void printDynamicRelocHeader(unsigned Type, StringRef Name,
const DynRegionInfo &Reg) override;
DataRegion<Elf_Word> ShndxTable) const;
void printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
DataRegion<Elf_Word> ShndxTable,
- Optional<StringRef> StrTable, bool IsDynamic,
+ std::optional<StringRef> StrTable, bool IsDynamic,
bool /*NonVisibilityBitsUsed*/) const override;
void printProgramHeaders() override;
void printSectionMapping() override {}
}
template <typename ELFT>
-std::string ELFDumper<ELFT>::getFullSymbolName(const Elf_Sym &Symbol,
- unsigned SymIndex,
- DataRegion<Elf_Word> ShndxTable,
- Optional<StringRef> StrTable,
- bool IsDynamic) const {
+std::string ELFDumper<ELFT>::getFullSymbolName(
+ const Elf_Sym &Symbol, unsigned SymIndex, DataRegion<Elf_Word> ShndxTable,
+ std::optional<StringRef> StrTable, bool IsDynamic) const {
if (!StrTable)
return "<?>";
const char *StringTableBegin = nullptr;
uint64_t StringTableSize = 0;
- Optional<DynRegionInfo> DynSymFromTable;
+ std::optional<DynRegionInfo> DynSymFromTable;
for (const Elf_Dyn &Dyn : dynamic_table()) {
switch (Dyn.d_tag) {
case ELF::DT_HASH:
template <class ELFT>
static Expected<ArrayRef<typename ELFT::Word>>
-getGnuHashTableChains(Optional<DynRegionInfo> DynSymRegion,
+getGnuHashTableChains(std::optional<DynRegionInfo> DynSymRegion,
const typename ELFT::GnuHash *GnuHashTable) {
if (!DynSymRegion)
return createError("no dynamic symbol table found");
printField(F);
std::string Addend;
- if (Optional<int64_t> A = R.Addend) {
+ if (std::optional<int64_t> A = R.Addend) {
int64_t RelAddend = *A;
if (!RelSym.Name.empty()) {
if (RelAddend < 0) {
template <class ELFT>
void GNUELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
DataRegion<Elf_Word> ShndxTable,
- Optional<StringRef> StrTable,
+ std::optional<StringRef> StrTable,
bool IsDynamic,
bool NonVisibilityBitsUsed) const {
unsigned Bias = ELFT::Is64Bits ? 8 : 0;
};
template <typename ELFT>
-static Optional<FreeBSDNote>
+static std::optional<FreeBSDNote>
getFreeBSDNote(uint32_t NoteType, ArrayRef<uint8_t> Desc, bool IsCore) {
if (IsCore)
return std::nullopt; // No pretty-printing yet.
template <class ELFT>
static void printNotesHelper(
const ELFDumper<ELFT> &Dumper,
- llvm::function_ref<void(Optional<StringRef>, typename ELFT::Off,
+ llvm::function_ref<void(std::optional<StringRef>, typename ELFT::Off,
typename ELFT::Addr)>
StartNotesFn,
llvm::function_ref<Error(const typename ELFT::Note &, bool)> ProcessNoteFn,
for (const typename ELFT::Shdr &S : Sections) {
if (S.sh_type != SHT_NOTE)
continue;
- StartNotesFn(expectedToOptional(Obj.getSectionName(S)), S.sh_offset,
+ StartNotesFn(expectedToStdOptional(Obj.getSectionName(S)), S.sh_offset,
S.sh_size);
Error Err = Error::success();
size_t I = 0;
template <class ELFT> void GNUELFDumper<ELFT>::printNotes() {
bool IsFirstHeader = true;
- auto PrintHeader = [&](Optional<StringRef> SecName,
+ auto PrintHeader = [&](std::optional<StringRef> SecName,
const typename ELFT::Off Offset,
const typename ELFT::Addr Size) {
// Print a newline between notes sections to match GNU readelf.
if (printGNUNote<ELFT>(OS, Type, Descriptor))
return Error::success();
} else if (Name == "FreeBSD") {
- if (Optional<FreeBSDNote> N =
+ if (std::optional<FreeBSDNote> N =
getFreeBSDNote<ELFT>(Type, Descriptor, IsCore)) {
OS << " " << N->Type << ": " << N->Value << '\n';
return Error::success();
template <class ELFT>
SmallVector<uint32_t> ELFDumper<ELFT>::getSymbolIndexesForFunctionAddress(
- uint64_t SymValue, Optional<const Elf_Shdr *> FunctionSec) {
+ uint64_t SymValue, std::optional<const Elf_Shdr *> FunctionSec) {
SmallVector<uint32_t> SymbolIndexes;
if (!this->AddressToIndexMap) {
// Populate the address to index map upon the first invocation of this
template <class ELFT>
bool ELFDumper<ELFT>::printFunctionStackSize(
- uint64_t SymValue, Optional<const Elf_Shdr *> FunctionSec,
+ uint64_t SymValue, std::optional<const Elf_Shdr *> FunctionSec,
const Elf_Shdr &StackSizeSec, DataExtractor Data, uint64_t *Offset) {
SmallVector<uint32_t> FuncSymIndexes =
this->getSymbolIndexesForFunctionAddress(SymValue, FunctionSec);
void LLVMELFDumper<ELFT>::printSymbolSection(
const Elf_Sym &Symbol, unsigned SymIndex,
DataRegion<Elf_Word> ShndxTable) const {
- auto GetSectionSpecialType = [&]() -> Optional<StringRef> {
+ auto GetSectionSpecialType = [&]() -> std::optional<StringRef> {
if (Symbol.isUndefined())
return StringRef("Undefined");
if (Symbol.isProcessorSpecific())
return std::nullopt;
};
- if (Optional<StringRef> Type = GetSectionSpecialType()) {
+ if (std::optional<StringRef> Type = GetSectionSpecialType()) {
W.printHex("Section", *Type, Symbol.st_shndx);
return;
}
template <class ELFT>
void LLVMELFDumper<ELFT>::printSymbol(const Elf_Sym &Symbol, unsigned SymIndex,
DataRegion<Elf_Word> ShndxTable,
- Optional<StringRef> StrTable,
+ std::optional<StringRef> StrTable,
bool IsDynamic,
bool /*NonVisibilityBitsUsed*/) const {
std::string FullSymbolName = this->getFullSymbolName(
Sec.sh_type != SHT_LLVM_BB_ADDR_MAP_V0) {
continue;
}
- Optional<const Elf_Shdr *> FunctionSec;
+ std::optional<const Elf_Shdr *> FunctionSec;
if (IsRelocatable)
FunctionSec =
unwrapOrError(this->FileName, this->Obj.getSection(Sec.sh_link));
ListScope L(W, "Notes");
std::unique_ptr<DictScope> NoteScope;
- auto StartNotes = [&](Optional<StringRef> SecName,
+ auto StartNotes = [&](std::optional<StringRef> SecName,
const typename ELFT::Off Offset,
const typename ELFT::Addr Size) {
NoteScope = std::make_unique<DictScope>(W, "NoteSection");
if (printGNUNoteLLVMStyle<ELFT>(Type, Descriptor, W))
return Error::success();
} else if (Name == "FreeBSD") {
- if (Optional<FreeBSDNote> N =
+ if (std::optional<FreeBSDNote> N =
getFreeBSDNote<ELFT>(Type, Descriptor, IsCore)) {
W.printString(N->Type, N->Value);
return Error::success();