mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 14:16:08 +00:00
[MC] llvm::Optional => std::optional
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
parent
12f6ac39bc
commit
f4c16c4473
@ -283,7 +283,7 @@ public:
|
||||
|
||||
Expected<unsigned> getDwarfFile(StringRef Directory, StringRef FileName,
|
||||
unsigned FileNumber,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID, unsigned DWARFVersion);
|
||||
|
||||
|
@ -1130,10 +1130,10 @@ public:
|
||||
|
||||
/// Emit the Dwarf file and the line tables for a given CU.
|
||||
void emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
Optional<MCDwarfLineStr> &LineStr, BinaryContext &BC) const;
|
||||
std::optional<MCDwarfLineStr> &LineStr, BinaryContext &BC) const;
|
||||
|
||||
Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
uint16_t DwarfVersion,
|
||||
unsigned FileNumber = 0) {
|
||||
@ -1150,7 +1150,7 @@ public:
|
||||
/// Sets the root file \p Directory, \p FileName, optional \p CheckSum, and
|
||||
/// optional \p Source.
|
||||
void setRootFile(StringRef Directory, StringRef FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source) {
|
||||
Header.setRootFile(Directory, FileName, Checksum, Source);
|
||||
}
|
||||
|
@ -21,6 +21,17 @@
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
||||
template <typename T, typename = decltype(std::declval<raw_ostream &>()
|
||||
<< std::declval<const T &>())>
|
||||
raw_ostream &operator<<(raw_ostream &OS, const std::optional<T> &O) {
|
||||
if (O)
|
||||
OS << *O;
|
||||
else
|
||||
OS << std::nullopt;
|
||||
return OS;
|
||||
}
|
||||
|
||||
namespace bolt {
|
||||
|
||||
// NOTE: using SmallVector for instruction list results in a memory regression.
|
||||
|
@ -1461,7 +1461,7 @@ void BinaryContext::printGlobalSymbols(raw_ostream &OS) const {
|
||||
|
||||
Expected<unsigned> BinaryContext::getDwarfFile(
|
||||
StringRef Directory, StringRef FileName, unsigned FileNumber,
|
||||
Optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
std::optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
unsigned CUID, unsigned DWARFVersion) {
|
||||
DwarfLineTable &Table = DwarfLineTablesCUMap[CUID];
|
||||
return Table.tryGetFile(Directory, FileName, Checksum, Source, DWARFVersion,
|
||||
@ -1645,7 +1645,7 @@ void BinaryContext::preprocessDebugInfo() {
|
||||
|
||||
uint16_t DwarfVersion = LineTable->Prologue.getVersion();
|
||||
if (DwarfVersion >= 5) {
|
||||
Optional<MD5::MD5Result> Checksum;
|
||||
std::optional<MD5::MD5Result> Checksum;
|
||||
if (LineTable->Prologue.ContentTypes.HasMD5)
|
||||
Checksum = LineTable->Prologue.FileNames[0].Checksum;
|
||||
Optional<const char *> Name =
|
||||
@ -1683,7 +1683,7 @@ void BinaryContext::preprocessDebugInfo() {
|
||||
if (Optional<const char *> FName = dwarf::toString(FileNames[I].Name))
|
||||
FileName = *FName;
|
||||
assert(FileName != "");
|
||||
Optional<MD5::MD5Result> Checksum;
|
||||
std::optional<MD5::MD5Result> Checksum;
|
||||
if (DwarfVersion >= 5 && LineTable->Prologue.ContentTypes.HasMD5)
|
||||
Checksum = LineTable->Prologue.FileNames[I].Checksum;
|
||||
cantFail(getDwarfFile(Dir, FileName, 0, Checksum, std::nullopt, CUID,
|
||||
|
@ -1513,7 +1513,7 @@ static inline void emitDwarfLineTable(
|
||||
}
|
||||
|
||||
void DwarfLineTable::emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
Optional<MCDwarfLineStr> &LineStr,
|
||||
std::optional<MCDwarfLineStr> &LineStr,
|
||||
BinaryContext &BC) const {
|
||||
if (!RawData.empty()) {
|
||||
assert(MCLineSections.getMCLineEntries().empty() &&
|
||||
@ -1585,7 +1585,7 @@ void DwarfLineTable::emit(BinaryContext &BC, MCStreamer &Streamer) {
|
||||
if (LineTables.empty())
|
||||
return;
|
||||
// In a v5 non-split line table, put the strings in a separate section.
|
||||
Optional<MCDwarfLineStr> LineStr(std::nullopt);
|
||||
std::optional<MCDwarfLineStr> LineStr;
|
||||
ErrorOr<BinarySection &> LineStrSection =
|
||||
BC.getUniqueSectionByName(".debug_line_str");
|
||||
// Some versions of GCC output DWARF5 .debug_info, but DWARF4 or lower
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
virtual unsigned getNumFixupKinds() const = 0;
|
||||
|
||||
/// Map a relocation name used in .reloc to a fixup kind.
|
||||
virtual Optional<MCFixupKind> getFixupKind(StringRef Name) const;
|
||||
virtual std::optional<MCFixupKind> getFixupKind(StringRef Name) const;
|
||||
|
||||
/// Get information on a fixup kind.
|
||||
virtual const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const;
|
||||
|
@ -616,9 +616,9 @@ public:
|
||||
|
||||
/// Return the unique ID of the section with the given name, flags and entry
|
||||
/// size, if it exists.
|
||||
Optional<unsigned> getELFUniqueIDForEntsize(StringRef SectionName,
|
||||
unsigned Flags,
|
||||
unsigned EntrySize);
|
||||
std::optional<unsigned> getELFUniqueIDForEntsize(StringRef SectionName,
|
||||
unsigned Flags,
|
||||
unsigned EntrySize);
|
||||
|
||||
MCSectionGOFF *getGOFFSection(StringRef Section, SectionKind Kind,
|
||||
MCSection *Parent, const MCExpr *SubsectionId);
|
||||
@ -673,13 +673,12 @@ public:
|
||||
bool hasXCOFFSection(StringRef Section,
|
||||
XCOFF::CsectProperties CsectProp) const;
|
||||
|
||||
MCSectionXCOFF *
|
||||
getXCOFFSection(StringRef Section, SectionKind K,
|
||||
Optional<XCOFF::CsectProperties> CsectProp = std::nullopt,
|
||||
bool MultiSymbolsAllowed = false,
|
||||
const char *BeginSymName = nullptr,
|
||||
Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags =
|
||||
std::nullopt);
|
||||
MCSectionXCOFF *getXCOFFSection(
|
||||
StringRef Section, SectionKind K,
|
||||
std::optional<XCOFF::CsectProperties> CsectProp = std::nullopt,
|
||||
bool MultiSymbolsAllowed = false, const char *BeginSymName = nullptr,
|
||||
std::optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags =
|
||||
std::nullopt);
|
||||
|
||||
// Create and save a copy of STI and return a reference to the copy.
|
||||
MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);
|
||||
@ -717,10 +716,11 @@ public:
|
||||
void setMainFileName(StringRef S) { MainFileName = std::string(S); }
|
||||
|
||||
/// Creates an entry in the dwarf file and directory tables.
|
||||
Expected<unsigned> getDwarfFile(
|
||||
StringRef Directory, StringRef FileName, unsigned FileNumber,
|
||||
Optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
unsigned CUID);
|
||||
Expected<unsigned> getDwarfFile(StringRef Directory, StringRef FileName,
|
||||
unsigned FileNumber,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID);
|
||||
|
||||
bool isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID = 0);
|
||||
|
||||
@ -754,7 +754,7 @@ public:
|
||||
/// These are "file 0" and "directory 0" in DWARF v5.
|
||||
void setMCLineTableRootFile(unsigned CUID, StringRef CompilationDir,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source) {
|
||||
getMCDwarfLineTable(CUID).setRootFile(CompilationDir, Filename, Checksum,
|
||||
Source);
|
||||
|
@ -20,11 +20,11 @@
|
||||
namespace llvm {
|
||||
|
||||
struct XCOFFSymbolInfo {
|
||||
Optional<XCOFF::StorageMappingClass> StorageMappingClass;
|
||||
Optional<uint32_t> Index;
|
||||
std::optional<XCOFF::StorageMappingClass> StorageMappingClass;
|
||||
std::optional<uint32_t> Index;
|
||||
bool IsLabel;
|
||||
XCOFFSymbolInfo(Optional<XCOFF::StorageMappingClass> Smc,
|
||||
Optional<uint32_t> Idx, bool Label)
|
||||
XCOFFSymbolInfo(std::optional<XCOFF::StorageMappingClass> Smc,
|
||||
std::optional<uint32_t> Idx, bool Label)
|
||||
: StorageMappingClass(Smc), Index(Idx), IsLabel(Label) {}
|
||||
|
||||
bool operator<(const XCOFFSymbolInfo &SymInfo) const;
|
||||
@ -44,8 +44,8 @@ private:
|
||||
|
||||
public:
|
||||
SymbolInfoTy(uint64_t Addr, StringRef Name,
|
||||
Optional<XCOFF::StorageMappingClass> Smc, Optional<uint32_t> Idx,
|
||||
bool Label)
|
||||
std::optional<XCOFF::StorageMappingClass> Smc,
|
||||
std::optional<uint32_t> Idx, bool Label)
|
||||
: Addr(Addr), Name(Name), XCOFFSymInfo(Smc, Idx, Label), IsXCOFF(true),
|
||||
HasType(false) {}
|
||||
SymbolInfoTy(uint64_t Addr, StringRef Name, uint8_t Type,
|
||||
@ -159,7 +159,7 @@ public:
|
||||
/// done by buffering the output if needed.
|
||||
/// - None if the target doesn't want to handle the symbol
|
||||
/// separately. Value of Size is ignored in this case.
|
||||
virtual Optional<DecodeStatus>
|
||||
virtual std::optional<DecodeStatus>
|
||||
onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, ArrayRef<uint8_t> Bytes,
|
||||
uint64_t Address, raw_ostream &CStream) const;
|
||||
// TODO:
|
||||
|
@ -90,7 +90,7 @@ struct MCDwarfFile {
|
||||
|
||||
/// The MD5 checksum, if there is one. Non-owning pointer to data allocated
|
||||
/// in MCContext.
|
||||
Optional<MD5::MD5Result> Checksum;
|
||||
std::optional<MD5::MD5Result> Checksum;
|
||||
|
||||
/// The source code of the file. Non-owning reference to data allocated in
|
||||
/// MCContext.
|
||||
@ -271,17 +271,16 @@ public:
|
||||
MCDwarfLineTableHeader() = default;
|
||||
|
||||
Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
uint16_t DwarfVersion,
|
||||
unsigned FileNumber = 0);
|
||||
uint16_t DwarfVersion, unsigned FileNumber = 0);
|
||||
std::pair<MCSymbol *, MCSymbol *>
|
||||
Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
Optional<MCDwarfLineStr> &LineStr) const;
|
||||
std::optional<MCDwarfLineStr> &LineStr) const;
|
||||
std::pair<MCSymbol *, MCSymbol *>
|
||||
Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
ArrayRef<char> SpecialOpcodeLengths,
|
||||
Optional<MCDwarfLineStr> &LineStr) const;
|
||||
std::optional<MCDwarfLineStr> &LineStr) const;
|
||||
void resetMD5Usage() {
|
||||
HasAllMD5 = true;
|
||||
HasAnyMD5 = false;
|
||||
@ -295,7 +294,7 @@ public:
|
||||
}
|
||||
|
||||
void setRootFile(StringRef Directory, StringRef FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source) {
|
||||
CompilationDir = std::string(Directory);
|
||||
RootFile.Name = std::string(FileName);
|
||||
@ -316,7 +315,8 @@ public:
|
||||
|
||||
private:
|
||||
void emitV2FileDirTables(MCStreamer *MCOS) const;
|
||||
void emitV5FileDirTables(MCStreamer *MCOS, Optional<MCDwarfLineStr> &LineStr) const;
|
||||
void emitV5FileDirTables(MCStreamer *MCOS,
|
||||
std::optional<MCDwarfLineStr> &LineStr) const;
|
||||
};
|
||||
|
||||
class MCDwarfDwoLineTable {
|
||||
@ -325,7 +325,7 @@ class MCDwarfDwoLineTable {
|
||||
|
||||
public:
|
||||
void maybeSetRootFile(StringRef Directory, StringRef FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source) {
|
||||
if (!Header.RootFile.Name.empty())
|
||||
return;
|
||||
@ -333,8 +333,8 @@ public:
|
||||
}
|
||||
|
||||
unsigned getFile(StringRef Directory, StringRef FileName,
|
||||
Optional<MD5::MD5Result> Checksum, uint16_t DwarfVersion,
|
||||
std::optional<StringRef> Source) {
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
uint16_t DwarfVersion, std::optional<StringRef> Source) {
|
||||
HasSplitLineTable = true;
|
||||
return cantFail(Header.tryGetFile(Directory, FileName, Checksum, Source,
|
||||
DwarfVersion));
|
||||
@ -354,7 +354,7 @@ public:
|
||||
|
||||
// This emits the Dwarf file and the line tables for a given Compile Unit.
|
||||
void emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
Optional<MCDwarfLineStr> &LineStr) const;
|
||||
std::optional<MCDwarfLineStr> &LineStr) const;
|
||||
|
||||
// This emits a single line table associated with a given Section.
|
||||
static void
|
||||
@ -362,12 +362,11 @@ public:
|
||||
const MCLineSection::MCDwarfLineEntryCollection &LineEntries);
|
||||
|
||||
Expected<unsigned> tryGetFile(StringRef &Directory, StringRef &FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
uint16_t DwarfVersion,
|
||||
unsigned FileNumber = 0);
|
||||
uint16_t DwarfVersion, unsigned FileNumber = 0);
|
||||
unsigned getFile(StringRef &Directory, StringRef &FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source, uint16_t DwarfVersion,
|
||||
unsigned FileNumber = 0) {
|
||||
return cantFail(tryGetFile(Directory, FileName, Checksum, Source,
|
||||
@ -375,7 +374,7 @@ public:
|
||||
}
|
||||
|
||||
void setRootFile(StringRef Directory, StringRef FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source) {
|
||||
Header.CompilationDir = std::string(Directory);
|
||||
Header.RootFile.Name = std::string(FileName);
|
||||
|
@ -157,13 +157,13 @@ public:
|
||||
|
||||
/// Given an instruction tries to get the address of a memory operand. Returns
|
||||
/// the address on success.
|
||||
virtual Optional<uint64_t>
|
||||
virtual std::optional<uint64_t>
|
||||
evaluateMemoryOperandAddress(const MCInst &Inst, const MCSubtargetInfo *STI,
|
||||
uint64_t Addr, uint64_t Size) const;
|
||||
|
||||
/// Given an instruction with a memory operand that could require relocation,
|
||||
/// returns the offset within the instruction of that relocation.
|
||||
virtual Optional<uint64_t>
|
||||
virtual std::optional<uint64_t>
|
||||
getMemoryOperandRelocationOffset(const MCInst &Inst, uint64_t Size) const;
|
||||
|
||||
/// Returns (PLT virtual address, GOT virtual address) pairs for PLT entries.
|
||||
|
@ -13,13 +13,13 @@
|
||||
#ifndef LLVM_MC_MCOBJECTFILEINFO_H
|
||||
#define LLVM_MC_MCOBJECTFILEINFO_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/BinaryFormat/Swift.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/Support/VersionTuple.h"
|
||||
|
||||
#include <array>
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
class MCContext;
|
||||
@ -451,7 +451,7 @@ private:
|
||||
bool PositionIndependent = false;
|
||||
MCContext *Ctx = nullptr;
|
||||
VersionTuple SDKVersion;
|
||||
Optional<Triple> DarwinTargetVariantTriple;
|
||||
std::optional<Triple> DarwinTargetVariantTriple;
|
||||
VersionTuple DarwinTargetVariantSDKVersion;
|
||||
|
||||
void initMachOMCObjectFileInfo(const Triple &T);
|
||||
|
@ -191,7 +191,7 @@ public:
|
||||
void emitTPRel64Value(const MCExpr *Value) override;
|
||||
void emitGPRel32Value(const MCExpr *Value) override;
|
||||
void emitGPRel64Value(const MCExpr *Value) override;
|
||||
Optional<std::pair<bool, std::string>>
|
||||
std::optional<std::pair<bool, std::string>>
|
||||
emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr,
|
||||
SMLoc Loc, const MCSubtargetInfo &STI) override;
|
||||
using MCStreamer::emitFill;
|
||||
|
@ -514,7 +514,7 @@ public:
|
||||
|
||||
/// Map a dwarf register back to a target register. Returns None is there is
|
||||
/// no mapping.
|
||||
Optional<unsigned> getLLVMRegNum(unsigned RegNum, bool isEH) const;
|
||||
std::optional<unsigned> getLLVMRegNum(unsigned RegNum, bool isEH) const;
|
||||
|
||||
/// Map a target EH register number to an equivalent DWARF register
|
||||
/// number.
|
||||
|
@ -32,10 +32,10 @@ namespace llvm {
|
||||
class MCSectionXCOFF final : public MCSection {
|
||||
friend class MCContext;
|
||||
|
||||
Optional<XCOFF::CsectProperties> CsectProp;
|
||||
std::optional<XCOFF::CsectProperties> CsectProp;
|
||||
MCSymbolXCOFF *const QualName;
|
||||
StringRef SymbolTableName;
|
||||
Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags;
|
||||
std::optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags;
|
||||
bool MultiSymbolsAllowed;
|
||||
static constexpr unsigned DefaultAlignVal = 4;
|
||||
static constexpr unsigned DefaultTextAlignVal = 32;
|
||||
@ -118,10 +118,12 @@ public:
|
||||
bool isMultiSymbolsAllowed() const { return MultiSymbolsAllowed; }
|
||||
bool isCsect() const { return CsectProp.has_value(); }
|
||||
bool isDwarfSect() const { return DwarfSubtypeFlags.has_value(); }
|
||||
Optional<XCOFF::DwarfSectionSubtypeFlags> getDwarfSubtypeFlags() const {
|
||||
std::optional<XCOFF::DwarfSectionSubtypeFlags> getDwarfSubtypeFlags() const {
|
||||
return DwarfSubtypeFlags;
|
||||
}
|
||||
Optional<XCOFF::CsectProperties> getCsectProp() const { return CsectProp; }
|
||||
std::optional<XCOFF::CsectProperties> getCsectProp() const {
|
||||
return CsectProp;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -908,7 +908,7 @@ public:
|
||||
/// implements the DWARF2 '.file 4 "foo.c"' assembler directive.
|
||||
unsigned emitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
std::optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
std::optional<StringRef> Source = std::nullopt, unsigned CUID = 0) {
|
||||
return cantFail(
|
||||
tryEmitDwarfFileDirective(FileNo, Directory, Filename, Checksum,
|
||||
@ -922,12 +922,12 @@ public:
|
||||
/// '.file 4 "dir/foo.c" md5 "..." source "..."' assembler directive.
|
||||
virtual Expected<unsigned> tryEmitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
std::optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
std::optional<StringRef> Source = std::nullopt, unsigned CUID = 0);
|
||||
|
||||
/// Specify the "root" file of the compilation, using the ".file 0" extension.
|
||||
virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID = 0);
|
||||
|
||||
@ -1086,7 +1086,7 @@ public:
|
||||
|
||||
/// Record a relocation described by the .reloc directive. Return None if
|
||||
/// succeeded. Otherwise, return a pair (Name is invalid, error message).
|
||||
virtual Optional<std::pair<bool, std::string>>
|
||||
virtual std::optional<std::pair<bool, std::string>>
|
||||
emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr,
|
||||
SMLoc Loc, const MCSubtargetInfo &STI) {
|
||||
return std::nullopt;
|
||||
|
@ -247,7 +247,7 @@ public:
|
||||
|
||||
/// Return the target cache line size in bytes at a given level.
|
||||
///
|
||||
virtual Optional<unsigned> getCacheLineSize(unsigned Level) const;
|
||||
virtual std::optional<unsigned> getCacheLineSize(unsigned Level) const;
|
||||
|
||||
/// Return the target cache line size in bytes. By default, return
|
||||
/// the line size for the bottom-most level of cache. This provides
|
||||
@ -256,7 +256,7 @@ public:
|
||||
/// cache model.
|
||||
///
|
||||
virtual unsigned getCacheLineSize() const {
|
||||
Optional<unsigned> Size = getCacheLineSize(0);
|
||||
std::optional<unsigned> Size = getCacheLineSize(0);
|
||||
if (Size)
|
||||
return *Size;
|
||||
|
||||
|
@ -14,19 +14,19 @@
|
||||
namespace llvm {
|
||||
|
||||
class MCSymbolWasm : public MCSymbol {
|
||||
Optional<wasm::WasmSymbolType> Type;
|
||||
std::optional<wasm::WasmSymbolType> Type;
|
||||
bool IsWeak = false;
|
||||
bool IsHidden = false;
|
||||
bool IsComdat = false;
|
||||
bool OmitFromLinkingSection = false;
|
||||
mutable bool IsUsedInInitArray = false;
|
||||
mutable bool IsUsedInGOT = false;
|
||||
Optional<StringRef> ImportModule;
|
||||
Optional<StringRef> ImportName;
|
||||
Optional<StringRef> ExportName;
|
||||
std::optional<StringRef> ImportModule;
|
||||
std::optional<StringRef> ImportName;
|
||||
std::optional<StringRef> ExportName;
|
||||
wasm::WasmSignature *Signature = nullptr;
|
||||
Optional<wasm::WasmGlobalType> GlobalType;
|
||||
Optional<wasm::WasmTableType> TableType;
|
||||
std::optional<wasm::WasmGlobalType> GlobalType;
|
||||
std::optional<wasm::WasmTableType> TableType;
|
||||
|
||||
/// An expression describing how to calculate the size of a symbol. If a
|
||||
/// symbol has no size this field will be NULL.
|
||||
@ -48,7 +48,7 @@ public:
|
||||
bool isSection() const { return Type == wasm::WASM_SYMBOL_TYPE_SECTION; }
|
||||
bool isTag() const { return Type == wasm::WASM_SYMBOL_TYPE_TAG; }
|
||||
|
||||
Optional<wasm::WasmSymbolType> getType() const { return Type; }
|
||||
std::optional<wasm::WasmSymbolType> getType() const { return Type; }
|
||||
|
||||
void setType(wasm::WasmSymbolType type) { Type = type; }
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Optional<XCOFF::StorageClass> StorageClass;
|
||||
std::optional<XCOFF::StorageClass> StorageClass;
|
||||
MCSectionXCOFF *RepresentedCsect = nullptr;
|
||||
XCOFF::VisibilityType VisibilityType = XCOFF::SYM_V_UNSPECIFIED;
|
||||
StringRef SymbolTableName;
|
||||
|
@ -25,7 +25,7 @@ enum class EmitDwarfUnwindType;
|
||||
namespace mc {
|
||||
|
||||
bool getRelaxAll();
|
||||
Optional<bool> getExplicitRelaxAll();
|
||||
std::optional<bool> getExplicitRelaxAll();
|
||||
|
||||
bool getIncrementalLinkerCompatible();
|
||||
|
||||
|
@ -3530,7 +3530,8 @@ void DwarfDebug::insertSectionLabel(const MCSymbol *S) {
|
||||
AddrPool.getIndex(S);
|
||||
}
|
||||
|
||||
Optional<MD5::MD5Result> DwarfDebug::getMD5AsBytes(const DIFile *File) const {
|
||||
std::optional<MD5::MD5Result>
|
||||
DwarfDebug::getMD5AsBytes(const DIFile *File) const {
|
||||
assert(File);
|
||||
if (getDwarfVersion() < 5)
|
||||
return std::nullopt;
|
||||
|
@ -839,7 +839,7 @@ public:
|
||||
|
||||
/// If the \p File has an MD5 checksum, return it as an MD5Result
|
||||
/// allocated in the MCContext.
|
||||
Optional<MD5::MD5Result> getMD5AsBytes(const DIFile *File) const;
|
||||
std::optional<MD5::MD5Result> getMD5AsBytes(const DIFile *File) const;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
@ -458,7 +458,7 @@ static void printCFIRegister(unsigned DwarfReg, raw_ostream &OS,
|
||||
return;
|
||||
}
|
||||
|
||||
if (Optional<unsigned> Reg = TRI->getLLVMRegNum(DwarfReg, true))
|
||||
if (std::optional<unsigned> Reg = TRI->getLLVMRegNum(DwarfReg, true))
|
||||
OS << printReg(*Reg, TRI);
|
||||
else
|
||||
OS << "<badreg>";
|
||||
|
@ -33,7 +33,7 @@ using namespace dwarf;
|
||||
static void printRegister(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH,
|
||||
unsigned RegNum) {
|
||||
if (MRI) {
|
||||
if (Optional<unsigned> LLVMRegNum = MRI->getLLVMRegNum(RegNum, IsEH)) {
|
||||
if (std::optional<unsigned> LLVMRegNum = MRI->getLLVMRegNum(RegNum, IsEH)) {
|
||||
if (const char *RegName = MRI->getName(*LLVMRegNum)) {
|
||||
OS << RegName;
|
||||
return;
|
||||
|
@ -242,7 +242,8 @@ bool DWARFExpression::prettyPrintRegisterOp(
|
||||
else
|
||||
DwarfRegNum = Opcode - DW_OP_reg0;
|
||||
|
||||
if (Optional<unsigned> LLVMRegNum = MRI->getLLVMRegNum(DwarfRegNum, isEH)) {
|
||||
if (std::optional<unsigned> LLVMRegNum =
|
||||
MRI->getLLVMRegNum(DwarfRegNum, isEH)) {
|
||||
if (const char *RegName = MRI->getName(*LLVMRegNum)) {
|
||||
if ((Opcode >= DW_OP_breg0 && Opcode <= DW_OP_breg31) ||
|
||||
Opcode == DW_OP_bregx)
|
||||
@ -414,7 +415,8 @@ static bool printCompactDWARFExpr(raw_ostream &OS, DWARFExpression::iterator I,
|
||||
// DW_OP_regx: A register, with the register num given as an operand.
|
||||
// Printed as the plain register name.
|
||||
uint64_t DwarfRegNum = Op.getRawOperand(0);
|
||||
Optional<unsigned> LLVMRegNum = MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
std::optional<unsigned> LLVMRegNum =
|
||||
MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
if (!LLVMRegNum) {
|
||||
OS << "<unknown register " << DwarfRegNum << ">";
|
||||
return false;
|
||||
@ -426,7 +428,8 @@ static bool printCompactDWARFExpr(raw_ostream &OS, DWARFExpression::iterator I,
|
||||
case dwarf::DW_OP_bregx: {
|
||||
int DwarfRegNum = Op.getRawOperand(0);
|
||||
int64_t Offset = Op.getRawOperand(1);
|
||||
Optional<unsigned> LLVMRegNum = MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
std::optional<unsigned> LLVMRegNum =
|
||||
MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
if (!LLVMRegNum) {
|
||||
OS << "<unknown register " << DwarfRegNum << ">";
|
||||
return false;
|
||||
@ -463,7 +466,8 @@ static bool printCompactDWARFExpr(raw_ostream &OS, DWARFExpression::iterator I,
|
||||
// DW_OP_reg<N>: A register, with the register num implied by the
|
||||
// opcode. Printed as the plain register name.
|
||||
uint64_t DwarfRegNum = Opcode - dwarf::DW_OP_reg0;
|
||||
Optional<unsigned> LLVMRegNum = MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
std::optional<unsigned> LLVMRegNum =
|
||||
MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
if (!LLVMRegNum) {
|
||||
OS << "<unknown register " << DwarfRegNum << ">";
|
||||
return false;
|
||||
@ -474,7 +478,8 @@ static bool printCompactDWARFExpr(raw_ostream &OS, DWARFExpression::iterator I,
|
||||
Opcode <= dwarf::DW_OP_breg31) {
|
||||
int DwarfRegNum = Opcode - dwarf::DW_OP_breg0;
|
||||
int64_t Offset = Op.getRawOperand(0);
|
||||
Optional<unsigned> LLVMRegNum = MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
std::optional<unsigned> LLVMRegNum =
|
||||
MRI.getLLVMRegNum(DwarfRegNum, false);
|
||||
if (!LLVMRegNum) {
|
||||
OS << "<unknown register " << DwarfRegNum << ">";
|
||||
return false;
|
||||
|
@ -74,7 +74,7 @@ MCAsmBackend::createDwoObjectWriter(raw_pwrite_stream &OS,
|
||||
}
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class MCAsmStreamer final : public MCStreamer {
|
||||
void PrintQuotedString(StringRef Data, raw_ostream &OS) const;
|
||||
void printDwarfFileDirective(unsigned FileNo, StringRef Directory,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
bool UseDwarfDirectory,
|
||||
raw_svector_ostream &OS) const;
|
||||
@ -250,8 +250,9 @@ public:
|
||||
void emitFill(const MCExpr &NumValues, int64_t Size, int64_t Expr,
|
||||
SMLoc Loc = SMLoc()) override;
|
||||
|
||||
void emitAlignmentDirective(unsigned ByteAlignment, Optional<int64_t> Value,
|
||||
unsigned ValueSize, unsigned MaxBytesToEmit);
|
||||
void emitAlignmentDirective(unsigned ByteAlignment,
|
||||
std::optional<int64_t> Value, unsigned ValueSize,
|
||||
unsigned MaxBytesToEmit);
|
||||
|
||||
void emitValueToAlignment(Align Alignment, int64_t Value = 0,
|
||||
unsigned ValueSize = 1,
|
||||
@ -267,14 +268,13 @@ public:
|
||||
void emitFileDirective(StringRef Filename) override;
|
||||
void emitFileDirective(StringRef Filename, StringRef CompilerVerion,
|
||||
StringRef TimeStamp, StringRef Description) override;
|
||||
Expected<unsigned>
|
||||
tryEmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
std::optional<StringRef> Source = std::nullopt,
|
||||
unsigned CUID = 0) override;
|
||||
Expected<unsigned> tryEmitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
std::optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
std::optional<StringRef> Source = std::nullopt,
|
||||
unsigned CUID = 0) override;
|
||||
void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID = 0) override;
|
||||
void emitDwarfLocDirective(unsigned FileNo, unsigned Line, unsigned Column,
|
||||
@ -385,7 +385,7 @@ public:
|
||||
void emitBundleLock(bool AlignToEnd) override;
|
||||
void emitBundleUnlock() override;
|
||||
|
||||
Optional<std::pair<bool, std::string>>
|
||||
std::optional<std::pair<bool, std::string>>
|
||||
emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr,
|
||||
SMLoc Loc, const MCSubtargetInfo &STI) override;
|
||||
|
||||
@ -1417,7 +1417,7 @@ void MCAsmStreamer::emitFill(const MCExpr &NumValues, int64_t Size,
|
||||
}
|
||||
|
||||
void MCAsmStreamer::emitAlignmentDirective(unsigned ByteAlignment,
|
||||
Optional<int64_t> Value,
|
||||
std::optional<int64_t> Value,
|
||||
unsigned ValueSize,
|
||||
unsigned MaxBytesToEmit) {
|
||||
if (MAI->useDotAlignForAlignment()) {
|
||||
@ -1544,7 +1544,7 @@ void MCAsmStreamer::emitFileDirective(StringRef Filename,
|
||||
|
||||
void MCAsmStreamer::printDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
std::optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
bool UseDwarfDirectory, raw_svector_ostream &OS) const {
|
||||
SmallString<128> FullPathName;
|
||||
|
||||
@ -1575,7 +1575,7 @@ void MCAsmStreamer::printDwarfFileDirective(
|
||||
|
||||
Expected<unsigned> MCAsmStreamer::tryEmitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
std::optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
unsigned CUID) {
|
||||
assert(CUID == 0 && "multiple CUs not supported by MCAsmStreamer");
|
||||
|
||||
@ -1607,11 +1607,10 @@ Expected<unsigned> MCAsmStreamer::tryEmitDwarfFileDirective(
|
||||
return FileNo;
|
||||
}
|
||||
|
||||
void MCAsmStreamer::emitDwarfFile0Directive(StringRef Directory,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID) {
|
||||
void MCAsmStreamer::emitDwarfFile0Directive(
|
||||
StringRef Directory, StringRef Filename,
|
||||
std::optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
unsigned CUID) {
|
||||
assert(CUID == 0);
|
||||
// .file 0 is new for DWARF v5.
|
||||
if (getContext().getDwarfVersion() < 5)
|
||||
@ -1889,7 +1888,8 @@ void MCAsmStreamer::EmitRegisterName(int64_t Register) {
|
||||
// just ones that map to LLVM register numbers and have known names.
|
||||
// Fall back to using the original number directly if no name is known.
|
||||
const MCRegisterInfo *MRI = getContext().getRegisterInfo();
|
||||
if (Optional<unsigned> LLVMRegister = MRI->getLLVMRegNum(Register, true)) {
|
||||
if (std::optional<unsigned> LLVMRegister =
|
||||
MRI->getLLVMRegNum(Register, true)) {
|
||||
InstPrinter->printRegName(OS, *LLVMRegister);
|
||||
return;
|
||||
}
|
||||
@ -2373,7 +2373,7 @@ void MCAsmStreamer::emitBundleUnlock() {
|
||||
EmitEOL();
|
||||
}
|
||||
|
||||
Optional<std::pair<bool, std::string>>
|
||||
std::optional<std::pair<bool, std::string>>
|
||||
MCAsmStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
|
||||
const MCExpr *Expr, SMLoc,
|
||||
const MCSubtargetInfo &STI) {
|
||||
|
@ -635,12 +635,12 @@ bool MCContext::isELFGenericMergeableSection(StringRef SectionName) {
|
||||
ELFSeenGenericMergeableSections.count(SectionName);
|
||||
}
|
||||
|
||||
Optional<unsigned> MCContext::getELFUniqueIDForEntsize(StringRef SectionName,
|
||||
unsigned Flags,
|
||||
unsigned EntrySize) {
|
||||
std::optional<unsigned>
|
||||
MCContext::getELFUniqueIDForEntsize(StringRef SectionName, unsigned Flags,
|
||||
unsigned EntrySize) {
|
||||
auto I = ELFEntrySizeMap.find(
|
||||
MCContext::ELFEntrySizeKey{SectionName, Flags, EntrySize});
|
||||
return (I != ELFEntrySizeMap.end()) ? Optional<unsigned>(I->second)
|
||||
return (I != ELFEntrySizeMap.end()) ? std::optional<unsigned>(I->second)
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
@ -771,9 +771,9 @@ bool MCContext::hasXCOFFSection(StringRef Section,
|
||||
|
||||
MCSectionXCOFF *MCContext::getXCOFFSection(
|
||||
StringRef Section, SectionKind Kind,
|
||||
Optional<XCOFF::CsectProperties> CsectProp, bool MultiSymbolsAllowed,
|
||||
std::optional<XCOFF::CsectProperties> CsectProp, bool MultiSymbolsAllowed,
|
||||
const char *BeginSymName,
|
||||
Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSectionSubtypeFlags) {
|
||||
std::optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSectionSubtypeFlags) {
|
||||
bool IsDwarfSec = DwarfSectionSubtypeFlags.has_value();
|
||||
assert((IsDwarfSec != CsectProp.has_value()) && "Invalid XCOFF section!");
|
||||
|
||||
@ -932,7 +932,7 @@ EmitDwarfUnwindType MCContext::emitDwarfUnwindInfo() const {
|
||||
void MCContext::setGenDwarfRootFile(StringRef InputFileName, StringRef Buffer) {
|
||||
// MCDwarf needs the root file as well as the compilation directory.
|
||||
// If we find a '.file 0' directive that will supersede these values.
|
||||
Optional<MD5::MD5Result> Cksum;
|
||||
std::optional<MD5::MD5Result> Cksum;
|
||||
if (getDwarfVersion() >= 5) {
|
||||
MD5 Hash;
|
||||
MD5::MD5Result Sum;
|
||||
@ -969,12 +969,11 @@ void MCContext::setGenDwarfRootFile(StringRef InputFileName, StringRef Buffer) {
|
||||
/// directory tables. If the file number has already been allocated it is an
|
||||
/// error and zero is returned and the client reports the error, else the
|
||||
/// allocated file number is returned. The file numbers may be in any order.
|
||||
Expected<unsigned> MCContext::getDwarfFile(StringRef Directory,
|
||||
StringRef FileName,
|
||||
unsigned FileNumber,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID) {
|
||||
Expected<unsigned>
|
||||
MCContext::getDwarfFile(StringRef Directory, StringRef FileName,
|
||||
unsigned FileNumber,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source, unsigned CUID) {
|
||||
MCDwarfLineTable &Table = MCDwarfLineTablesCUMap[CUID];
|
||||
return Table.tryGetFile(Directory, FileName, Checksum, Source, DwarfVersion,
|
||||
FileNumber);
|
||||
|
@ -13,7 +13,7 @@ using namespace llvm;
|
||||
|
||||
MCDisassembler::~MCDisassembler() = default;
|
||||
|
||||
Optional<MCDisassembler::DecodeStatus>
|
||||
std::optional<MCDisassembler::DecodeStatus>
|
||||
MCDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes, uint64_t Address,
|
||||
raw_ostream &CStream) const {
|
||||
|
@ -265,7 +265,7 @@ void MCDwarfLineTable::emit(MCStreamer *MCOS, MCDwarfLineTableParams Params) {
|
||||
return;
|
||||
|
||||
// In a v5 non-split line table, put the strings in a separate section.
|
||||
Optional<MCDwarfLineStr> LineStr;
|
||||
std::optional<MCDwarfLineStr> LineStr;
|
||||
if (context.getDwarfVersion() >= 5)
|
||||
LineStr.emplace(context);
|
||||
|
||||
@ -285,14 +285,14 @@ void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
|
||||
MCSection *Section) const {
|
||||
if (!HasSplitLineTable)
|
||||
return;
|
||||
Optional<MCDwarfLineStr> NoLineStr(std::nullopt);
|
||||
std::optional<MCDwarfLineStr> NoLineStr(std::nullopt);
|
||||
MCOS.switchSection(Section);
|
||||
MCOS.emitLabel(Header.Emit(&MCOS, Params, std::nullopt, NoLineStr).second);
|
||||
}
|
||||
|
||||
std::pair<MCSymbol *, MCSymbol *>
|
||||
MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
Optional<MCDwarfLineStr> &LineStr) const {
|
||||
std::optional<MCDwarfLineStr> &LineStr) const {
|
||||
static const char StandardOpcodeLengths[] = {
|
||||
0, // length of DW_LNS_copy
|
||||
1, // length of DW_LNS_advance_pc
|
||||
@ -382,7 +382,7 @@ void MCDwarfLineTableHeader::emitV2FileDirTables(MCStreamer *MCOS) const {
|
||||
|
||||
static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
|
||||
bool EmitMD5, bool HasSource,
|
||||
Optional<MCDwarfLineStr> &LineStr) {
|
||||
std::optional<MCDwarfLineStr> &LineStr) {
|
||||
assert(!DwarfFile.Name.empty());
|
||||
if (LineStr)
|
||||
LineStr->emitRef(MCOS, DwarfFile.Name);
|
||||
@ -407,7 +407,7 @@ static void emitOneV5FileEntry(MCStreamer *MCOS, const MCDwarfFile &DwarfFile,
|
||||
}
|
||||
|
||||
void MCDwarfLineTableHeader::emitV5FileDirTables(
|
||||
MCStreamer *MCOS, Optional<MCDwarfLineStr> &LineStr) const {
|
||||
MCStreamer *MCOS, std::optional<MCDwarfLineStr> &LineStr) const {
|
||||
// The directory format, which is just a list of the directory paths. In a
|
||||
// non-split object, these are references to .debug_line_str; in a split
|
||||
// object, they are inline strings.
|
||||
@ -482,7 +482,7 @@ void MCDwarfLineTableHeader::emitV5FileDirTables(
|
||||
std::pair<MCSymbol *, MCSymbol *>
|
||||
MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
ArrayRef<char> StandardOpcodeLengths,
|
||||
Optional<MCDwarfLineStr> &LineStr) const {
|
||||
std::optional<MCDwarfLineStr> &LineStr) const {
|
||||
MCContext &context = MCOS->getContext();
|
||||
|
||||
// Create a symbol at the beginning of the line table.
|
||||
@ -548,7 +548,7 @@ MCDwarfLineTableHeader::Emit(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
}
|
||||
|
||||
void MCDwarfLineTable::emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
Optional<MCDwarfLineStr> &LineStr) const {
|
||||
std::optional<MCDwarfLineStr> &LineStr) const {
|
||||
MCSymbol *LineEndSym = Header.Emit(MCOS, Params, LineStr).second;
|
||||
|
||||
// Put out the line tables.
|
||||
@ -560,30 +560,28 @@ void MCDwarfLineTable::emitCU(MCStreamer *MCOS, MCDwarfLineTableParams Params,
|
||||
MCOS->emitLabel(LineEndSym);
|
||||
}
|
||||
|
||||
Expected<unsigned> MCDwarfLineTable::tryGetFile(StringRef &Directory,
|
||||
StringRef &FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
uint16_t DwarfVersion,
|
||||
unsigned FileNumber) {
|
||||
Expected<unsigned>
|
||||
MCDwarfLineTable::tryGetFile(StringRef &Directory, StringRef &FileName,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
uint16_t DwarfVersion, unsigned FileNumber) {
|
||||
return Header.tryGetFile(Directory, FileName, Checksum, Source, DwarfVersion,
|
||||
FileNumber);
|
||||
}
|
||||
|
||||
static bool isRootFile(const MCDwarfFile &RootFile, StringRef &Directory,
|
||||
StringRef &FileName, Optional<MD5::MD5Result> Checksum) {
|
||||
StringRef &FileName,
|
||||
std::optional<MD5::MD5Result> Checksum) {
|
||||
if (RootFile.Name.empty() || StringRef(RootFile.Name) != FileName)
|
||||
return false;
|
||||
return RootFile.Checksum == Checksum;
|
||||
}
|
||||
|
||||
Expected<unsigned>
|
||||
MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
|
||||
StringRef &FileName,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
MCDwarfLineTableHeader::tryGetFile(StringRef &Directory, StringRef &FileName,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
uint16_t DwarfVersion,
|
||||
unsigned FileNumber) {
|
||||
uint16_t DwarfVersion, unsigned FileNumber) {
|
||||
if (Directory == CompilationDir)
|
||||
Directory = "";
|
||||
if (FileName.empty()) {
|
||||
|
@ -501,7 +501,7 @@ void MCELFStreamer::finalizeCGProfileEntry(const MCSymbolRefExpr *&SRE,
|
||||
}
|
||||
const MCConstantExpr *MCOffset = MCConstantExpr::create(Offset, getContext());
|
||||
MCObjectStreamer::visitUsedExpr(*SRE);
|
||||
if (Optional<std::pair<bool, std::string>> Err =
|
||||
if (std::optional<std::pair<bool, std::string>> Err =
|
||||
MCObjectStreamer::emitRelocDirective(
|
||||
*MCOffset, "BFD_RELOC_NONE", SRE, SRE->getLoc(),
|
||||
*getContext().getSubtargetInfo()))
|
||||
|
@ -30,13 +30,13 @@ bool MCInstrAnalysis::evaluateBranch(const MCInst & /*Inst*/, uint64_t /*Addr*/,
|
||||
return false;
|
||||
}
|
||||
|
||||
Optional<uint64_t> MCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
std::optional<uint64_t> MCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
const MCInst &Inst, const MCSubtargetInfo *STI, uint64_t Addr,
|
||||
uint64_t Size) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
MCInstrAnalysis::getMemoryOperandRelocationOffset(const MCInst &Inst,
|
||||
uint64_t Size) const {
|
||||
return std::nullopt;
|
||||
|
@ -149,8 +149,8 @@ void MCObjectStreamer::resolvePendingFixups() {
|
||||
|
||||
// As a compile-time optimization, avoid allocating and evaluating an MCExpr
|
||||
// tree for (Hi - Lo) when Hi and Lo are offsets into the same fragment.
|
||||
static Optional<uint64_t> absoluteSymbolDiff(const MCSymbol *Hi,
|
||||
const MCSymbol *Lo) {
|
||||
static std::optional<uint64_t> absoluteSymbolDiff(const MCSymbol *Hi,
|
||||
const MCSymbol *Lo) {
|
||||
assert(Hi && Lo);
|
||||
if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment() ||
|
||||
Hi->isVariable() || Lo->isVariable())
|
||||
@ -163,7 +163,7 @@ void MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi,
|
||||
const MCSymbol *Lo,
|
||||
unsigned Size) {
|
||||
if (!getAssembler().getContext().getTargetTriple().isRISCV())
|
||||
if (Optional<uint64_t> Diff = absoluteSymbolDiff(Hi, Lo))
|
||||
if (std::optional<uint64_t> Diff = absoluteSymbolDiff(Hi, Lo))
|
||||
return emitIntValue(*Diff, Size);
|
||||
MCStreamer::emitAbsoluteSymbolDiff(Hi, Lo, Size);
|
||||
}
|
||||
@ -171,7 +171,7 @@ void MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi,
|
||||
void MCObjectStreamer::emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi,
|
||||
const MCSymbol *Lo) {
|
||||
if (!getAssembler().getContext().getTargetTriple().isRISCV())
|
||||
if (Optional<uint64_t> Diff = absoluteSymbolDiff(Hi, Lo))
|
||||
if (std::optional<uint64_t> Diff = absoluteSymbolDiff(Hi, Lo))
|
||||
return emitULEB128IntValue(*Diff);
|
||||
MCStreamer::emitAbsoluteSymbolDiffAsULEB128(Hi, Lo);
|
||||
}
|
||||
@ -726,7 +726,7 @@ void MCObjectStreamer::emitGPRel64Value(const MCExpr *Value) {
|
||||
DF->getContents().resize(DF->getContents().size() + 8, 0);
|
||||
}
|
||||
|
||||
static Optional<std::pair<bool, std::string>>
|
||||
static std::optional<std::pair<bool, std::string>>
|
||||
getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
|
||||
MCDataFragment *&DF) {
|
||||
if (Symbol.isVariable()) {
|
||||
@ -788,11 +788,12 @@ getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<std::pair<bool, std::string>>
|
||||
std::optional<std::pair<bool, std::string>>
|
||||
MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
|
||||
const MCExpr *Expr, SMLoc Loc,
|
||||
const MCSubtargetInfo &STI) {
|
||||
Optional<MCFixupKind> MaybeKind = Assembler->getBackend().getFixupKind(Name);
|
||||
std::optional<MCFixupKind> MaybeKind =
|
||||
Assembler->getBackend().getFixupKind(Name);
|
||||
if (!MaybeKind)
|
||||
return std::make_pair(true, std::string("unknown relocation name"));
|
||||
|
||||
@ -824,8 +825,8 @@ MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
|
||||
const MCSymbol &Symbol = SRE.getSymbol();
|
||||
if (Symbol.isDefined()) {
|
||||
uint32_t SymbolOffset = 0;
|
||||
Optional<std::pair<bool, std::string>> Error;
|
||||
Error = getOffsetAndDataFragment(Symbol, SymbolOffset, DF);
|
||||
std::optional<std::pair<bool, std::string>> Error =
|
||||
getOffsetAndDataFragment(Symbol, SymbolOffset, DF);
|
||||
|
||||
if (Error != std::nullopt)
|
||||
return Error;
|
||||
|
@ -3183,7 +3183,7 @@ bool AsmParser::parseDirectiveReloc(SMLoc DirectiveLoc) {
|
||||
|
||||
const MCTargetAsmParser &MCT = getTargetParser();
|
||||
const MCSubtargetInfo &STI = MCT.getSTI();
|
||||
if (Optional<std::pair<bool, std::string>> Err =
|
||||
if (std::optional<std::pair<bool, std::string>> Err =
|
||||
getStreamer().emitRelocDirective(*Offset, Name, Expr, DirectiveLoc,
|
||||
STI))
|
||||
return Error(Err->first ? NameLoc : OffsetLoc, Err->second);
|
||||
@ -3583,7 +3583,7 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
|
||||
Ctx.setGenDwarfForAssembly(false);
|
||||
}
|
||||
|
||||
Optional<MD5::MD5Result> CKMem;
|
||||
std::optional<MD5::MD5Result> CKMem;
|
||||
if (HasMD5) {
|
||||
MD5::MD5Result Sum;
|
||||
for (unsigned i = 0; i != 8; ++i) {
|
||||
|
@ -848,8 +848,8 @@ private:
|
||||
|
||||
const MCExpr *evaluateBuiltinValue(BuiltinSymbol Symbol, SMLoc StartLoc);
|
||||
|
||||
llvm::Optional<std::string> evaluateBuiltinTextMacro(BuiltinSymbol Symbol,
|
||||
SMLoc StartLoc);
|
||||
std::optional<std::string> evaluateBuiltinTextMacro(BuiltinSymbol Symbol,
|
||||
SMLoc StartLoc);
|
||||
|
||||
// ".ascii", ".asciz", ".string"
|
||||
bool parseDirectiveAscii(StringRef IDVal, bool ZeroTerminated);
|
||||
@ -1201,7 +1201,7 @@ bool MasmParser::expandMacros() {
|
||||
return false;
|
||||
}
|
||||
|
||||
llvm::Optional<std::string> ExpandedValue;
|
||||
std::optional<std::string> ExpandedValue;
|
||||
auto BuiltinIt = BuiltinSymbolMap.find(IDLower);
|
||||
if (BuiltinIt != BuiltinSymbolMap.end()) {
|
||||
ExpandedValue =
|
||||
@ -3617,7 +3617,7 @@ bool MasmParser::parseTextItem(std::string &Data) {
|
||||
// Try to resolve as a built-in text macro
|
||||
auto BuiltinIt = BuiltinSymbolMap.find(ID.lower());
|
||||
if (BuiltinIt != BuiltinSymbolMap.end()) {
|
||||
llvm::Optional<std::string> BuiltinText =
|
||||
std::optional<std::string> BuiltinText =
|
||||
evaluateBuiltinTextMacro(BuiltinIt->getValue(), StartLoc);
|
||||
if (!BuiltinText) {
|
||||
// Not a text macro; break without substituting
|
||||
@ -4888,7 +4888,7 @@ bool MasmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
|
||||
Ctx.setGenDwarfForAssembly(false);
|
||||
}
|
||||
|
||||
Optional<MD5::MD5Result> CKMem;
|
||||
std::optional<MD5::MD5Result> CKMem;
|
||||
if (HasMD5) {
|
||||
MD5::MD5Result Sum;
|
||||
for (unsigned i = 0; i != 8; ++i) {
|
||||
@ -6892,7 +6892,7 @@ bool MasmParser::expandStatement(SMLoc Loc) {
|
||||
StringMap<std::string> BuiltinValues;
|
||||
for (const auto &S : BuiltinSymbolMap) {
|
||||
const BuiltinSymbol &Sym = S.getValue();
|
||||
if (llvm::Optional<std::string> Text = evaluateBuiltinTextMacro(Sym, Loc)) {
|
||||
if (std::optional<std::string> Text = evaluateBuiltinTextMacro(Sym, Loc)) {
|
||||
BuiltinValues[S.getKey().lower()] = std::move(*Text);
|
||||
}
|
||||
}
|
||||
@ -7692,7 +7692,7 @@ const MCExpr *MasmParser::evaluateBuiltinValue(BuiltinSymbol Symbol,
|
||||
llvm_unreachable("unhandled built-in symbol");
|
||||
}
|
||||
|
||||
llvm::Optional<std::string>
|
||||
std::optional<std::string>
|
||||
MasmParser::evaluateBuiltinTextMacro(BuiltinSymbol Symbol, SMLoc StartLoc) {
|
||||
switch (Symbol) {
|
||||
default:
|
||||
|
@ -78,8 +78,8 @@ int MCRegisterInfo::getDwarfRegNum(MCRegister RegNum, bool isEH) const {
|
||||
return I->ToReg;
|
||||
}
|
||||
|
||||
Optional<unsigned> MCRegisterInfo::getLLVMRegNum(unsigned RegNum,
|
||||
bool isEH) const {
|
||||
std::optional<unsigned> MCRegisterInfo::getLLVMRegNum(unsigned RegNum,
|
||||
bool isEH) const {
|
||||
const DwarfLLVMRegPair *M = isEH ? EHDwarf2LRegs : Dwarf2LRegs;
|
||||
unsigned Size = isEH ? EHDwarf2LRegsSize : Dwarf2LRegsSize;
|
||||
|
||||
@ -101,7 +101,7 @@ int MCRegisterInfo::getDwarfRegNumFromDwarfEHRegNum(unsigned RegNum) const {
|
||||
// a corresponding LLVM register number at all. So if we can't map the
|
||||
// EH register number to an LLVM register number, assume it's just a
|
||||
// valid DWARF register number as is.
|
||||
if (Optional<unsigned> LRegNum = getLLVMRegNum(RegNum, true))
|
||||
if (std::optional<unsigned> LRegNum = getLLVMRegNum(RegNum, true))
|
||||
return getDwarfRegNum(*LRegNum, false);
|
||||
return RegNum;
|
||||
}
|
||||
|
@ -227,19 +227,17 @@ void llvm::MCStreamer::emitNops(int64_t NumBytes, int64_t ControlledNopLen,
|
||||
/// The implementation in this class just redirects to emitFill.
|
||||
void MCStreamer::emitZeros(uint64_t NumBytes) { emitFill(NumBytes, 0); }
|
||||
|
||||
Expected<unsigned>
|
||||
MCStreamer::tryEmitDwarfFileDirective(unsigned FileNo, StringRef Directory,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID) {
|
||||
Expected<unsigned> MCStreamer::tryEmitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
std::optional<MD5::MD5Result> Checksum, std::optional<StringRef> Source,
|
||||
unsigned CUID) {
|
||||
return getContext().getDwarfFile(Directory, Filename, FileNo, Checksum,
|
||||
Source, CUID);
|
||||
}
|
||||
|
||||
void MCStreamer::emitDwarfFile0Directive(StringRef Directory,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
std::optional<MD5::MD5Result> Checksum,
|
||||
std::optional<StringRef> Source,
|
||||
unsigned CUID) {
|
||||
getContext().setMCLineTableRootFile(CUID, Directory, Filename, Checksum,
|
||||
|
@ -345,7 +345,8 @@ MCSubtargetInfo::getCacheAssociativity(unsigned Level) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<unsigned> MCSubtargetInfo::getCacheLineSize(unsigned Level) const {
|
||||
std::optional<unsigned>
|
||||
MCSubtargetInfo::getCacheLineSize(unsigned Level) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ using namespace llvm;
|
||||
|
||||
#define MCOPT_EXP(TY, NAME) \
|
||||
MCOPT(TY, NAME) \
|
||||
Optional<TY> llvm::mc::getExplicit##NAME() { \
|
||||
std::optional<TY> llvm::mc::getExplicit##NAME() { \
|
||||
if (NAME##View->getNumOccurrences()) { \
|
||||
TY res = *NAME##View; \
|
||||
return res; \
|
||||
|
@ -274,9 +274,9 @@ static const MCExpr *GetSubDivExpr(MCStreamer &Streamer, const MCSymbol *LHS,
|
||||
return Expr;
|
||||
}
|
||||
|
||||
static Optional<int64_t> GetOptionalAbsDifference(MCStreamer &Streamer,
|
||||
const MCSymbol *LHS,
|
||||
const MCSymbol *RHS) {
|
||||
static std::optional<int64_t> GetOptionalAbsDifference(MCStreamer &Streamer,
|
||||
const MCSymbol *LHS,
|
||||
const MCSymbol *RHS) {
|
||||
MCContext &Context = Streamer.getContext();
|
||||
const MCExpr *Diff =
|
||||
MCBinaryExpr::createSub(MCSymbolRefExpr::create(LHS, Context),
|
||||
@ -293,7 +293,8 @@ static Optional<int64_t> GetOptionalAbsDifference(MCStreamer &Streamer,
|
||||
|
||||
static int64_t GetAbsDifference(MCStreamer &Streamer, const MCSymbol *LHS,
|
||||
const MCSymbol *RHS) {
|
||||
Optional<int64_t> MaybeDiff = GetOptionalAbsDifference(Streamer, LHS, RHS);
|
||||
std::optional<int64_t> MaybeDiff =
|
||||
GetOptionalAbsDifference(Streamer, LHS, RHS);
|
||||
if (!MaybeDiff)
|
||||
report_fatal_error("Failed to evaluate function length in SEH unwind info");
|
||||
return *MaybeDiff;
|
||||
@ -305,7 +306,7 @@ static void checkARM64Instructions(MCStreamer &Streamer,
|
||||
StringRef Name, StringRef Type) {
|
||||
if (!End)
|
||||
return;
|
||||
Optional<int64_t> MaybeDistance =
|
||||
std::optional<int64_t> MaybeDistance =
|
||||
GetOptionalAbsDifference(Streamer, End, Begin);
|
||||
if (!MaybeDistance)
|
||||
return;
|
||||
@ -1552,7 +1553,7 @@ static void checkARMInstructions(MCStreamer &Streamer,
|
||||
StringRef Name, StringRef Type) {
|
||||
if (!End)
|
||||
return;
|
||||
Optional<int64_t> MaybeDistance =
|
||||
std::optional<int64_t> MaybeDistance =
|
||||
GetOptionalAbsDifference(Streamer, End, Begin);
|
||||
if (!MaybeDistance)
|
||||
return;
|
||||
@ -1774,7 +1775,7 @@ static int checkARMPackedEpilog(MCStreamer &streamer, WinEH::FrameInfo *info,
|
||||
|
||||
// Check that the epilog actually is at the very end of the function,
|
||||
// otherwise it can't be packed.
|
||||
Optional<int64_t> MaybeDistance = GetOptionalAbsDifference(
|
||||
std::optional<int64_t> MaybeDistance = GetOptionalAbsDifference(
|
||||
streamer, info->FuncletOrFuncEnd, info->EpilogMap.begin()->first);
|
||||
if (!MaybeDistance)
|
||||
return -1;
|
||||
@ -2000,7 +2001,7 @@ static bool tryARMPackedUnwind(MCStreamer &streamer, WinEH::FrameInfo *info,
|
||||
if (EpilogInfo.Condition != 0xe) // ARMCC::AL
|
||||
return false;
|
||||
const std::vector<WinEH::Instruction> &Epilog = EpilogInfo.Instructions;
|
||||
Optional<int64_t> MaybeDistance = GetOptionalAbsDifference(
|
||||
std::optional<int64_t> MaybeDistance = GetOptionalAbsDifference(
|
||||
streamer, info->FuncletOrFuncEnd, info->EpilogMap.begin()->first);
|
||||
if (!MaybeDistance)
|
||||
return false;
|
||||
@ -2310,7 +2311,7 @@ static void ARMEmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info,
|
||||
" not correctly terminated");
|
||||
}
|
||||
|
||||
Optional<int64_t> RawFuncLength;
|
||||
std::optional<int64_t> RawFuncLength;
|
||||
const MCExpr *FuncLengthExpr = nullptr;
|
||||
if (!info->FuncletOrFuncEnd) {
|
||||
report_fatal_error("FuncletOrFuncEnd not set");
|
||||
@ -2440,7 +2441,7 @@ static void ARMEmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info,
|
||||
MCSymbol *EpilogStart = I.first;
|
||||
uint32_t EpilogIndex = I.second;
|
||||
|
||||
Optional<int64_t> MaybeEpilogOffset =
|
||||
std::optional<int64_t> MaybeEpilogOffset =
|
||||
GetOptionalAbsDifference(streamer, EpilogStart, info->Begin);
|
||||
const MCExpr *OffsetExpr = nullptr;
|
||||
uint32_t EpilogOffset = 0;
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
return AArch64::NumTargetFixupKinds;
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override {
|
||||
const static MCFixupKindInfo Infos[AArch64::NumTargetFixupKinds] = {
|
||||
@ -330,7 +330,8 @@ static uint64_t adjustFixupValue(const MCFixup &Fixup, const MCValue &Target,
|
||||
}
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> AArch64AsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind>
|
||||
AArch64AsmBackend::getFixupKind(StringRef Name) const {
|
||||
if (!TheTriple.isOSBinFormatELF())
|
||||
return std::nullopt;
|
||||
|
||||
|
@ -2210,7 +2210,7 @@ MCDisassembler::DecodeStatus AMDGPUDisassembler::decodeKernelDescriptor(
|
||||
return MCDisassembler::Success;
|
||||
}
|
||||
|
||||
Optional<MCDisassembler::DecodeStatus>
|
||||
std::optional<MCDisassembler::DecodeStatus>
|
||||
AMDGPUDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes, uint64_t Address,
|
||||
raw_ostream &CStream) const {
|
||||
|
@ -129,10 +129,9 @@ public:
|
||||
return MCDisassembler::Fail;
|
||||
}
|
||||
|
||||
Optional<DecodeStatus> onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes,
|
||||
uint64_t Address,
|
||||
raw_ostream &CStream) const override;
|
||||
std::optional<DecodeStatus>
|
||||
onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, ArrayRef<uint8_t> Bytes,
|
||||
uint64_t Address, raw_ostream &CStream) const override;
|
||||
|
||||
DecodeStatus decodeKernelDescriptor(StringRef KdName, ArrayRef<uint8_t> Bytes,
|
||||
uint64_t KdAddress) const;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
bool writeNopData(raw_ostream &OS, uint64_t Count,
|
||||
const MCSubtargetInfo *STI) const override;
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
||||
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
const MCValue &Target) override;
|
||||
@ -162,8 +162,9 @@ void AMDGPUAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
Data[Offset + i] |= static_cast<uint8_t>((Value >> (i * 8)) & 0xff);
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> AMDGPUAsmBackend::getFixupKind(StringRef Name) const {
|
||||
return StringSwitch<Optional<MCFixupKind>>(Name)
|
||||
std::optional<MCFixupKind>
|
||||
AMDGPUAsmBackend::getFixupKind(StringRef Name) const {
|
||||
return StringSwitch<std::optional<MCFixupKind>>(Name)
|
||||
#define ELF_RELOC(Name, Value) \
|
||||
.Case(#Name, MCFixupKind(FirstLiteralRelocationKind + Value))
|
||||
#include "llvm/BinaryFormat/ELFRelocs/AMDGPU.def"
|
||||
|
@ -47,11 +47,12 @@ public:
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
Optional<MCFixupKind> ARMAsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind> ARMAsmBackend::getFixupKind(StringRef Name) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> ARMAsmBackendELF::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind>
|
||||
ARMAsmBackendELF::getFixupKind(StringRef Name) const {
|
||||
unsigned Type = llvm::StringSwitch<unsigned>(Name)
|
||||
#define ELF_RELOC(X, Y) .Case(#X, Y)
|
||||
#include "llvm/BinaryFormat/ELFRelocs/ARM.def"
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
return STI->getFeatureBits()[ARM::HasV6T2Ops];
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
||||
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
return createARMELFObjectWriter(OSABI);
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -431,15 +431,14 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
Optional<uint64_t> evaluateMemoryOperandAddress(const MCInst &Inst,
|
||||
const MCSubtargetInfo *STI,
|
||||
uint64_t Addr,
|
||||
uint64_t Size) const override;
|
||||
std::optional<uint64_t>
|
||||
evaluateMemoryOperandAddress(const MCInst &Inst, const MCSubtargetInfo *STI,
|
||||
uint64_t Addr, uint64_t Size) const override;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static Optional<uint64_t>
|
||||
static std::optional<uint64_t>
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
evaluateMemOpAddrForAddrMode_i12(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex, uint64_t Addr) {
|
||||
@ -458,10 +457,9 @@ evaluateMemOpAddrForAddrMode_i12(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
return Addr + OffImm;
|
||||
}
|
||||
|
||||
static Optional<uint64_t> evaluateMemOpAddrForAddrMode3(const MCInst &Inst,
|
||||
const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex,
|
||||
uint64_t Addr) {
|
||||
static std::optional<uint64_t>
|
||||
evaluateMemOpAddrForAddrMode3(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex, uint64_t Addr) {
|
||||
if (MemOpIndex + 2 >= Desc.getNumOperands())
|
||||
return std::nullopt;
|
||||
|
||||
@ -479,10 +477,9 @@ static Optional<uint64_t> evaluateMemOpAddrForAddrMode3(const MCInst &Inst,
|
||||
return Addr + ImmOffs;
|
||||
}
|
||||
|
||||
static Optional<uint64_t> evaluateMemOpAddrForAddrMode5(const MCInst &Inst,
|
||||
const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex,
|
||||
uint64_t Addr) {
|
||||
static std::optional<uint64_t>
|
||||
evaluateMemOpAddrForAddrMode5(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex, uint64_t Addr) {
|
||||
if (MemOpIndex + 1 >= Desc.getNumOperands())
|
||||
return std::nullopt;
|
||||
|
||||
@ -499,7 +496,7 @@ static Optional<uint64_t> evaluateMemOpAddrForAddrMode5(const MCInst &Inst,
|
||||
return Addr + ImmOffs * 4;
|
||||
}
|
||||
|
||||
static Optional<uint64_t>
|
||||
static std::optional<uint64_t>
|
||||
evaluateMemOpAddrForAddrMode5FP16(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex, uint64_t Addr) {
|
||||
if (MemOpIndex + 1 >= Desc.getNumOperands())
|
||||
@ -518,7 +515,7 @@ evaluateMemOpAddrForAddrMode5FP16(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
return Addr + ImmOffs * 2;
|
||||
}
|
||||
|
||||
static Optional<uint64_t>
|
||||
static std::optional<uint64_t>
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
evaluateMemOpAddrForAddrModeT2_i8s4(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex, uint64_t Addr) {
|
||||
@ -539,7 +536,7 @@ evaluateMemOpAddrForAddrModeT2_i8s4(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
return Addr + OffImm;
|
||||
}
|
||||
|
||||
static Optional<uint64_t>
|
||||
static std::optional<uint64_t>
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
evaluateMemOpAddrForAddrModeT2_pc(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex, uint64_t Addr) {
|
||||
@ -555,14 +552,14 @@ evaluateMemOpAddrForAddrModeT2_pc(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
return Addr + OffImm;
|
||||
}
|
||||
|
||||
static Optional<uint64_t>
|
||||
static std::optional<uint64_t>
|
||||
// NOLINTNEXTLINE(readability-identifier-naming)
|
||||
evaluateMemOpAddrForAddrModeT1_s(const MCInst &Inst, const MCInstrDesc &Desc,
|
||||
unsigned MemOpIndex, uint64_t Addr) {
|
||||
return evaluateMemOpAddrForAddrModeT2_pc(Inst, Desc, MemOpIndex, Addr);
|
||||
}
|
||||
|
||||
Optional<uint64_t> ARMMCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
std::optional<uint64_t> ARMMCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
const MCInst &Inst, const MCSubtargetInfo *STI, uint64_t Addr,
|
||||
uint64_t Size) const {
|
||||
const MCInstrDesc &Desc = Info->get(Inst.getOpcode());
|
||||
|
@ -24,7 +24,8 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
Optional<MCFixupKind> LoongArchAsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind>
|
||||
LoongArchAsmBackend::getFixupKind(StringRef Name) const {
|
||||
if (STI.getTargetTriple().isOSBinFormatELF()) {
|
||||
auto Type = llvm::StringSwitch<unsigned>(Name)
|
||||
#define ELF_RELOC(X, Y) .Case(#X, Y)
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
return LoongArch::NumTargetFixupKinds;
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
||||
|
||||
|
@ -300,7 +300,7 @@ void MipsAsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
}
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> MipsAsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind> MipsAsmBackend::getFixupKind(StringRef Name) const {
|
||||
unsigned Type = llvm::StringSwitch<unsigned>(Name)
|
||||
.Case("BFD_RELOC_NONE", ELF::R_MIPS_NONE)
|
||||
.Case("BFD_RELOC_16", ELF::R_MIPS_16)
|
||||
@ -310,7 +310,7 @@ Optional<MCFixupKind> MipsAsmBackend::getFixupKind(StringRef Name) const {
|
||||
if (Type != -1u)
|
||||
return static_cast<MCFixupKind>(FirstLiteralRelocationKind + Type);
|
||||
|
||||
return StringSwitch<Optional<MCFixupKind>>(Name)
|
||||
return StringSwitch<std::optional<MCFixupKind>>(Name)
|
||||
.Case("R_MIPS_NONE", FK_NONE)
|
||||
.Case("R_MIPS_32", FK_Data_4)
|
||||
.Case("R_MIPS_CALL_HI16", (MCFixupKind)Mips::fixup_Mips_CALL_HI16)
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
uint64_t Value, bool IsResolved,
|
||||
const MCSubtargetInfo *STI) const override;
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
||||
|
||||
unsigned getNumFixupKinds() const override {
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
return createPPCELFObjectWriter(Is64, OSABI);
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
};
|
||||
|
||||
class XCOFFPPCAsmBackend : public PPCAsmBackend {
|
||||
@ -242,7 +242,8 @@ public:
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
Optional<MCFixupKind> ELFPPCAsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind>
|
||||
ELFPPCAsmBackend::getFixupKind(StringRef Name) const {
|
||||
if (TT.isOSBinFormatELF()) {
|
||||
unsigned Type;
|
||||
if (TT.isPPC64()) {
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
Optional<MCFixupKind> RISCVAsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind> RISCVAsmBackend::getFixupKind(StringRef Name) const {
|
||||
if (STI.getTargetTriple().isOSBinFormatELF()) {
|
||||
unsigned Type;
|
||||
Type = llvm::StringSwitch<unsigned>(Name)
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
return RISCV::NumTargetFixupKinds;
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
||||
|
||||
|
@ -141,7 +141,7 @@ namespace {
|
||||
return Sparc::NumTargetFixupKinds;
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override {
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override {
|
||||
unsigned Type;
|
||||
Type = llvm::StringSwitch<unsigned>(Name)
|
||||
#define ELF_RELOC(X, Y) .Case(#X, Y)
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
unsigned getNumFixupKinds() const override {
|
||||
return SystemZ::NumTargetFixupKinds;
|
||||
}
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
||||
bool shouldForceRelocation(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
const MCValue &Target) override;
|
||||
@ -111,7 +111,8 @@ public:
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
||||
Optional<MCFixupKind> SystemZMCAsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind>
|
||||
SystemZMCAsmBackend::getFixupKind(StringRef Name) const {
|
||||
unsigned Type = llvm::StringSwitch<unsigned>(Name)
|
||||
#define ELF_RELOC(X, Y) .Case(#X, Y)
|
||||
#include "llvm/BinaryFormat/ELFRelocs/SystemZ.def"
|
||||
|
@ -45,10 +45,9 @@ class WebAssemblyDisassembler final : public MCDisassembler {
|
||||
DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes, uint64_t Address,
|
||||
raw_ostream &CStream) const override;
|
||||
Optional<DecodeStatus> onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes,
|
||||
uint64_t Address,
|
||||
raw_ostream &CStream) const override;
|
||||
std::optional<DecodeStatus>
|
||||
onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, ArrayRef<uint8_t> Bytes,
|
||||
uint64_t Address, raw_ostream &CStream) const override;
|
||||
|
||||
public:
|
||||
WebAssemblyDisassembler(const MCSubtargetInfo &STI, MCContext &Ctx,
|
||||
@ -121,9 +120,11 @@ bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Optional<MCDisassembler::DecodeStatus> WebAssemblyDisassembler::onSymbolStart(
|
||||
SymbolInfoTy &Symbol, uint64_t &Size, ArrayRef<uint8_t> Bytes,
|
||||
uint64_t Address, raw_ostream &CStream) const {
|
||||
std::optional<MCDisassembler::DecodeStatus>
|
||||
WebAssemblyDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes,
|
||||
uint64_t Address,
|
||||
raw_ostream &CStream) const {
|
||||
Size = 0;
|
||||
if (Address == 0) {
|
||||
// Start of a code section: we're parsing only the function count.
|
||||
|
@ -272,7 +272,7 @@ MCSymbol *WebAssemblyAsmPrinter::getOrCreateWasmSymbol(StringRef Name) {
|
||||
}
|
||||
|
||||
void WebAssemblyAsmPrinter::emitSymbolType(const MCSymbolWasm *Sym) {
|
||||
Optional<wasm::WasmSymbolType> WasmTy = Sym->getType();
|
||||
std::optional<wasm::WasmSymbolType> WasmTy = Sym->getType();
|
||||
if (!WasmTy)
|
||||
return;
|
||||
|
||||
|
@ -168,7 +168,7 @@ public:
|
||||
return X86::NumTargetFixupKinds;
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override;
|
||||
|
||||
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
|
||||
|
||||
@ -587,7 +587,7 @@ void X86AsmBackend::emitInstructionEnd(MCObjectStreamer &OS, const MCInst &Inst)
|
||||
Sec->ensureMinAlignment(AlignBoundary);
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> X86AsmBackend::getFixupKind(StringRef Name) const {
|
||||
std::optional<MCFixupKind> X86AsmBackend::getFixupKind(StringRef Name) const {
|
||||
if (STI.getTargetTriple().isOSBinFormatELF()) {
|
||||
unsigned Type;
|
||||
if (STI.getTargetTriple().getArch() == Triple::x86_64) {
|
||||
@ -1145,8 +1145,8 @@ public:
|
||||
, Is64Bit(is64Bit) {
|
||||
}
|
||||
|
||||
Optional<MCFixupKind> getFixupKind(StringRef Name) const override {
|
||||
return StringSwitch<Optional<MCFixupKind>>(Name)
|
||||
std::optional<MCFixupKind> getFixupKind(StringRef Name) const override {
|
||||
return StringSwitch<std::optional<MCFixupKind>>(Name)
|
||||
.Case("dir32", FK_Data_4)
|
||||
.Case("secrel32", FK_SecRel_4)
|
||||
.Case("secidx", FK_SecRel_2)
|
||||
|
@ -506,11 +506,10 @@ public:
|
||||
|
||||
bool evaluateBranch(const MCInst &Inst, uint64_t Addr, uint64_t Size,
|
||||
uint64_t &Target) const override;
|
||||
Optional<uint64_t> evaluateMemoryOperandAddress(const MCInst &Inst,
|
||||
const MCSubtargetInfo *STI,
|
||||
uint64_t Addr,
|
||||
uint64_t Size) const override;
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
evaluateMemoryOperandAddress(const MCInst &Inst, const MCSubtargetInfo *STI,
|
||||
uint64_t Addr, uint64_t Size) const override;
|
||||
std::optional<uint64_t>
|
||||
getMemoryOperandRelocationOffset(const MCInst &Inst,
|
||||
uint64_t Size) const override;
|
||||
};
|
||||
@ -637,7 +636,7 @@ bool X86MCInstrAnalysis::evaluateBranch(const MCInst &Inst, uint64_t Addr,
|
||||
return true;
|
||||
}
|
||||
|
||||
Optional<uint64_t> X86MCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
std::optional<uint64_t> X86MCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
const MCInst &Inst, const MCSubtargetInfo *STI, uint64_t Addr,
|
||||
uint64_t Size) const {
|
||||
const MCInstrDesc &MCID = Info->get(Inst.getOpcode());
|
||||
@ -662,7 +661,7 @@ Optional<uint64_t> X86MCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
X86MCInstrAnalysis::getMemoryOperandRelocationOffset(const MCInst &Inst,
|
||||
uint64_t Size) const {
|
||||
if (Inst.getOpcode() != X86::LEA64r)
|
||||
|
@ -43,7 +43,7 @@ Error objdump::getXCOFFRelocationValueString(const XCOFFObjectFile &Obj,
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
Optional<XCOFF::StorageMappingClass>
|
||||
std::optional<XCOFF::StorageMappingClass>
|
||||
objdump::getXCOFFSymbolCsectSMC(const XCOFFObjectFile &Obj,
|
||||
const SymbolRef &Sym) {
|
||||
const XCOFFSymbolRef SymRef = Obj.toSymbolRef(Sym.getRawDataRefImpl());
|
||||
@ -58,7 +58,7 @@ objdump::getXCOFFSymbolCsectSMC(const XCOFFObjectFile &Obj,
|
||||
return CsectAuxEntOrErr.get().getStorageMappingClass();
|
||||
}
|
||||
|
||||
Optional<object::SymbolRef>
|
||||
std::optional<object::SymbolRef>
|
||||
objdump::getXCOFFSymbolContainingSymbolRef(const XCOFFObjectFile &Obj,
|
||||
const SymbolRef &Sym) {
|
||||
const XCOFFSymbolRef SymRef = Obj.toSymbolRef(Sym.getRawDataRefImpl());
|
||||
|
@ -16,11 +16,11 @@ namespace llvm {
|
||||
struct SymbolInfoTy;
|
||||
|
||||
namespace objdump {
|
||||
Optional<XCOFF::StorageMappingClass>
|
||||
std::optional<XCOFF::StorageMappingClass>
|
||||
getXCOFFSymbolCsectSMC(const object::XCOFFObjectFile &Obj,
|
||||
const object::SymbolRef &Sym);
|
||||
|
||||
Optional<object::SymbolRef>
|
||||
std::optional<object::SymbolRef>
|
||||
getXCOFFSymbolContainingSymbolRef(const object::XCOFFObjectFile &Obj,
|
||||
const object::SymbolRef &Sym);
|
||||
|
||||
|
@ -863,7 +863,7 @@ addDynamicElfSymbols(const ELFObjectFileBase &Obj,
|
||||
llvm_unreachable("Unsupported binary format");
|
||||
}
|
||||
|
||||
static Optional<SectionRef> getWasmCodeSection(const WasmObjectFile &Obj) {
|
||||
static std::optional<SectionRef> getWasmCodeSection(const WasmObjectFile &Obj) {
|
||||
for (auto SecI : Obj.sections()) {
|
||||
const WasmSection &Section = Obj.getWasmSection(SecI);
|
||||
if (Section.Type == wasm::WASM_SEC_CODE)
|
||||
@ -875,7 +875,7 @@ static Optional<SectionRef> getWasmCodeSection(const WasmObjectFile &Obj) {
|
||||
static void
|
||||
addMissingWasmCodeSymbols(const WasmObjectFile &Obj,
|
||||
std::map<SectionRef, SectionSymbolsTy> &AllSymbols) {
|
||||
Optional<SectionRef> Section = getWasmCodeSection(Obj);
|
||||
std::optional<SectionRef> Section = getWasmCodeSection(Obj);
|
||||
if (!Section)
|
||||
return;
|
||||
SectionSymbolsTy &Symbols = AllSymbols[*Section];
|
||||
@ -1084,7 +1084,7 @@ SymbolInfoTy objdump::createSymbolInfo(const ObjectFile &Obj,
|
||||
DataRefImpl SymbolDRI = Symbol.getRawDataRefImpl();
|
||||
|
||||
const uint32_t SymbolIndex = XCOFFObj.getSymbolIndex(SymbolDRI.p);
|
||||
Optional<XCOFF::StorageMappingClass> Smc =
|
||||
std::optional<XCOFF::StorageMappingClass> Smc =
|
||||
getXCOFFSymbolCsectSMC(XCOFFObj, Symbol);
|
||||
return SymbolInfoTy(Addr, Name, Smc, SymbolIndex,
|
||||
isLabel(XCOFFObj, Symbol));
|
||||
@ -1823,7 +1823,7 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
|
||||
bool PrintTarget =
|
||||
MIA->evaluateBranch(Inst, SectionAddr + Index, Size, Target);
|
||||
if (!PrintTarget)
|
||||
if (Optional<uint64_t> MaybeTarget =
|
||||
if (std::optional<uint64_t> MaybeTarget =
|
||||
MIA->evaluateMemoryOperandAddress(
|
||||
Inst, STI, SectionAddr + Index, Size)) {
|
||||
Target = *MaybeTarget;
|
||||
@ -2480,7 +2480,7 @@ void objdump::printSymbol(const ObjectFile &O, const SymbolRef &Symbol,
|
||||
StringRef SectionName = unwrapOrError(Section->getName(), FileName);
|
||||
outs() << SectionName;
|
||||
if (O.isXCOFF()) {
|
||||
Optional<SymbolRef> SymRef =
|
||||
std::optional<SymbolRef> SymRef =
|
||||
getXCOFFSymbolContainingSymbolRef(cast<XCOFFObjectFile>(O), Symbol);
|
||||
if (SymRef) {
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
TheStreamer->switchSection(C.MOFI->getDwarfLineSection());
|
||||
MCDwarfLineTableHeader Header;
|
||||
MCDwarfLineTableParams Params = Assembler.getDWARFLinetableParams();
|
||||
Optional<MCDwarfLineStr> LineStr(std::nullopt);
|
||||
std::optional<MCDwarfLineStr> LineStr(std::nullopt);
|
||||
if (Ctx.getDwarfVersion() >= 5) {
|
||||
LineStr.emplace(Ctx);
|
||||
Header.setRootFile("dir", "file", std::nullopt, std::nullopt);
|
||||
|
Loading…
x
Reference in New Issue
Block a user