forked from OSchip/llvm-project
[DebugInfo] llvm::Optional => std::optional
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
parent
35b4fbb559
commit
89fab98e88
|
@ -424,7 +424,7 @@ public:
|
|||
|
||||
/// Initializes Buffer and Stream.
|
||||
void initialize(const DWARFSection &StrOffsetsSection,
|
||||
const Optional<StrOffsetsContributionDescriptor> Contr);
|
||||
const std::optional<StrOffsetsContributionDescriptor> Contr);
|
||||
|
||||
/// Update Str offset in .debug_str in .debug_str_offsets.
|
||||
void updateAddressMap(uint32_t Index, uint32_t Address);
|
||||
|
|
|
@ -1482,14 +1482,14 @@ unsigned BinaryContext::addDebugFilenameToUnit(const uint32_t DestCUID,
|
|||
"FileIndex out of range for the compilation unit.");
|
||||
StringRef Dir = "";
|
||||
if (FileNames[FileIndex - 1].DirIdx != 0) {
|
||||
if (Optional<const char *> DirName = dwarf::toString(
|
||||
if (std::optional<const char *> DirName = dwarf::toString(
|
||||
LineTable->Prologue
|
||||
.IncludeDirectories[FileNames[FileIndex - 1].DirIdx - 1])) {
|
||||
Dir = *DirName;
|
||||
}
|
||||
}
|
||||
StringRef FileName = "";
|
||||
if (Optional<const char *> FName =
|
||||
if (std::optional<const char *> FName =
|
||||
dwarf::toString(FileNames[FileIndex - 1].Name))
|
||||
FileName = *FName;
|
||||
assert(FileName != "");
|
||||
|
@ -1545,7 +1545,7 @@ DWARFContext *BinaryContext::getDWOContext() const {
|
|||
void BinaryContext::preprocessDWODebugInfo() {
|
||||
for (const std::unique_ptr<DWARFUnit> &CU : DwCtx->compile_units()) {
|
||||
DWARFUnit *const DwarfUnit = CU.get();
|
||||
if (llvm::Optional<uint64_t> DWOId = DwarfUnit->getDWOId()) {
|
||||
if (std::optional<uint64_t> DWOId = DwarfUnit->getDWOId()) {
|
||||
DWARFUnit *DWOCU = DwarfUnit->getNonSkeletonUnitDIE(false).getDwarfUnit();
|
||||
if (!DWOCU->isDWOUnit()) {
|
||||
std::string DWOName = dwarf::toString(
|
||||
|
@ -1648,9 +1648,9 @@ void BinaryContext::preprocessDebugInfo() {
|
|||
std::optional<MD5::MD5Result> Checksum;
|
||||
if (LineTable->Prologue.ContentTypes.HasMD5)
|
||||
Checksum = LineTable->Prologue.FileNames[0].Checksum;
|
||||
Optional<const char *> Name =
|
||||
std::optional<const char *> Name =
|
||||
dwarf::toString(CU->getUnitDIE().find(dwarf::DW_AT_name), nullptr);
|
||||
if (Optional<uint64_t> DWOID = CU->getDWOId()) {
|
||||
if (std::optional<uint64_t> DWOID = CU->getDWOId()) {
|
||||
auto Iter = DWOCUs.find(*DWOID);
|
||||
assert(Iter != DWOCUs.end() && "DWO CU was not found.");
|
||||
Name = dwarf::toString(
|
||||
|
@ -1675,12 +1675,13 @@ void BinaryContext::preprocessDebugInfo() {
|
|||
// means empty dir.
|
||||
StringRef Dir = "";
|
||||
if (FileNames[I].DirIdx != 0 || DwarfVersion >= 5)
|
||||
if (Optional<const char *> DirName = dwarf::toString(
|
||||
if (std::optional<const char *> DirName = dwarf::toString(
|
||||
LineTable->Prologue
|
||||
.IncludeDirectories[FileNames[I].DirIdx - Offset]))
|
||||
Dir = *DirName;
|
||||
StringRef FileName = "";
|
||||
if (Optional<const char *> FName = dwarf::toString(FileNames[I].Name))
|
||||
if (std::optional<const char *> FName =
|
||||
dwarf::toString(FileNames[I].Name))
|
||||
FileName = *FName;
|
||||
assert(FileName != "");
|
||||
std::optional<MD5::MD5Result> Checksum;
|
||||
|
@ -1811,7 +1812,7 @@ static void printDebugInfo(raw_ostream &OS, const MCInst &Instruction,
|
|||
|
||||
const DWARFDebugLine::Row &Row = LineTable->Rows[RowRef.RowIndex - 1];
|
||||
StringRef FileName = "";
|
||||
if (Optional<const char *> FName =
|
||||
if (std::optional<const char *> FName =
|
||||
dwarf::toString(LineTable->Prologue.FileNames[Row.File - 1].Name))
|
||||
FileName = *FName;
|
||||
OS << " # debug line " << FileName << ":" << Row.Line;
|
||||
|
|
|
@ -49,7 +49,7 @@ findAttributeInfo(const DWARFDie DIE,
|
|||
const DWARFUnit &U = *DIE.getDwarfUnit();
|
||||
uint64_t Offset =
|
||||
AbbrevDecl->getAttributeOffsetFromIndex(Index, DIE.getOffset(), U);
|
||||
Optional<DWARFFormValue> Value =
|
||||
std::optional<DWARFFormValue> Value =
|
||||
AbbrevDecl->getAttributeValueFromOffset(Index, Offset, U);
|
||||
if (!Value)
|
||||
return std::nullopt;
|
||||
|
@ -57,7 +57,7 @@ findAttributeInfo(const DWARFDie DIE,
|
|||
const DWARFAbbreviationDeclaration::AttributeSpec *AttrVal =
|
||||
AbbrevDecl->attributes().begin() + Index;
|
||||
uint32_t ValSize = 0;
|
||||
Optional<int64_t> ValSizeOpt = AttrVal->getByteSize(U);
|
||||
std::optional<int64_t> ValSizeOpt = AttrVal->getByteSize(U);
|
||||
if (ValSizeOpt) {
|
||||
ValSize = static_cast<uint32_t>(*ValSizeOpt);
|
||||
} else {
|
||||
|
@ -81,7 +81,7 @@ Optional<AttrInfo> findAttributeInfo(const DWARFDie DIE,
|
|||
DIE.getAbbreviationDeclarationPtr();
|
||||
if (!AbbrevDecl)
|
||||
return std::nullopt;
|
||||
Optional<uint32_t> Index = AbbrevDecl->findAttributeIndex(Attr);
|
||||
std::optional<uint32_t> Index = AbbrevDecl->findAttributeIndex(Attr);
|
||||
if (!Index)
|
||||
return std::nullopt;
|
||||
return findAttributeInfo(DIE, AbbrevDecl, *Index);
|
||||
|
@ -421,7 +421,7 @@ AddressSectionBuffer DebugAddrWriterDwarf5::finalize() {
|
|||
// for it.
|
||||
if (AMIter == AddressMaps.end()) {
|
||||
AMIter = AddressMaps.insert({CUID, AddressForDWOCU()}).first;
|
||||
Optional<uint64_t> BaseOffset = CU->getAddrOffsetSectionBase();
|
||||
std::optional<uint64_t> BaseOffset = CU->getAddrOffsetSectionBase();
|
||||
if (!BaseOffset)
|
||||
continue;
|
||||
// Address base offset is to the first entry.
|
||||
|
@ -1067,7 +1067,7 @@ std::string DebugInfoBinaryPatcher::patchBinary(StringRef BinaryContents) {
|
|||
|
||||
void DebugStrOffsetsWriter::initialize(
|
||||
const DWARFSection &StrOffsetsSection,
|
||||
const Optional<StrOffsetsContributionDescriptor> Contr) {
|
||||
const std::optional<StrOffsetsContributionDescriptor> Contr) {
|
||||
if (!Contr)
|
||||
return;
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ void BinaryFunction::parseLSDA(ArrayRef<uint8_t> LSDASectionData,
|
|||
uint8_t LPStartEncoding = Data.getU8(&Offset);
|
||||
uint64_t LPStart = 0;
|
||||
// Convert to offset if LPStartEncoding is typed absptr DW_EH_PE_absptr
|
||||
if (Optional<uint64_t> MaybeLPStart = Data.getEncodedPointer(
|
||||
if (std::optional<uint64_t> MaybeLPStart = Data.getEncodedPointer(
|
||||
&Offset, LPStartEncoding, Offset + LSDASectionAddress))
|
||||
LPStart = (LPStartEncoding && 0xFF == 0) ? *MaybeLPStart
|
||||
: *MaybeLPStart - Address;
|
||||
|
@ -496,7 +496,7 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
|
|||
return true;
|
||||
|
||||
const FDE &CurFDE = *I->second;
|
||||
Optional<uint64_t> LSDA = CurFDE.getLSDAAddress();
|
||||
std::optional<uint64_t> LSDA = CurFDE.getLSDAAddress();
|
||||
Function.setLSDAAddress(LSDA ? *LSDA : 0);
|
||||
|
||||
uint64_t Offset = Function.getFirstInstructionOffset();
|
||||
|
@ -785,7 +785,7 @@ Error EHFrameParser::parseCIE(uint64_t StartOffset) {
|
|||
break;
|
||||
case 'P': {
|
||||
uint32_t PersonalityEncoding = Data.getU8(&Offset);
|
||||
Optional<uint64_t> Personality =
|
||||
std::optional<uint64_t> Personality =
|
||||
Data.getEncodedPointer(&Offset, PersonalityEncoding,
|
||||
EHFrameAddress ? EHFrameAddress + Offset : 0);
|
||||
// Patch personality address
|
||||
|
@ -817,7 +817,7 @@ Error EHFrameParser::parseCIE(uint64_t StartOffset) {
|
|||
|
||||
Error EHFrameParser::parseFDE(uint64_t CIEPointer,
|
||||
uint64_t StartStructureOffset) {
|
||||
Optional<uint64_t> LSDAAddress;
|
||||
std::optional<uint64_t> LSDAAddress;
|
||||
CIEInfo *Cie = CIEs[StartStructureOffset - CIEPointer];
|
||||
|
||||
// The address size is encoded in the CIE we reference.
|
||||
|
|
|
@ -121,7 +121,7 @@ static std::string
|
|||
getDWOName(llvm::DWARFUnit &CU,
|
||||
std::unordered_map<std::string, uint32_t> *NameToIndexMap,
|
||||
std::unordered_map<uint64_t, std::string> &DWOIdToName) {
|
||||
llvm::Optional<uint64_t> DWOId = CU.getDWOId();
|
||||
std::optional<uint64_t> DWOId = CU.getDWOId();
|
||||
assert(DWOId && "DWO ID not found.");
|
||||
(void)DWOId;
|
||||
auto NameIter = DWOIdToName.find(*DWOId);
|
||||
|
@ -198,7 +198,7 @@ void DWARFRewriter::updateDebugInfo() {
|
|||
LocListWritersByCU[CUIndex] =
|
||||
std::make_unique<DebugLoclistWriter>(*CU.get(), DwarfVersion, false);
|
||||
|
||||
if (Optional<uint64_t> DWOId = CU->getDWOId()) {
|
||||
if (std::optional<uint64_t> DWOId = CU->getDWOId()) {
|
||||
assert(LocListWritersByCU.count(*DWOId) == 0 &&
|
||||
"RangeLists writer for DWO unit already exists.");
|
||||
auto RangeListsSectionWriter =
|
||||
|
@ -211,7 +211,7 @@ void DWARFRewriter::updateDebugInfo() {
|
|||
LocListWritersByCU[CUIndex] = std::make_unique<DebugLocWriter>();
|
||||
}
|
||||
|
||||
if (Optional<uint64_t> DWOId = CU->getDWOId()) {
|
||||
if (std::optional<uint64_t> DWOId = CU->getDWOId()) {
|
||||
assert(LocListWritersByCU.count(*DWOId) == 0 &&
|
||||
"LocList writer for DWO unit already exists.");
|
||||
// Work around some bug in llvm-15. If I pass in directly lld reports
|
||||
|
@ -258,7 +258,7 @@ void DWARFRewriter::updateDebugInfo() {
|
|||
// its matching split/DWO CU.
|
||||
Optional<DWARFUnit *> SplitCU;
|
||||
Optional<uint64_t> RangesBase;
|
||||
llvm::Optional<uint64_t> DWOId = Unit->getDWOId();
|
||||
std::optional<uint64_t> DWOId = Unit->getDWOId();
|
||||
StrOffstsWriter->initialize(Unit->getStringOffsetSection(),
|
||||
Unit->getStringOffsetsTableContribution());
|
||||
if (DWOId)
|
||||
|
@ -495,7 +495,7 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
}
|
||||
case dwarf::DW_TAG_call_site: {
|
||||
auto patchPC = [&](AttrInfo &AttrVal, StringRef Entry) -> void {
|
||||
Optional<uint64_t> Address = AttrVal.V.getAsAddress();
|
||||
std::optional<uint64_t> Address = AttrVal.V.getAsAddress();
|
||||
const BinaryFunction *Function =
|
||||
BC.getBinaryFunctionContainingAddress(*Address);
|
||||
uint64_t UpdatedAddress = *Address;
|
||||
|
@ -539,7 +539,7 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
: Value.getAsSectionOffset().value();
|
||||
DebugLocationsVector InputLL;
|
||||
|
||||
Optional<object::SectionedAddress> SectionAddress =
|
||||
std::optional<object::SectionedAddress> SectionAddress =
|
||||
Unit.getBaseAddress();
|
||||
uint64_t BaseAddress = 0;
|
||||
if (SectionAddress)
|
||||
|
@ -547,7 +547,7 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
|
||||
if (Unit.getVersion() >= 5 &&
|
||||
AttrVal->V.getForm() == dwarf::DW_FORM_loclistx) {
|
||||
Optional<uint64_t> LocOffset = Unit.getLoclistOffset(Offset);
|
||||
std::optional<uint64_t> LocOffset = Unit.getLoclistOffset(Offset);
|
||||
assert(LocOffset && "Location Offset is invalid.");
|
||||
Offset = *LocOffset;
|
||||
}
|
||||
|
@ -579,14 +579,14 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
Entry.Value0, Entry.Value0 + Entry.Value1, Entry.Loc});
|
||||
break;
|
||||
case dwarf::DW_LLE_base_addressx: {
|
||||
Optional<object::SectionedAddress> EntryAddress =
|
||||
std::optional<object::SectionedAddress> EntryAddress =
|
||||
Unit.getAddrOffsetSectionItem(Entry.Value0);
|
||||
assert(EntryAddress && "base Address not found.");
|
||||
BaseAddress = EntryAddress->Address;
|
||||
break;
|
||||
}
|
||||
case dwarf::DW_LLE_startx_length: {
|
||||
Optional<object::SectionedAddress> EntryAddress =
|
||||
std::optional<object::SectionedAddress> EntryAddress =
|
||||
Unit.getAddrOffsetSectionItem(Entry.Value0);
|
||||
assert(EntryAddress && "Address does not exist.");
|
||||
InputLL.emplace_back(DebugLocationEntry{
|
||||
|
@ -595,10 +595,10 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
break;
|
||||
}
|
||||
case dwarf::DW_LLE_startx_endx: {
|
||||
Optional<object::SectionedAddress> StartAddress =
|
||||
std::optional<object::SectionedAddress> StartAddress =
|
||||
Unit.getAddrOffsetSectionItem(Entry.Value0);
|
||||
assert(StartAddress && "Start Address does not exist.");
|
||||
Optional<object::SectionedAddress> EndAddress =
|
||||
std::optional<object::SectionedAddress> EndAddress =
|
||||
Unit.getAddrOffsetSectionItem(Entry.Value1);
|
||||
assert(EndAddress && "Start Address does not exist.");
|
||||
InputLL.emplace_back(DebugLocationEntry{
|
||||
|
@ -661,7 +661,7 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
Expr.getCode() == dwarf::DW_OP_addrx))
|
||||
continue;
|
||||
const uint64_t Index = Expr.getRawOperand(0);
|
||||
Optional<object::SectionedAddress> EntryAddress =
|
||||
std::optional<object::SectionedAddress> EntryAddress =
|
||||
Unit.getAddrOffsetSectionItem(Index);
|
||||
assert(EntryAddress && "Address is not found.");
|
||||
assert(Index <= std::numeric_limits<uint32_t>::max() &&
|
||||
|
@ -694,7 +694,7 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
findAttributeInfo(DIE, dwarf::DW_AT_low_pc)) {
|
||||
AttrOffset = AttrVal->Offset;
|
||||
Value = AttrVal->V;
|
||||
const Optional<uint64_t> Result = Value.getAsAddress();
|
||||
const std::optional<uint64_t> Result = Value.getAsAddress();
|
||||
if (Result) {
|
||||
const uint64_t Address = *Result;
|
||||
uint64_t NewAddress = 0;
|
||||
|
@ -742,7 +742,8 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
continue;
|
||||
// If input is DWP file we need to keep track of which TU came from each
|
||||
// CU, so we can write it out correctly.
|
||||
if (Optional<uint64_t> Val = SignatureAttrVal->V.getAsReferenceUVal())
|
||||
if (std::optional<uint64_t> Val =
|
||||
SignatureAttrVal->V.getAsReferenceUVal())
|
||||
TypeSignaturesPerCU[*DIE.getDwarfUnit()->getDWOId()].insert(*Val);
|
||||
else {
|
||||
errs() << "BOT-ERROR: DW_AT_signature form is not supported.\n";
|
||||
|
@ -919,9 +920,9 @@ void DWARFRewriter::updateLineTableOffsets(const MCAsmLayout &Layout) {
|
|||
std::unordered_map<uint64_t, uint64_t> DebugLineOffsetMap;
|
||||
|
||||
auto GetStatementListValue = [](DWARFUnit *Unit) {
|
||||
Optional<DWARFFormValue> StmtList =
|
||||
std::optional<DWARFFormValue> StmtList =
|
||||
Unit->getUnitDIE().find(dwarf::DW_AT_stmt_list);
|
||||
Optional<uint64_t> Offset = dwarf::toSectionOffset(StmtList);
|
||||
std::optional<uint64_t> Offset = dwarf::toSectionOffset(StmtList);
|
||||
assert(Offset && "Was not able to retreive value of DW_AT_stmt_list.");
|
||||
return *Offset;
|
||||
};
|
||||
|
@ -1412,7 +1413,7 @@ void DWARFRewriter::writeDWP(
|
|||
}
|
||||
|
||||
for (const std::unique_ptr<DWARFUnit> &CU : BC.DwCtx->compile_units()) {
|
||||
Optional<uint64_t> DWOId = CU->getDWOId();
|
||||
std::optional<uint64_t> DWOId = CU->getDWOId();
|
||||
if (!DWOId)
|
||||
continue;
|
||||
|
||||
|
@ -1581,7 +1582,7 @@ void DWARFRewriter::writeDWOFiles(
|
|||
}
|
||||
|
||||
for (const std::unique_ptr<DWARFUnit> &CU : BC.DwCtx->compile_units()) {
|
||||
Optional<uint64_t> DWOId = CU->getDWOId();
|
||||
std::optional<uint64_t> DWOId = CU->getDWOId();
|
||||
if (!DWOId)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ Error TpiSource::mergeDebugT(TypeMerger *m) {
|
|||
// When dealing with PCH.OBJ, some indices were already merged.
|
||||
unsigned nbHeadIndices = indexMapStorage.size();
|
||||
|
||||
Optional<PCHMergerInfo> pchInfo;
|
||||
std::optional<PCHMergerInfo> pchInfo;
|
||||
if (auto err = mergeTypeAndIdRecords(m->idTable, m->typeTable,
|
||||
indexMapStorage, types, pchInfo))
|
||||
fatal("codeview::mergeTypeAndIdRecords failed: " +
|
||||
|
|
|
@ -127,7 +127,7 @@ LLDDwarfObj<ELFT>::findAux(const InputSectionBase &sec, uint64_t pos,
|
|||
DataRefImpl d;
|
||||
d.p = getAddend<ELFT>(rel);
|
||||
return RelocAddrEntry{secIndex, RelocationRef(d, nullptr),
|
||||
val, Optional<object::RelocationRef>(),
|
||||
val, std::optional<object::RelocationRef>(),
|
||||
0, LLDRelocationResolver<RelTy>::resolve};
|
||||
}
|
||||
|
||||
|
|
|
@ -2613,10 +2613,10 @@ bool DWARFExpression::ParseDWARFLocationList(
|
|||
dwarf_cu->GetLocationTable(data);
|
||||
Log *log = GetLog(LLDBLog::Expressions);
|
||||
auto lookup_addr =
|
||||
[&](uint32_t index) -> llvm::Optional<llvm::object::SectionedAddress> {
|
||||
[&](uint32_t index) -> std::optional<llvm::object::SectionedAddress> {
|
||||
addr_t address = dwarf_cu->ReadAddressFromDebugAddrSection(index);
|
||||
if (address == LLDB_INVALID_ADDRESS)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return llvm::object::SectionedAddress{address};
|
||||
};
|
||||
auto process_list = [&](llvm::Expected<llvm::DWARFLocationExpression> loc) {
|
||||
|
|
|
@ -578,7 +578,7 @@ llvm::Expected<uint64_t> DWARFUnit::GetRnglistOffset(uint32_t Index) {
|
|||
"DW_FORM_rnglistx cannot be used without "
|
||||
"DW_AT_rnglists_base for CU at 0x%8.8x",
|
||||
GetOffset());
|
||||
if (llvm::Optional<uint64_t> off = GetRnglistTable()->getOffsetEntry(
|
||||
if (std::optional<uint64_t> off = GetRnglistTable()->getOffsetEntry(
|
||||
GetRnglistData().GetAsLLVM(), Index))
|
||||
return *off + m_ranges_base;
|
||||
return llvm::createStringError(
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
if (!m_loclist_table_header)
|
||||
return llvm::None;
|
||||
|
||||
llvm::Optional<uint64_t> Offset = m_loclist_table_header->getOffsetEntry(
|
||||
std::optional<uint64_t> Offset = m_loclist_table_header->getOffsetEntry(
|
||||
m_dwarf.GetDWARFContext().getOrLoadLocListsData().GetAsLLVM(), Index);
|
||||
if (!Offset)
|
||||
return llvm::None;
|
||||
|
|
|
@ -43,7 +43,7 @@ DebugNamesDWARFIndex::GetUnits(const DebugNames &debug_names) {
|
|||
|
||||
llvm::Optional<DIERef>
|
||||
DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) {
|
||||
llvm::Optional<uint64_t> cu_offset = entry.getCUOffset();
|
||||
std::optional<uint64_t> cu_offset = entry.getCUOffset();
|
||||
if (!cu_offset)
|
||||
return llvm::None;
|
||||
|
||||
|
@ -52,7 +52,7 @@ DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) {
|
|||
return llvm::None;
|
||||
|
||||
cu = &cu->GetNonSkeletonUnit();
|
||||
if (llvm::Optional<uint64_t> die_offset = entry.getDIEUnitOffset())
|
||||
if (std::optional<uint64_t> die_offset = entry.getDIEUnitOffset())
|
||||
return DIERef(cu->GetSymbolFileDWARF().GetDwoNum(),
|
||||
DIERef::Section::DebugInfo, cu->GetOffset() + *die_offset);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ static void ParseBuildInfo(PdbIndex &index, const CVSymbol &sym,
|
|||
// S_BUILDINFO just points to an LF_BUILDINFO in the IPI stream. Let's do
|
||||
// a little extra work to pull out the LF_BUILDINFO.
|
||||
LazyRandomTypeCollection &types = index.ipi().typeCollection();
|
||||
llvm::Optional<CVType> cvt = types.tryGetType(bis.BuildId);
|
||||
std::optional<CVType> cvt = types.tryGetType(bis.BuildId);
|
||||
|
||||
if (!cvt || cvt->kind() != LF_BUILDINFO)
|
||||
return;
|
||||
|
|
|
@ -634,7 +634,7 @@ unsigned AttributeEncodingVendor(TypeKind E);
|
|||
unsigned LanguageVendor(SourceLanguage L);
|
||||
/// @}
|
||||
|
||||
Optional<unsigned> LanguageLowerBound(SourceLanguage L);
|
||||
std::optional<unsigned> LanguageLowerBound(SourceLanguage L);
|
||||
|
||||
/// The size of a reference determined by the DWARF 32/64-bit format.
|
||||
inline uint8_t getDwarfOffsetByteSize(DwarfFormat Format) {
|
||||
|
@ -694,9 +694,10 @@ inline uint8_t getUnitLengthFieldByteSize(DwarfFormat Format) {
|
|||
///
|
||||
/// \param Form DWARF form to get the fixed byte size for.
|
||||
/// \param Params DWARF parameters to help interpret forms.
|
||||
/// \returns Optional<uint8_t> value with the fixed byte size or None if
|
||||
/// \returns std::optional<uint8_t> value with the fixed byte size or None if
|
||||
/// \p Form doesn't have a fixed byte size.
|
||||
Optional<uint8_t> getFixedFormByteSize(dwarf::Form Form, FormParams Params);
|
||||
std::optional<uint8_t> getFixedFormByteSize(dwarf::Form Form,
|
||||
FormParams Params);
|
||||
|
||||
/// Tells whether the specified form is defined in the specified version,
|
||||
/// or is an extension if extensions are allowed.
|
||||
|
|
|
@ -36,8 +36,8 @@ public:
|
|||
~AppendingTypeTableBuilder();
|
||||
|
||||
// TypeCollection overrides
|
||||
Optional<TypeIndex> getFirst() override;
|
||||
Optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
std::optional<TypeIndex> getFirst() override;
|
||||
std::optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
CVType getType(TypeIndex Index) override;
|
||||
StringRef getTypeName(TypeIndex Index) override;
|
||||
bool contains(TypeIndex Index) override;
|
||||
|
|
|
@ -19,9 +19,9 @@ class SymbolVisitorCallbacks;
|
|||
class CVSymbolVisitor {
|
||||
public:
|
||||
struct FilterOptions {
|
||||
llvm::Optional<uint32_t> SymbolOffset;
|
||||
llvm::Optional<uint32_t> ParentRecursiveDepth;
|
||||
llvm::Optional<uint32_t> ChildRecursiveDepth;
|
||||
std::optional<uint32_t> SymbolOffset;
|
||||
std::optional<uint32_t> ParentRecursiveDepth;
|
||||
std::optional<uint32_t> ChildRecursiveDepth;
|
||||
};
|
||||
|
||||
CVSymbolVisitor(SymbolVisitorCallbacks &Callbacks);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define LLVM_DEBUGINFO_CODEVIEW_CODEVIEWRECORDIO_H
|
||||
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewError.h"
|
||||
|
@ -63,7 +62,7 @@ public:
|
|||
explicit CodeViewRecordIO(CodeViewRecordStreamer &Streamer)
|
||||
: Streamer(&Streamer) {}
|
||||
|
||||
Error beginRecord(Optional<uint32_t> MaxLength);
|
||||
Error beginRecord(std::optional<uint32_t> MaxLength);
|
||||
Error endRecord();
|
||||
|
||||
Error mapInteger(TypeIndex &TypeInd, const Twine &Comment = "");
|
||||
|
@ -245,9 +244,9 @@ private:
|
|||
|
||||
struct RecordLimit {
|
||||
uint32_t BeginOffset;
|
||||
Optional<uint32_t> MaxLength;
|
||||
std::optional<uint32_t> MaxLength;
|
||||
|
||||
Optional<uint32_t> bytesRemaining(uint32_t CurrentOffset) const {
|
||||
std::optional<uint32_t> bytesRemaining(uint32_t CurrentOffset) const {
|
||||
if (!MaxLength)
|
||||
return std::nullopt;
|
||||
assert(CurrentOffset >= BeginOffset);
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define LLVM_DEBUGINFO_CODEVIEW_CONTINUATIONRECORDBUILDER_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecordMapping.h"
|
||||
|
@ -26,7 +25,7 @@ enum class ContinuationRecordKind { FieldList, MethodOverloadList };
|
|||
|
||||
class ContinuationRecordBuilder {
|
||||
SmallVector<uint32_t, 4> SegmentOffsets;
|
||||
Optional<ContinuationRecordKind> Kind;
|
||||
std::optional<ContinuationRecordKind> Kind;
|
||||
AppendingBinaryByteStream Buffer;
|
||||
BinaryStreamWriter SegmentWriter;
|
||||
TypeRecordMapping Mapping;
|
||||
|
@ -36,7 +35,7 @@ class ContinuationRecordBuilder {
|
|||
|
||||
void insertSegmentEnd(uint32_t Offset);
|
||||
CVType createSegmentRecord(uint32_t OffBegin, uint32_t OffEnd,
|
||||
Optional<TypeIndex> RefersTo);
|
||||
std::optional<TypeIndex> RefersTo);
|
||||
|
||||
public:
|
||||
ContinuationRecordBuilder();
|
||||
|
|
|
@ -49,8 +49,8 @@ public:
|
|||
~GlobalTypeTableBuilder();
|
||||
|
||||
// TypeCollection overrides
|
||||
Optional<TypeIndex> getFirst() override;
|
||||
Optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
std::optional<TypeIndex> getFirst() override;
|
||||
std::optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
CVType getType(TypeIndex Index) override;
|
||||
StringRef getTypeName(TypeIndex Index) override;
|
||||
bool contains(TypeIndex Index) override;
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define LLVM_DEBUGINFO_CODEVIEW_LAZYRANDOMTYPECOLLECTION_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeCollection.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
|
@ -69,15 +68,15 @@ public:
|
|||
|
||||
uint32_t getOffsetOfType(TypeIndex Index);
|
||||
|
||||
Optional<CVType> tryGetType(TypeIndex Index);
|
||||
std::optional<CVType> tryGetType(TypeIndex Index);
|
||||
|
||||
CVType getType(TypeIndex Index) override;
|
||||
StringRef getTypeName(TypeIndex Index) override;
|
||||
bool contains(TypeIndex Index) override;
|
||||
uint32_t size() override;
|
||||
uint32_t capacity() override;
|
||||
Optional<TypeIndex> getFirst() override;
|
||||
Optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
std::optional<TypeIndex> getFirst() override;
|
||||
std::optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -45,8 +45,8 @@ public:
|
|||
~MergingTypeTableBuilder();
|
||||
|
||||
// TypeCollection overrides
|
||||
Optional<TypeIndex> getFirst() override;
|
||||
Optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
std::optional<TypeIndex> getFirst() override;
|
||||
std::optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
CVType getType(TypeIndex Index) override;
|
||||
StringRef getTypeName(TypeIndex Index) override;
|
||||
bool contains(TypeIndex Index) override;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "llvm/ADT/APSInt.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
|
@ -324,7 +323,7 @@ private:
|
|||
return true;
|
||||
}
|
||||
|
||||
Optional<DecodedAnnotation> Current;
|
||||
std::optional<DecodedAnnotation> Current;
|
||||
ArrayRef<uint8_t> Data;
|
||||
ArrayRef<uint8_t> Next;
|
||||
};
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
#include "llvm/DebugInfo/CodeView/CodeViewSymbols.def"
|
||||
|
||||
private:
|
||||
Optional<SymbolKind> Kind;
|
||||
std::optional<SymbolKind> Kind;
|
||||
|
||||
CodeViewRecordIO IO;
|
||||
CodeViewContainer Container;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_SYMBOLSERIALIZER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/RecordSerialization.h"
|
||||
|
@ -35,7 +34,7 @@ class SymbolSerializer : public SymbolVisitorCallbacks {
|
|||
MutableBinaryByteStream Stream;
|
||||
BinaryStreamWriter Writer;
|
||||
SymbolRecordMapping Mapping;
|
||||
Optional<SymbolKind> CurrentSymbol;
|
||||
std::optional<SymbolKind> CurrentSymbol;
|
||||
|
||||
Error writeRecordPrefix(SymbolKind Kind) {
|
||||
RecordPrefix Prefix;
|
||||
|
|
|
@ -21,8 +21,8 @@ public:
|
|||
|
||||
bool empty() { return size() == 0; }
|
||||
|
||||
virtual Optional<TypeIndex> getFirst() = 0;
|
||||
virtual Optional<TypeIndex> getNext(TypeIndex Prev) = 0;
|
||||
virtual std::optional<TypeIndex> getFirst() = 0;
|
||||
virtual std::optional<TypeIndex> getNext(TypeIndex Prev) = 0;
|
||||
|
||||
virtual CVType getType(TypeIndex Index) = 0;
|
||||
virtual StringRef getTypeName(TypeIndex Index) = 0;
|
||||
|
@ -32,7 +32,7 @@ public:
|
|||
virtual bool replaceType(TypeIndex &Index, CVType Data, bool Stabilize) = 0;
|
||||
|
||||
template <typename TFunc> void ForEachRecord(TFunc Func) {
|
||||
Optional<TypeIndex> Next = getFirst();
|
||||
std::optional<TypeIndex> Next = getFirst();
|
||||
|
||||
while (Next) {
|
||||
TypeIndex N = *Next;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "llvm/ADT/APSInt.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
|
@ -22,6 +21,7 @@
|
|||
#include "llvm/Support/Endian.h"
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
namespace llvm {
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
#ifndef LLVM_DEBUGINFO_CODEVIEW_TYPERECORDMAPPING_H
|
||||
#define LLVM_DEBUGINFO_CODEVIEW_TYPERECORDMAPPING_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeView.h"
|
||||
#include "llvm/DebugInfo/CodeView/CodeViewRecordIO.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
#include <optional>
|
||||
|
||||
namespace llvm {
|
||||
class BinaryStreamReader;
|
||||
|
@ -46,8 +46,8 @@ public:
|
|||
#include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
|
||||
|
||||
private:
|
||||
Optional<TypeLeafKind> TypeKind;
|
||||
Optional<TypeLeafKind> MemberKind;
|
||||
std::optional<TypeLeafKind> TypeKind;
|
||||
std::optional<TypeLeafKind> MemberKind;
|
||||
|
||||
CodeViewRecordIO IO;
|
||||
};
|
||||
|
|
|
@ -91,20 +91,20 @@ Error mergeTypeAndIdRecords(MergingTypeTableBuilder &DestIds,
|
|||
MergingTypeTableBuilder &DestTypes,
|
||||
SmallVectorImpl<TypeIndex> &SourceToDest,
|
||||
const CVTypeArray &IdsAndTypes,
|
||||
Optional<PCHMergerInfo> &PCHInfo);
|
||||
std::optional<PCHMergerInfo> &PCHInfo);
|
||||
|
||||
Error mergeTypeAndIdRecords(GlobalTypeTableBuilder &DestIds,
|
||||
GlobalTypeTableBuilder &DestTypes,
|
||||
SmallVectorImpl<TypeIndex> &SourceToDest,
|
||||
const CVTypeArray &IdsAndTypes,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
Optional<PCHMergerInfo> &PCHInfo);
|
||||
std::optional<PCHMergerInfo> &PCHInfo);
|
||||
|
||||
Error mergeTypeRecords(GlobalTypeTableBuilder &Dest,
|
||||
SmallVectorImpl<TypeIndex> &SourceToDest,
|
||||
const CVTypeArray &Types,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
Optional<PCHMergerInfo> &PCHInfo);
|
||||
std::optional<PCHMergerInfo> &PCHInfo);
|
||||
|
||||
Error mergeIdRecords(GlobalTypeTableBuilder &Dest, ArrayRef<TypeIndex> Types,
|
||||
SmallVectorImpl<TypeIndex> &SourceToDest,
|
||||
|
|
|
@ -21,8 +21,8 @@ class TypeTableCollection : public TypeCollection {
|
|||
public:
|
||||
explicit TypeTableCollection(ArrayRef<ArrayRef<uint8_t>> Records);
|
||||
|
||||
Optional<TypeIndex> getFirst() override;
|
||||
Optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
std::optional<TypeIndex> getFirst() override;
|
||||
std::optional<TypeIndex> getNext(TypeIndex Prev) override;
|
||||
|
||||
CVType getType(TypeIndex Index) override;
|
||||
StringRef getTypeName(TypeIndex Index) override;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
@ -36,11 +37,11 @@ struct DILineInfo {
|
|||
std::string FileName;
|
||||
std::string FunctionName;
|
||||
std::string StartFileName;
|
||||
Optional<StringRef> Source;
|
||||
std::optional<StringRef> Source;
|
||||
uint32_t Line = 0;
|
||||
uint32_t Column = 0;
|
||||
uint32_t StartLine = 0;
|
||||
Optional<uint64_t> StartAddress;
|
||||
std::optional<uint64_t> StartAddress;
|
||||
|
||||
// DWARF-specific.
|
||||
uint32_t Discriminator = 0;
|
||||
|
@ -125,9 +126,9 @@ struct DILocal {
|
|||
std::string Name;
|
||||
std::string DeclFile;
|
||||
uint64_t DeclLine = 0;
|
||||
Optional<int64_t> FrameOffset;
|
||||
Optional<uint64_t> Size;
|
||||
Optional<uint64_t> TagOffset;
|
||||
std::optional<int64_t> FrameOffset;
|
||||
std::optional<uint64_t> Size;
|
||||
std::optional<uint64_t> TagOffset;
|
||||
};
|
||||
|
||||
/// A DINameKind is passed to name search methods to specify a
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFABBREVIATIONDECLARATION_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFABBREVIATIONDECLARATION_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
|
@ -31,7 +30,8 @@ public:
|
|||
: Attr(A), Form(F), Value(Value) {
|
||||
assert(isImplicitConst());
|
||||
}
|
||||
AttributeSpec(dwarf::Attribute A, dwarf::Form F, Optional<uint8_t> ByteSize)
|
||||
AttributeSpec(dwarf::Attribute A, dwarf::Form F,
|
||||
std::optional<uint8_t> ByteSize)
|
||||
: Attr(A), Form(F) {
|
||||
assert(!isImplicitConst());
|
||||
this->ByteSize.HasByteSize = ByteSize.has_value();
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
/// use the DWARFUnit to calculate the size of the Form, like for
|
||||
/// DW_AT_address and DW_AT_ref_addr, so this isn't just an accessor for
|
||||
/// the ByteSize member.
|
||||
Optional<int64_t> getByteSize(const DWARFUnit &U) const;
|
||||
std::optional<int64_t> getByteSize(const DWARFUnit &U) const;
|
||||
};
|
||||
using AttributeSpecVector = SmallVector<AttributeSpec, 8>;
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
///
|
||||
/// \param attr DWARF attribute to search for.
|
||||
/// \returns Optional index of the attribute if found, None otherwise.
|
||||
Optional<uint32_t> findAttributeIndex(dwarf::Attribute attr) const;
|
||||
std::optional<uint32_t> findAttributeIndex(dwarf::Attribute attr) const;
|
||||
|
||||
/// Extract a DWARF form value from a DIE specified by DIE offset.
|
||||
///
|
||||
|
@ -140,9 +140,9 @@ public:
|
|||
/// \param Attr DWARF attribute to search for.
|
||||
/// \param U the DWARFUnit the contains the DIE.
|
||||
/// \returns Optional DWARF form value if the attribute was extracted.
|
||||
Optional<DWARFFormValue> getAttributeValue(const uint64_t DIEOffset,
|
||||
const dwarf::Attribute Attr,
|
||||
const DWARFUnit &U) const;
|
||||
std::optional<DWARFFormValue> getAttributeValue(const uint64_t DIEOffset,
|
||||
const dwarf::Attribute Attr,
|
||||
const DWARFUnit &U) const;
|
||||
|
||||
/// Compute an offset from a DIE specified by DIE offset and attribute index.
|
||||
///
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
/// \param Offset offset of the attribute.
|
||||
/// \param U the DWARFUnit the contains the DIE.
|
||||
/// \returns Optional DWARF form value if the attribute was extracted.
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
getAttributeValueFromOffset(uint32_t AttrIndex, uint64_t Offset,
|
||||
const DWARFUnit &U) const;
|
||||
|
||||
|
@ -171,7 +171,7 @@ public:
|
|||
// Return an optional byte size of all attribute data in this abbreviation
|
||||
// if a constant byte size can be calculated given a DWARFUnit. This allows
|
||||
// DWARF parsing to be faster as many DWARF DIEs have a fixed byte size.
|
||||
Optional<size_t> getFixedAttributesByteSize(const DWARFUnit &U) const;
|
||||
std::optional<size_t> getFixedAttributesByteSize(const DWARFUnit &U) const;
|
||||
|
||||
private:
|
||||
void clear();
|
||||
|
@ -206,7 +206,7 @@ private:
|
|||
AttributeSpecVector AttributeSpecs;
|
||||
/// If this abbreviation has a fixed byte size then FixedAttributeSize member
|
||||
/// variable below will have a value.
|
||||
Optional<FixedSizeInfo> FixedAttributeSize;
|
||||
std::optional<FixedSizeInfo> FixedAttributeSize;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -53,12 +53,12 @@ public:
|
|||
/// Returns the Offset of the Compilation Unit associated with this
|
||||
/// Accelerator Entry or None if the Compilation Unit offset is not recorded
|
||||
/// in this Accelerator Entry.
|
||||
virtual Optional<uint64_t> getCUOffset() const = 0;
|
||||
virtual std::optional<uint64_t> getCUOffset() const = 0;
|
||||
|
||||
/// Returns the Tag of the Debug Info Entry associated with this
|
||||
/// Accelerator Entry or None if the Tag is not recorded in this
|
||||
/// Accelerator Entry.
|
||||
virtual Optional<dwarf::Tag> getTag() const = 0;
|
||||
virtual std::optional<dwarf::Tag> getTag() const = 0;
|
||||
|
||||
/// Returns the raw values of fields in the Accelerator Entry. In general,
|
||||
/// these can only be interpreted with the help of the metadata in the
|
||||
|
@ -99,7 +99,8 @@ class AppleAcceleratorTable : public DWARFAcceleratorTable {
|
|||
uint64_t DIEOffsetBase;
|
||||
SmallVector<std::pair<AtomType, Form>, 3> Atoms;
|
||||
|
||||
Optional<uint64_t> extractOffset(Optional<DWARFFormValue> Value) const;
|
||||
std::optional<uint64_t>
|
||||
extractOffset(std::optional<DWARFFormValue> Value) const;
|
||||
};
|
||||
|
||||
struct Header Hdr;
|
||||
|
@ -122,19 +123,19 @@ public:
|
|||
void extract(const AppleAcceleratorTable &AccelTable, uint64_t *Offset);
|
||||
|
||||
public:
|
||||
Optional<uint64_t> getCUOffset() const override;
|
||||
std::optional<uint64_t> getCUOffset() const override;
|
||||
|
||||
/// Returns the Section Offset of the Debug Info Entry associated with this
|
||||
/// Accelerator Entry or None if the DIE offset is not recorded in this
|
||||
/// Accelerator Entry. The returned offset is relative to the start of the
|
||||
/// Section containing the DIE.
|
||||
Optional<uint64_t> getDIESectionOffset() const;
|
||||
std::optional<uint64_t> getDIESectionOffset() const;
|
||||
|
||||
Optional<dwarf::Tag> getTag() const override;
|
||||
std::optional<dwarf::Tag> getTag() const override;
|
||||
|
||||
/// Returns the value of the Atom in this Accelerator Entry, if the Entry
|
||||
/// contains such Atom.
|
||||
Optional<DWARFFormValue> lookup(HeaderData::AtomType Atom) const;
|
||||
std::optional<DWARFFormValue> lookup(HeaderData::AtomType Atom) const;
|
||||
|
||||
friend class AppleAcceleratorTable;
|
||||
friend class ValueIterator;
|
||||
|
@ -287,8 +288,8 @@ public:
|
|||
Entry(const NameIndex &NameIdx, const Abbrev &Abbr);
|
||||
|
||||
public:
|
||||
Optional<uint64_t> getCUOffset() const override;
|
||||
Optional<dwarf::Tag> getTag() const override { return tag(); }
|
||||
std::optional<uint64_t> getCUOffset() const override;
|
||||
std::optional<dwarf::Tag> getTag() const override { return tag(); }
|
||||
|
||||
/// Returns the Index into the Compilation Unit list of the owning Name
|
||||
/// Index or None if this Accelerator Entry does not have an associated
|
||||
|
@ -298,14 +299,14 @@ public:
|
|||
/// just a single Compilation Unit are implicitly associated with that unit,
|
||||
/// so this function will return 0 even without an explicit
|
||||
/// DW_IDX_compile_unit attribute.
|
||||
Optional<uint64_t> getCUIndex() const;
|
||||
std::optional<uint64_t> getCUIndex() const;
|
||||
|
||||
/// .debug_names-specific getter, which always succeeds (DWARF v5 index
|
||||
/// entries always have a tag).
|
||||
dwarf::Tag tag() const { return Abbr->Tag; }
|
||||
|
||||
/// Returns the Offset of the DIE within the containing CU or TU.
|
||||
Optional<uint64_t> getDIEUnitOffset() const;
|
||||
std::optional<uint64_t> getDIEUnitOffset() const;
|
||||
|
||||
/// Return the Abbreviation that can be used to interpret the raw values of
|
||||
/// this Accelerator Entry.
|
||||
|
@ -313,7 +314,7 @@ public:
|
|||
|
||||
/// Returns the value of the Index Attribute in this Accelerator Entry, if
|
||||
/// the Entry contains such Attribute.
|
||||
Optional<DWARFFormValue> lookup(dwarf::Index Index) const;
|
||||
std::optional<DWARFFormValue> lookup(dwarf::Index Index) const;
|
||||
|
||||
void dump(ScopedPrinter &W) const;
|
||||
|
||||
|
@ -406,7 +407,7 @@ public:
|
|||
void dumpAbbreviations(ScopedPrinter &W) const;
|
||||
bool dumpEntry(ScopedPrinter &W, uint64_t *Offset) const;
|
||||
void dumpName(ScopedPrinter &W, const NameTableEntry &NTE,
|
||||
Optional<uint32_t> Hash) const;
|
||||
std::optional<uint32_t> Hash) const;
|
||||
void dumpBucket(ScopedPrinter &W, uint32_t Bucket) const;
|
||||
|
||||
Expected<AttributeEncoding> extractAttributeEncoding(uint64_t *Offset);
|
||||
|
@ -491,13 +492,13 @@ public:
|
|||
/// (searches all name indices).
|
||||
bool IsLocal;
|
||||
|
||||
Optional<Entry> CurrentEntry;
|
||||
std::optional<Entry> CurrentEntry;
|
||||
uint64_t DataOffset = 0; ///< Offset into the section.
|
||||
std::string Key; ///< The Key we are searching for.
|
||||
Optional<uint32_t> Hash; ///< Hash of Key, if it has been computed.
|
||||
std::optional<uint32_t> Hash; ///< Hash of Key, if it has been computed.
|
||||
|
||||
bool getEntryAtCurrentOffset();
|
||||
Optional<uint64_t> findEntryOffsetInCurrentIndex();
|
||||
std::optional<uint64_t> findEntryOffsetInCurrentIndex();
|
||||
bool findInCurrentIndex();
|
||||
void searchFromStartOfCurrentIndex();
|
||||
void next();
|
||||
|
|
|
@ -46,7 +46,7 @@ class DWARFUnitIndex;
|
|||
/// information parsing. The actual data is supplied through DWARFObj.
|
||||
class DWARFContext : public DIContext {
|
||||
DWARFUnitVector NormalUnits;
|
||||
Optional<DenseMap<uint64_t, DWARFTypeUnit*>> NormalTypeUnits;
|
||||
std::optional<DenseMap<uint64_t, DWARFTypeUnit *>> NormalTypeUnits;
|
||||
std::unique_ptr<DWARFUnitIndex> CUIndex;
|
||||
std::unique_ptr<DWARFGdbIndex> GdbIndex;
|
||||
std::unique_ptr<DWARFUnitIndex> TUIndex;
|
||||
|
@ -65,7 +65,7 @@ class DWARFContext : public DIContext {
|
|||
std::unique_ptr<AppleAcceleratorTable> AppleObjC;
|
||||
|
||||
DWARFUnitVector DWOUnits;
|
||||
Optional<DenseMap<uint64_t, DWARFTypeUnit*>> DWOTypeUnits;
|
||||
std::optional<DenseMap<uint64_t, DWARFTypeUnit *>> DWOTypeUnits;
|
||||
std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
|
||||
std::unique_ptr<DWARFDebugMacro> MacinfoDWO;
|
||||
std::unique_ptr<DWARFDebugMacro> MacroDWO;
|
||||
|
@ -132,10 +132,10 @@ public:
|
|||
/// Dump a textual representation to \p OS. If any \p DumpOffsets are present,
|
||||
/// dump only the record at the specified offset.
|
||||
void dump(raw_ostream &OS, DIDumpOptions DumpOpts,
|
||||
std::array<Optional<uint64_t>, DIDT_ID_Count> DumpOffsets);
|
||||
std::array<std::optional<uint64_t>, DIDT_ID_Count> DumpOffsets);
|
||||
|
||||
void dump(raw_ostream &OS, DIDumpOptions DumpOpts) override {
|
||||
std::array<Optional<uint64_t>, DIDT_ID_Count> DumpOffsets;
|
||||
std::array<std::optional<uint64_t>, DIDT_ID_Count> DumpOffsets;
|
||||
dump(OS, DumpOpts, DumpOffsets);
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ public:
|
|||
/// There is a DWARF encoding that uses a PC-relative adjustment.
|
||||
/// For these values, \p AbsPosOffset is used to fix them, which should
|
||||
/// reflect the absolute address of this pointer.
|
||||
Optional<uint64_t> getEncodedPointer(uint64_t *Offset, uint8_t Encoding,
|
||||
uint64_t AbsPosOffset = 0) const;
|
||||
std::optional<uint64_t> getEncodedPointer(uint64_t *Offset, uint8_t Encoding,
|
||||
uint64_t AbsPosOffset = 0) const;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -59,7 +59,7 @@ class DWARFDebugAbbrev {
|
|||
|
||||
mutable DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
|
||||
mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
|
||||
mutable Optional<DataExtractor> Data;
|
||||
mutable std::optional<DataExtractor> Data;
|
||||
|
||||
public:
|
||||
DWARFDebugAbbrev();
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
/// Return the full length of this table, including the length field.
|
||||
/// Return None if the length cannot be identified reliably.
|
||||
Optional<uint64_t> getFullLength() const;
|
||||
std::optional<uint64_t> getFullLength() const;
|
||||
|
||||
/// Return the DWARF format of this table.
|
||||
dwarf::DwarfFormat getFormat() const { return Format; }
|
||||
|
|
|
@ -67,10 +67,10 @@ private:
|
|||
Location Kind; /// The type of the location that describes how to unwind it.
|
||||
uint32_t RegNum; /// The register number for Kind == RegPlusOffset.
|
||||
int32_t Offset; /// The offset for Kind == CFAPlusOffset or RegPlusOffset.
|
||||
Optional<uint32_t> AddrSpace; /// The address space for Kind == RegPlusOffset
|
||||
/// for CFA.
|
||||
Optional<DWARFExpression> Expr; /// The DWARF expression for Kind ==
|
||||
/// DWARFExpression.
|
||||
std::optional<uint32_t> AddrSpace; /// The address space for Kind ==
|
||||
/// RegPlusOffset for CFA.
|
||||
std::optional<DWARFExpression> Expr; /// The DWARF expression for Kind ==
|
||||
/// DWARFExpression.
|
||||
bool Dereference; /// If true, the resulting location must be dereferenced
|
||||
/// after the location value is computed.
|
||||
|
||||
|
@ -80,8 +80,8 @@ private:
|
|||
: Kind(K), RegNum(InvalidRegisterNumber), Offset(0),
|
||||
AddrSpace(std::nullopt), Dereference(false) {}
|
||||
|
||||
UnwindLocation(Location K, uint32_t Reg, int32_t Off, Optional<uint32_t> AS,
|
||||
bool Deref)
|
||||
UnwindLocation(Location K, uint32_t Reg, int32_t Off,
|
||||
std::optional<uint32_t> AS, bool Deref)
|
||||
: Kind(K), RegNum(Reg), Offset(Off), AddrSpace(AS), Dereference(Deref) {}
|
||||
|
||||
UnwindLocation(DWARFExpression E, bool Deref)
|
||||
|
@ -117,10 +117,10 @@ public:
|
|||
/// false.
|
||||
static UnwindLocation
|
||||
createIsRegisterPlusOffset(uint32_t Reg, int32_t Off,
|
||||
Optional<uint32_t> AddrSpace = std::nullopt);
|
||||
std::optional<uint32_t> AddrSpace = std::nullopt);
|
||||
static UnwindLocation
|
||||
createAtRegisterPlusOffset(uint32_t Reg, int32_t Off,
|
||||
Optional<uint32_t> AddrSpace = std::nullopt);
|
||||
std::optional<uint32_t> AddrSpace = std::nullopt);
|
||||
/// Create a location whose value is the result of evaluating a DWARF
|
||||
/// expression. This allows complex expressions to be evaluated in order to
|
||||
/// unwind a register or CFA value.
|
||||
|
@ -149,7 +149,9 @@ public:
|
|||
// DW_CFA_AARCH64_negate_ra_state).
|
||||
void setConstant(int32_t Value) { Offset = Value; }
|
||||
|
||||
Optional<DWARFExpression> getDWARFExpressionBytes() const { return Expr; }
|
||||
std::optional<DWARFExpression> getDWARFExpressionBytes() const {
|
||||
return Expr;
|
||||
}
|
||||
/// Dump a location expression as text and use the register information if
|
||||
/// some is provided.
|
||||
///
|
||||
|
@ -187,7 +189,7 @@ public:
|
|||
///
|
||||
/// \returns A location if one is available for \a RegNum, or llvm::None
|
||||
/// otherwise.
|
||||
Optional<UnwindLocation> getRegisterLocation(uint32_t RegNum) const {
|
||||
std::optional<UnwindLocation> getRegisterLocation(uint32_t RegNum) const {
|
||||
auto Pos = Locations.find(RegNum);
|
||||
if (Pos == Locations.end())
|
||||
return std::nullopt;
|
||||
|
@ -253,7 +255,7 @@ raw_ostream &operator<<(raw_ostream &OS, const RegisterLocations &RL);
|
|||
class UnwindRow {
|
||||
/// The address will be valid when parsing the instructions in a FDE. If
|
||||
/// invalid, this object represents the initial instructions of a CIE.
|
||||
Optional<uint64_t> Address; ///< Address for row in FDE, invalid for CIE.
|
||||
std::optional<uint64_t> Address; ///< Address for row in FDE, invalid for CIE.
|
||||
UnwindLocation CFAValue; ///< How to unwind the Call Frame Address (CFA).
|
||||
RegisterLocations RegLocs; ///< How to unwind all registers in this list.
|
||||
|
||||
|
@ -373,7 +375,7 @@ private:
|
|||
RowContainer Rows;
|
||||
/// The end address when data is extracted from a FDE. This value will be
|
||||
/// invalid when a UnwindTable is extracted from a CIE.
|
||||
Optional<uint64_t> EndAddress;
|
||||
std::optional<uint64_t> EndAddress;
|
||||
|
||||
/// Parse the information in the CFIProgram and update the CurrRow object
|
||||
/// that the state machine describes.
|
||||
|
@ -416,7 +418,7 @@ public:
|
|||
uint8_t Opcode;
|
||||
Operands Ops;
|
||||
// Associated DWARF expression in case this instruction refers to one
|
||||
Optional<DWARFExpression> Expression;
|
||||
std::optional<DWARFExpression> Expression;
|
||||
|
||||
Expected<uint64_t> getOperandAsUnsigned(const CFIProgram &CFIP,
|
||||
uint32_t OperandIdx) const;
|
||||
|
@ -573,8 +575,8 @@ public:
|
|||
uint8_t SegmentDescriptorSize, uint64_t CodeAlignmentFactor,
|
||||
int64_t DataAlignmentFactor, uint64_t ReturnAddressRegister,
|
||||
SmallString<8> AugmentationData, uint32_t FDEPointerEncoding,
|
||||
uint32_t LSDAPointerEncoding, Optional<uint64_t> Personality,
|
||||
Optional<uint32_t> PersonalityEnc, Triple::ArchType Arch)
|
||||
uint32_t LSDAPointerEncoding, std::optional<uint64_t> Personality,
|
||||
std::optional<uint32_t> PersonalityEnc, Triple::ArchType Arch)
|
||||
: FrameEntry(FK_CIE, IsDWARF64, Offset, Length, CodeAlignmentFactor,
|
||||
DataAlignmentFactor, Arch),
|
||||
Version(Version), Augmentation(std::move(Augmentation)),
|
||||
|
@ -594,8 +596,10 @@ public:
|
|||
int64_t getDataAlignmentFactor() const { return DataAlignmentFactor; }
|
||||
uint8_t getVersion() const { return Version; }
|
||||
uint64_t getReturnAddressRegister() const { return ReturnAddressRegister; }
|
||||
Optional<uint64_t> getPersonalityAddress() const { return Personality; }
|
||||
Optional<uint32_t> getPersonalityEncoding() const { return PersonalityEnc; }
|
||||
std::optional<uint64_t> getPersonalityAddress() const { return Personality; }
|
||||
std::optional<uint32_t> getPersonalityEncoding() const {
|
||||
return PersonalityEnc;
|
||||
}
|
||||
|
||||
uint32_t getFDEPointerEncoding() const { return FDEPointerEncoding; }
|
||||
|
||||
|
@ -618,8 +622,8 @@ private:
|
|||
const SmallString<8> AugmentationData;
|
||||
const uint32_t FDEPointerEncoding;
|
||||
const uint32_t LSDAPointerEncoding;
|
||||
const Optional<uint64_t> Personality;
|
||||
const Optional<uint32_t> PersonalityEnc;
|
||||
const std::optional<uint64_t> Personality;
|
||||
const std::optional<uint32_t> PersonalityEnc;
|
||||
};
|
||||
|
||||
/// DWARF Frame Description Entry (FDE)
|
||||
|
@ -627,11 +631,10 @@ class FDE : public FrameEntry {
|
|||
public:
|
||||
FDE(bool IsDWARF64, uint64_t Offset, uint64_t Length, uint64_t CIEPointer,
|
||||
uint64_t InitialLocation, uint64_t AddressRange, CIE *Cie,
|
||||
Optional<uint64_t> LSDAAddress, Triple::ArchType Arch)
|
||||
std::optional<uint64_t> LSDAAddress, Triple::ArchType Arch)
|
||||
: FrameEntry(FK_FDE, IsDWARF64, Offset, Length,
|
||||
Cie ? Cie->getCodeAlignmentFactor() : 0,
|
||||
Cie ? Cie->getDataAlignmentFactor() : 0,
|
||||
Arch),
|
||||
Cie ? Cie->getDataAlignmentFactor() : 0, Arch),
|
||||
CIEPointer(CIEPointer), InitialLocation(InitialLocation),
|
||||
AddressRange(AddressRange), LinkedCIE(Cie), LSDAAddress(LSDAAddress) {}
|
||||
|
||||
|
@ -640,7 +643,7 @@ public:
|
|||
const CIE *getLinkedCIE() const { return LinkedCIE; }
|
||||
uint64_t getInitialLocation() const { return InitialLocation; }
|
||||
uint64_t getAddressRange() const { return AddressRange; }
|
||||
Optional<uint64_t> getLSDAAddress() const { return LSDAAddress; }
|
||||
std::optional<uint64_t> getLSDAAddress() const { return LSDAAddress; }
|
||||
|
||||
void dump(raw_ostream &OS, DIDumpOptions DumpOpts, const MCRegisterInfo *MRI,
|
||||
bool IsEH) const override;
|
||||
|
@ -656,7 +659,7 @@ private:
|
|||
const uint64_t InitialLocation;
|
||||
const uint64_t AddressRange;
|
||||
const CIE *LinkedCIE;
|
||||
const Optional<uint64_t> LSDAAddress;
|
||||
const std::optional<uint64_t> LSDAAddress;
|
||||
};
|
||||
|
||||
} // end namespace dwarf
|
||||
|
@ -686,7 +689,7 @@ public:
|
|||
|
||||
/// Dump the section data into the given stream.
|
||||
void dump(raw_ostream &OS, DIDumpOptions DumpOpts, const MCRegisterInfo *MRI,
|
||||
Optional<uint64_t> Offset) const;
|
||||
std::optional<uint64_t> Offset) const;
|
||||
|
||||
/// Parse the section from raw data. \p Data is assumed to contain the whole
|
||||
/// frame section contents to be parsed.
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
uint64_t getOffset() const { return Offset; }
|
||||
|
||||
/// Returns index of the parent die.
|
||||
Optional<uint32_t> getParentIdx() const {
|
||||
std::optional<uint32_t> getParentIdx() const {
|
||||
if (ParentIdx == UINT32_MAX)
|
||||
return std::nullopt;
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
}
|
||||
|
||||
/// Returns index of the sibling die.
|
||||
Optional<uint32_t> getSiblingIdx() const {
|
||||
std::optional<uint32_t> getSiblingIdx() const {
|
||||
if (SiblingIdx == 0)
|
||||
return std::nullopt;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLINE_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLINE_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
|
@ -114,7 +113,7 @@ public:
|
|||
|
||||
bool hasFileAtIndex(uint64_t FileIndex) const;
|
||||
|
||||
Optional<uint64_t> getLastValidFileIndex() const;
|
||||
std::optional<uint64_t> getLastValidFileIndex() const;
|
||||
|
||||
bool
|
||||
getFileNameByIndex(uint64_t FileIndex, StringRef CompDir,
|
||||
|
@ -246,7 +245,7 @@ public:
|
|||
return Prologue.hasFileAtIndex(FileIndex);
|
||||
}
|
||||
|
||||
Optional<uint64_t> getLastValidFileIndex() const {
|
||||
std::optional<uint64_t> getLastValidFileIndex() const {
|
||||
return Prologue.getLastValidFileIndex();
|
||||
}
|
||||
|
||||
|
@ -294,7 +293,7 @@ public:
|
|||
private:
|
||||
uint32_t findRowInSeq(const DWARFDebugLine::Sequence &Seq,
|
||||
object::SectionedAddress Address) const;
|
||||
Optional<StringRef>
|
||||
std::optional<StringRef>
|
||||
getSourceByIndex(uint64_t FileIndex,
|
||||
DILineInfoSpecifier::FileLineInfoKind Kind) const;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
|
||||
#include "llvm/Support/Errc.h"
|
||||
|
@ -66,14 +65,15 @@ public:
|
|||
/// can attempt to parse another list after the current one (\p Offset will be
|
||||
/// updated to point past the end of the current list).
|
||||
bool dumpLocationList(uint64_t *Offset, raw_ostream &OS,
|
||||
Optional<object::SectionedAddress> BaseAddr,
|
||||
std::optional<object::SectionedAddress> BaseAddr,
|
||||
const MCRegisterInfo *MRI, const DWARFObject &Obj,
|
||||
DWARFUnit *U, DIDumpOptions DumpOpts,
|
||||
unsigned Indent) const;
|
||||
|
||||
Error visitAbsoluteLocationList(
|
||||
uint64_t Offset, Optional<object::SectionedAddress> BaseAddr,
|
||||
std::function<Optional<object::SectionedAddress>(uint32_t)> LookupAddr,
|
||||
uint64_t Offset, std::optional<object::SectionedAddress> BaseAddr,
|
||||
std::function<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupAddr,
|
||||
function_ref<bool(Expected<DWARFLocationExpression>)> Callback) const;
|
||||
|
||||
const DWARFDataExtractor &getData() { return Data; }
|
||||
|
@ -111,7 +111,7 @@ public:
|
|||
/// Print the location lists found within the debug_loc section.
|
||||
void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo,
|
||||
const DWARFObject &Obj, DIDumpOptions DumpOpts,
|
||||
Optional<uint64_t> Offset) const;
|
||||
std::optional<uint64_t> Offset) const;
|
||||
|
||||
Error visitLocationList(
|
||||
uint64_t *Offset,
|
||||
|
|
|
@ -125,8 +125,8 @@ public:
|
|||
private:
|
||||
/// Parse the debug_macinfo/debug_macro section accessible via the 'MacroData'
|
||||
/// parameter.
|
||||
Error parseImpl(Optional<DWARFUnitVector::compile_unit_range> Units,
|
||||
Optional<DataExtractor> StringExtractor,
|
||||
Error parseImpl(std::optional<DWARFUnitVector::compile_unit_range> Units,
|
||||
std::optional<DataExtractor> StringExtractor,
|
||||
DWARFDataExtractor Data, bool IsMacro);
|
||||
};
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
/// list. Has to be passed base address of the compile unit referencing this
|
||||
/// range list.
|
||||
DWARFAddressRangesVector
|
||||
getAbsoluteRanges(llvm::Optional<object::SectionedAddress> BaseAddr) const;
|
||||
getAbsoluteRanges(std::optional<object::SectionedAddress> BaseAddr) const;
|
||||
};
|
||||
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGRNGLISTS_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFDEBUGRNGLISTS_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/STLFunctionalExtras.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
|
||||
|
@ -37,10 +36,11 @@ struct RangeListEntry : public DWARFListEntryBase {
|
|||
uint64_t Value1;
|
||||
|
||||
Error extract(DWARFDataExtractor Data, uint64_t *OffsetPtr);
|
||||
void dump(raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength,
|
||||
uint64_t &CurrentBase, DIDumpOptions DumpOpts,
|
||||
llvm::function_ref<Optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress) const;
|
||||
void
|
||||
dump(raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength,
|
||||
uint64_t &CurrentBase, DIDumpOptions DumpOpts,
|
||||
llvm::function_ref<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress) const;
|
||||
bool isSentinel() const { return EntryKind == dwarf::DW_RLE_end_of_list; }
|
||||
};
|
||||
|
||||
|
@ -48,15 +48,14 @@ struct RangeListEntry : public DWARFListEntryBase {
|
|||
class DWARFDebugRnglist : public DWARFListType<RangeListEntry> {
|
||||
public:
|
||||
/// Build a DWARFAddressRangesVector from a rangelist.
|
||||
DWARFAddressRangesVector
|
||||
getAbsoluteRanges(Optional<object::SectionedAddress> BaseAddr,
|
||||
uint8_t AddressByteSize,
|
||||
function_ref<Optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress) const;
|
||||
DWARFAddressRangesVector getAbsoluteRanges(
|
||||
std::optional<object::SectionedAddress> BaseAddr, uint8_t AddressByteSize,
|
||||
function_ref<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress) const;
|
||||
|
||||
/// Build a DWARFAddressRangesVector from a rangelist.
|
||||
DWARFAddressRangesVector
|
||||
getAbsoluteRanges(llvm::Optional<object::SectionedAddress> BaseAddr,
|
||||
getAbsoluteRanges(std::optional<object::SectionedAddress> BaseAddr,
|
||||
DWARFUnit &U) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define LLVM_DEBUGINFO_DWARF_DWARFDIE_H
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/ADT/iterator_range.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
|
@ -139,7 +138,7 @@ public:
|
|||
/// \param Attr the attribute to extract.
|
||||
/// \returns an optional DWARFFormValue that will have the form value if the
|
||||
/// attribute was successfully extracted.
|
||||
Optional<DWARFFormValue> find(dwarf::Attribute Attr) const;
|
||||
std::optional<DWARFFormValue> find(dwarf::Attribute Attr) const;
|
||||
|
||||
/// Extract the first value of any attribute in Attrs from this DIE.
|
||||
///
|
||||
|
@ -152,7 +151,7 @@ public:
|
|||
/// \returns an optional that has a valid DWARFFormValue for the first
|
||||
/// matching attribute in Attrs, or None if none of the attributes in Attrs
|
||||
/// exist in this DIE.
|
||||
Optional<DWARFFormValue> find(ArrayRef<dwarf::Attribute> Attrs) const;
|
||||
std::optional<DWARFFormValue> find(ArrayRef<dwarf::Attribute> Attrs) const;
|
||||
|
||||
/// Extract the first value of any attribute in Attrs from this DIE and
|
||||
/// recurse into any DW_AT_specification or DW_AT_abstract_origin referenced
|
||||
|
@ -163,7 +162,7 @@ public:
|
|||
/// matching attribute in Attrs, or None if none of the attributes in Attrs
|
||||
/// exist in this DIE or in any DW_AT_specification or DW_AT_abstract_origin
|
||||
/// DIEs.
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
findRecursively(ArrayRef<dwarf::Attribute> Attrs) const;
|
||||
|
||||
/// Extract the specified attribute from this DIE as the referenced DIE.
|
||||
|
@ -190,8 +189,8 @@ public:
|
|||
/// or DW_AT_GNU_ranges_base attribute.
|
||||
///
|
||||
/// \returns anm optional absolute section offset value for the attribute.
|
||||
Optional<uint64_t> getRangesBaseAttribute() const;
|
||||
Optional<uint64_t> getLocBaseAttribute() const;
|
||||
std::optional<uint64_t> getRangesBaseAttribute() const;
|
||||
std::optional<uint64_t> getLocBaseAttribute() const;
|
||||
|
||||
/// Get the DW_AT_high_pc attribute value as an address.
|
||||
///
|
||||
|
@ -203,7 +202,7 @@ public:
|
|||
///
|
||||
/// \param LowPC the low PC that might be needed to calculate the high PC.
|
||||
/// \returns an optional address value for the attribute.
|
||||
Optional<uint64_t> getHighPC(uint64_t LowPC) const;
|
||||
std::optional<uint64_t> getHighPC(uint64_t LowPC) const;
|
||||
|
||||
/// Retrieves DW_AT_low_pc and DW_AT_high_pc from CU.
|
||||
/// Returns true if both attributes are present.
|
||||
|
@ -285,7 +284,7 @@ public:
|
|||
/// \param PointerSize the pointer size of the containing CU.
|
||||
/// \returns if this is a type DIE, or this DIE contains a DW_AT_type, returns
|
||||
/// the size of the type.
|
||||
Optional<uint64_t> getTypeSize(uint64_t PointerSize);
|
||||
std::optional<uint64_t> getTypeSize(uint64_t PointerSize);
|
||||
|
||||
class iterator;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFEXPRESSION_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFEXPRESSION_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
|
@ -102,7 +101,7 @@ public:
|
|||
|
||||
private:
|
||||
bool extract(DataExtractor Data, uint8_t AddressSize, uint64_t Offset,
|
||||
Optional<dwarf::DwarfFormat> Format);
|
||||
std::optional<dwarf::DwarfFormat> Format);
|
||||
};
|
||||
|
||||
/// An iterator to go through the expression operations.
|
||||
|
@ -140,7 +139,7 @@ public:
|
|||
};
|
||||
|
||||
DWARFExpression(DataExtractor Data, uint8_t AddressSize,
|
||||
Optional<dwarf::DwarfFormat> Format = std::nullopt)
|
||||
std::optional<dwarf::DwarfFormat> Format = std::nullopt)
|
||||
: Data(Data), AddressSize(AddressSize), Format(Format) {
|
||||
assert(AddressSize == 8 || AddressSize == 4 || AddressSize == 2);
|
||||
}
|
||||
|
@ -172,7 +171,7 @@ public:
|
|||
private:
|
||||
DataExtractor Data;
|
||||
uint8_t AddressSize;
|
||||
Optional<dwarf::DwarfFormat> Format;
|
||||
std::optional<dwarf::DwarfFormat> Format;
|
||||
};
|
||||
|
||||
inline bool operator==(const DWARFExpression::iterator &LHS,
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/None.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/BinaryFormat/Dwarf.h"
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
#include "llvm/Support/DataExtractor.h"
|
||||
|
@ -106,21 +105,21 @@ public:
|
|||
|
||||
/// getAsFoo functions below return the extracted value as Foo if only
|
||||
/// DWARFFormValue has form class is suitable for representing Foo.
|
||||
Optional<uint64_t> getAsReference() const;
|
||||
std::optional<uint64_t> getAsReference() const;
|
||||
struct UnitOffset {
|
||||
DWARFUnit *Unit;
|
||||
uint64_t Offset;
|
||||
};
|
||||
Optional<UnitOffset> getAsRelativeReference() const;
|
||||
Optional<uint64_t> getAsUnsignedConstant() const;
|
||||
Optional<int64_t> getAsSignedConstant() const;
|
||||
std::optional<UnitOffset> getAsRelativeReference() const;
|
||||
std::optional<uint64_t> getAsUnsignedConstant() const;
|
||||
std::optional<int64_t> getAsSignedConstant() const;
|
||||
Expected<const char *> getAsCString() const;
|
||||
Optional<uint64_t> getAsAddress() const;
|
||||
Optional<object::SectionedAddress> getAsSectionedAddress() const;
|
||||
Optional<uint64_t> getAsSectionOffset() const;
|
||||
Optional<ArrayRef<uint8_t>> getAsBlock() const;
|
||||
Optional<uint64_t> getAsCStringOffset() const;
|
||||
Optional<uint64_t> getAsReferenceUVal() const;
|
||||
std::optional<uint64_t> getAsAddress() const;
|
||||
std::optional<object::SectionedAddress> getAsSectionedAddress() const;
|
||||
std::optional<uint64_t> getAsSectionOffset() const;
|
||||
std::optional<ArrayRef<uint8_t>> getAsBlock() const;
|
||||
std::optional<uint64_t> getAsCStringOffset() const;
|
||||
std::optional<uint64_t> getAsReferenceUVal() const;
|
||||
/// Correctly extract any file paths from a form value.
|
||||
///
|
||||
/// These attributes can be in the from DW_AT_decl_file or DW_AT_call_file
|
||||
|
@ -132,7 +131,7 @@ public:
|
|||
///
|
||||
/// \returns A valid string value on success, or llvm::None if the form class
|
||||
/// is not FC_Constant, or if the file index is not valid.
|
||||
Optional<std::string>
|
||||
std::optional<std::string>
|
||||
getAsFile(DILineInfoSpecifier::FileLineInfoKind Kind) const;
|
||||
|
||||
/// Skip a form's value in \p DebugInfoData at the offset specified by
|
||||
|
@ -174,7 +173,8 @@ namespace dwarf {
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and was a string.
|
||||
inline Optional<const char *> toString(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<const char *>
|
||||
toString(const std::optional<DWARFFormValue> &V) {
|
||||
if (!V)
|
||||
return std::nullopt;
|
||||
Expected<const char*> E = V->getAsCString();
|
||||
|
@ -190,7 +190,7 @@ inline Optional<const char *> toString(const Optional<DWARFFormValue> &V) {
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and was a string.
|
||||
inline StringRef toStringRef(const Optional<DWARFFormValue> &V,
|
||||
inline StringRef toStringRef(const std::optional<DWARFFormValue> &V,
|
||||
StringRef Default = {}) {
|
||||
if (!V)
|
||||
return Default;
|
||||
|
@ -210,7 +210,7 @@ inline StringRef toStringRef(const Optional<DWARFFormValue> &V,
|
|||
/// \param Default the default value to return in case of failure.
|
||||
/// \returns the string value or Default if the V doesn't have a value or the
|
||||
/// form value's encoding wasn't a string.
|
||||
inline const char *toString(const Optional<DWARFFormValue> &V,
|
||||
inline const char *toString(const std::optional<DWARFFormValue> &V,
|
||||
const char *Default) {
|
||||
if (auto E = toString(V))
|
||||
return *E;
|
||||
|
@ -222,7 +222,8 @@ inline const char *toString(const Optional<DWARFFormValue> &V,
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and has a unsigned constant form.
|
||||
inline Optional<uint64_t> toUnsigned(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<uint64_t>
|
||||
toUnsigned(const std::optional<DWARFFormValue> &V) {
|
||||
if (V)
|
||||
return V->getAsUnsignedConstant();
|
||||
return std::nullopt;
|
||||
|
@ -234,7 +235,7 @@ inline Optional<uint64_t> toUnsigned(const Optional<DWARFFormValue> &V) {
|
|||
/// \param Default the default value to return in case of failure.
|
||||
/// \returns the extracted unsigned value or Default if the V doesn't have a
|
||||
/// value or the form value's encoding wasn't an unsigned constant form.
|
||||
inline uint64_t toUnsigned(const Optional<DWARFFormValue> &V,
|
||||
inline uint64_t toUnsigned(const std::optional<DWARFFormValue> &V,
|
||||
uint64_t Default) {
|
||||
return toUnsigned(V).value_or(Default);
|
||||
}
|
||||
|
@ -244,7 +245,8 @@ inline uint64_t toUnsigned(const Optional<DWARFFormValue> &V,
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and has a reference form.
|
||||
inline Optional<uint64_t> toReference(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<uint64_t>
|
||||
toReference(const std::optional<DWARFFormValue> &V) {
|
||||
if (V)
|
||||
return V->getAsReference();
|
||||
return std::nullopt;
|
||||
|
@ -256,7 +258,7 @@ inline Optional<uint64_t> toReference(const Optional<DWARFFormValue> &V) {
|
|||
/// \param Default the default value to return in case of failure.
|
||||
/// \returns the extracted reference value or Default if the V doesn't have a
|
||||
/// value or the form value's encoding wasn't a reference form.
|
||||
inline uint64_t toReference(const Optional<DWARFFormValue> &V,
|
||||
inline uint64_t toReference(const std::optional<DWARFFormValue> &V,
|
||||
uint64_t Default) {
|
||||
return toReference(V).value_or(Default);
|
||||
}
|
||||
|
@ -266,7 +268,7 @@ inline uint64_t toReference(const Optional<DWARFFormValue> &V,
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and has a signed constant form.
|
||||
inline Optional<int64_t> toSigned(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<int64_t> toSigned(const std::optional<DWARFFormValue> &V) {
|
||||
if (V)
|
||||
return V->getAsSignedConstant();
|
||||
return std::nullopt;
|
||||
|
@ -278,7 +280,8 @@ inline Optional<int64_t> toSigned(const Optional<DWARFFormValue> &V) {
|
|||
/// \param Default the default value to return in case of failure.
|
||||
/// \returns the extracted signed integer value or Default if the V doesn't
|
||||
/// have a value or the form value's encoding wasn't a signed integer form.
|
||||
inline int64_t toSigned(const Optional<DWARFFormValue> &V, int64_t Default) {
|
||||
inline int64_t toSigned(const std::optional<DWARFFormValue> &V,
|
||||
int64_t Default) {
|
||||
return toSigned(V).value_or(Default);
|
||||
}
|
||||
|
||||
|
@ -287,14 +290,15 @@ inline int64_t toSigned(const Optional<DWARFFormValue> &V, int64_t Default) {
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and has a address form.
|
||||
inline Optional<uint64_t> toAddress(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<uint64_t>
|
||||
toAddress(const std::optional<DWARFFormValue> &V) {
|
||||
if (V)
|
||||
return V->getAsAddress();
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
inline Optional<object::SectionedAddress>
|
||||
toSectionedAddress(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<object::SectionedAddress>
|
||||
toSectionedAddress(const std::optional<DWARFFormValue> &V) {
|
||||
if (V)
|
||||
return V->getAsSectionedAddress();
|
||||
return std::nullopt;
|
||||
|
@ -306,7 +310,8 @@ toSectionedAddress(const Optional<DWARFFormValue> &V) {
|
|||
/// \param Default the default value to return in case of failure.
|
||||
/// \returns the extracted address value or Default if the V doesn't have a
|
||||
/// value or the form value's encoding wasn't an address form.
|
||||
inline uint64_t toAddress(const Optional<DWARFFormValue> &V, uint64_t Default) {
|
||||
inline uint64_t toAddress(const std::optional<DWARFFormValue> &V,
|
||||
uint64_t Default) {
|
||||
return toAddress(V).value_or(Default);
|
||||
}
|
||||
|
||||
|
@ -315,7 +320,8 @@ inline uint64_t toAddress(const Optional<DWARFFormValue> &V, uint64_t Default) {
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and has a section offset form.
|
||||
inline Optional<uint64_t> toSectionOffset(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<uint64_t>
|
||||
toSectionOffset(const std::optional<DWARFFormValue> &V) {
|
||||
if (V)
|
||||
return V->getAsSectionOffset();
|
||||
return std::nullopt;
|
||||
|
@ -327,7 +333,7 @@ inline Optional<uint64_t> toSectionOffset(const Optional<DWARFFormValue> &V) {
|
|||
/// \param Default the default value to return in case of failure.
|
||||
/// \returns the extracted section offset value or Default if the V doesn't
|
||||
/// have a value or the form value's encoding wasn't a section offset form.
|
||||
inline uint64_t toSectionOffset(const Optional<DWARFFormValue> &V,
|
||||
inline uint64_t toSectionOffset(const std::optional<DWARFFormValue> &V,
|
||||
uint64_t Default) {
|
||||
return toSectionOffset(V).value_or(Default);
|
||||
}
|
||||
|
@ -337,7 +343,8 @@ inline uint64_t toSectionOffset(const Optional<DWARFFormValue> &V,
|
|||
/// \param V and optional DWARFFormValue to attempt to extract the value from.
|
||||
/// \returns an optional value that contains a value if the form value
|
||||
/// was valid and has a block form.
|
||||
inline Optional<ArrayRef<uint8_t>> toBlock(const Optional<DWARFFormValue> &V) {
|
||||
inline std::optional<ArrayRef<uint8_t>>
|
||||
toBlock(const std::optional<DWARFFormValue> &V) {
|
||||
if (V)
|
||||
return V->getAsBlock();
|
||||
return std::nullopt;
|
||||
|
|
|
@ -112,17 +112,18 @@ public:
|
|||
|
||||
void dump(DataExtractor Data, raw_ostream &OS,
|
||||
DIDumpOptions DumpOpts = {}) const;
|
||||
Optional<uint64_t> getOffsetEntry(DataExtractor Data, uint32_t Index) const {
|
||||
std::optional<uint64_t> getOffsetEntry(DataExtractor Data,
|
||||
uint32_t Index) const {
|
||||
if (Index >= HeaderData.OffsetEntryCount)
|
||||
return std::nullopt;
|
||||
|
||||
return getOffsetEntry(Data, getHeaderOffset() + getHeaderSize(Format), Format, Index);
|
||||
}
|
||||
|
||||
static Optional<uint64_t> getOffsetEntry(DataExtractor Data,
|
||||
uint64_t OffsetTableOffset,
|
||||
dwarf::DwarfFormat Format,
|
||||
uint32_t Index) {
|
||||
static std::optional<uint64_t> getOffsetEntry(DataExtractor Data,
|
||||
uint64_t OffsetTableOffset,
|
||||
dwarf::DwarfFormat Format,
|
||||
uint32_t Index) {
|
||||
uint8_t OffsetByteSize = Format == dwarf::DWARF64 ? 8 : 4;
|
||||
uint64_t Offset = OffsetTableOffset + OffsetByteSize * Index;
|
||||
auto R = Data.getUnsigned(&Offset, OffsetByteSize);
|
||||
|
@ -178,13 +179,15 @@ public:
|
|||
uint32_t getOffsetEntryCount() const { return Header.getOffsetEntryCount(); }
|
||||
dwarf::DwarfFormat getFormat() const { return Header.getFormat(); }
|
||||
|
||||
void dump(DWARFDataExtractor Data, raw_ostream &OS,
|
||||
llvm::function_ref<Optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress,
|
||||
DIDumpOptions DumpOpts = {}) const;
|
||||
void
|
||||
dump(DWARFDataExtractor Data, raw_ostream &OS,
|
||||
llvm::function_ref<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress,
|
||||
DIDumpOptions DumpOpts = {}) const;
|
||||
|
||||
/// Return the contents of the offset entry designated by a given index.
|
||||
Optional<uint64_t> getOffsetEntry(DataExtractor Data, uint32_t Index) const {
|
||||
std::optional<uint64_t> getOffsetEntry(DataExtractor Data,
|
||||
uint32_t Index) const {
|
||||
return Header.getOffsetEntry(Data, Index);
|
||||
}
|
||||
/// Return the size of the table header including the length but not including
|
||||
|
@ -250,7 +253,7 @@ Error DWARFListType<ListEntryType>::extract(DWARFDataExtractor Data,
|
|||
template <typename DWARFListType>
|
||||
void DWARFListTableBase<DWARFListType>::dump(
|
||||
DWARFDataExtractor Data, raw_ostream &OS,
|
||||
llvm::function_ref<Optional<object::SectionedAddress>(uint32_t)>
|
||||
llvm::function_ref<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress,
|
||||
DIDumpOptions DumpOpts) const {
|
||||
Header.dump(Data, OS, DumpOpts);
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFLOCATIONEXPRESSION_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
|
||||
|
||||
namespace llvm {
|
||||
|
@ -23,7 +22,7 @@ struct DWARFLocationExpression {
|
|||
/// The address range in which this expression is valid. None denotes a
|
||||
/// default entry which is valid in addresses not covered by other location
|
||||
/// expressions, or everywhere if there are no other expressions.
|
||||
Optional<DWARFAddressRange> Range;
|
||||
std::optional<DWARFAddressRange> Range;
|
||||
|
||||
/// The expression itself.
|
||||
SmallVector<uint8_t, 4> Expr;
|
||||
|
|
|
@ -22,7 +22,7 @@ struct RelocAddrEntry {
|
|||
uint64_t SectionIndex;
|
||||
object::RelocationRef Reloc;
|
||||
uint64_t SymbolValue;
|
||||
Optional<object::RelocationRef> Reloc2;
|
||||
std::optional<object::RelocationRef> Reloc2;
|
||||
uint64_t SymbolValue2;
|
||||
object::RelocationResolver Resolver;
|
||||
};
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define LLVM_DEBUGINFO_DWARF_DWARFUNIT_H
|
||||
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
@ -64,7 +63,7 @@ class DWARFUnitHeader {
|
|||
uint64_t TypeOffset = 0;
|
||||
|
||||
// For v5 split or skeleton compile units only.
|
||||
Optional<uint64_t> DWOId;
|
||||
std::optional<uint64_t> DWOId;
|
||||
|
||||
// Unit type as parsed, or derived from the section kind.
|
||||
uint8_t UnitType = 0;
|
||||
|
@ -93,7 +92,7 @@ public:
|
|||
}
|
||||
uint64_t getLength() const { return Length; }
|
||||
uint64_t getAbbrOffset() const { return AbbrOffset; }
|
||||
Optional<uint64_t> getDWOId() const { return DWOId; }
|
||||
std::optional<uint64_t> getDWOId() const { return DWOId; }
|
||||
void setDWOId(uint64_t Id) {
|
||||
assert((!DWOId || *DWOId == Id) && "setting DWOId to a different value");
|
||||
DWOId = Id;
|
||||
|
@ -223,17 +222,18 @@ class DWARFUnit {
|
|||
const DWARFSection &StringOffsetSection;
|
||||
const DWARFSection *AddrOffsetSection;
|
||||
DWARFUnit *SU;
|
||||
Optional<uint64_t> AddrOffsetSectionBase;
|
||||
std::optional<uint64_t> AddrOffsetSectionBase;
|
||||
bool IsLittleEndian;
|
||||
bool IsDWO;
|
||||
const DWARFUnitVector &UnitVector;
|
||||
|
||||
/// Start, length, and DWARF format of the unit's contribution to the string
|
||||
/// offsets table (DWARF v5).
|
||||
Optional<StrOffsetsContributionDescriptor> StringOffsetsTableContribution;
|
||||
std::optional<StrOffsetsContributionDescriptor>
|
||||
StringOffsetsTableContribution;
|
||||
|
||||
mutable const DWARFAbbreviationDeclarationSet *Abbrevs;
|
||||
llvm::Optional<object::SectionedAddress> BaseAddr;
|
||||
std::optional<object::SectionedAddress> BaseAddr;
|
||||
/// The compile unit debug information entry items.
|
||||
std::vector<DWARFDebugInfoEntry> DieArray;
|
||||
|
||||
|
@ -287,14 +287,14 @@ protected:
|
|||
/// Find the unit's contribution to the string offsets table and determine its
|
||||
/// length and form. The given offset is expected to be derived from the unit
|
||||
/// DIE's DW_AT_str_offsets_base attribute.
|
||||
Expected<Optional<StrOffsetsContributionDescriptor>>
|
||||
Expected<std::optional<StrOffsetsContributionDescriptor>>
|
||||
determineStringOffsetsTableContribution(DWARFDataExtractor &DA);
|
||||
|
||||
/// Find the unit's contribution to the string offsets table and determine its
|
||||
/// length and form. The given offset is expected to be 0 in a dwo file or,
|
||||
/// in a dwp file, the start of the unit's contribution to the string offsets
|
||||
/// table section (as determined by the index table).
|
||||
Expected<Optional<StrOffsetsContributionDescriptor>>
|
||||
Expected<std::optional<StrOffsetsContributionDescriptor>>
|
||||
determineStringOffsetsTableContributionDWO(DWARFDataExtractor &DA);
|
||||
|
||||
public:
|
||||
|
@ -346,7 +346,7 @@ public:
|
|||
AddrOffsetSectionBase = Base;
|
||||
}
|
||||
|
||||
Optional<uint64_t> getAddrOffsetSectionBase() const {
|
||||
std::optional<uint64_t> getAddrOffsetSectionBase() const {
|
||||
return AddrOffsetSectionBase;
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ public:
|
|||
return LocSectionBase;
|
||||
}
|
||||
|
||||
Optional<object::SectionedAddress>
|
||||
std::optional<object::SectionedAddress>
|
||||
getAddrOffsetSectionItem(uint32_t Index) const;
|
||||
Expected<uint64_t> getStringOffsetSectionItem(uint32_t Index) const;
|
||||
|
||||
|
@ -385,7 +385,7 @@ public:
|
|||
DWARFDebugRangeList &RangeList) const;
|
||||
void clear();
|
||||
|
||||
const Optional<StrOffsetsContributionDescriptor> &
|
||||
const std::optional<StrOffsetsContributionDescriptor> &
|
||||
getStringOffsetsTableContribution() const {
|
||||
return StringOffsetsTableContribution;
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
llvm::Optional<object::SectionedAddress> getBaseAddress();
|
||||
std::optional<object::SectionedAddress> getBaseAddress();
|
||||
|
||||
DWARFDie getUnitDIE(bool ExtractUnitDIEOnly = true) {
|
||||
extractDIEsIfNeeded(ExtractUnitDIEOnly);
|
||||
|
@ -438,7 +438,7 @@ public:
|
|||
}
|
||||
|
||||
const char *getCompilationDir();
|
||||
Optional<uint64_t> getDWOId() {
|
||||
std::optional<uint64_t> getDWOId() {
|
||||
extractDIEsIfNeeded(/*CUDieOnly*/ true);
|
||||
return getHeader().getDWOId();
|
||||
}
|
||||
|
@ -456,9 +456,9 @@ public:
|
|||
/// Return a rangelist's offset based on an index. The index designates
|
||||
/// an entry in the rangelist table's offset array and is supplied by
|
||||
/// DW_FORM_rnglistx.
|
||||
Optional<uint64_t> getRnglistOffset(uint32_t Index);
|
||||
std::optional<uint64_t> getRnglistOffset(uint32_t Index);
|
||||
|
||||
Optional<uint64_t> getLoclistOffset(uint32_t Index);
|
||||
std::optional<uint64_t> getLoclistOffset(uint32_t Index);
|
||||
|
||||
Expected<DWARFAddressRangesVector> collectAddressRanges();
|
||||
|
||||
|
@ -514,7 +514,7 @@ public:
|
|||
/// Return the DIE object for a given offset \p Offset inside the
|
||||
/// unit's DIE vector.
|
||||
DWARFDie getDIEForOffset(uint64_t Offset) {
|
||||
if (Optional<uint32_t> DieIdx = getDIEIndexForOffset(Offset))
|
||||
if (std::optional<uint32_t> DieIdx = getDIEIndexForOffset(Offset))
|
||||
return DWARFDie(this, &DieArray[*DieIdx]);
|
||||
|
||||
return DWARFDie();
|
||||
|
@ -522,7 +522,7 @@ public:
|
|||
|
||||
/// Return the DIE index for a given offset \p Offset inside the
|
||||
/// unit's DIE vector.
|
||||
Optional<uint32_t> getDIEIndexForOffset(uint64_t Offset) {
|
||||
std::optional<uint32_t> getDIEIndexForOffset(uint64_t Offset) {
|
||||
extractDIEsIfNeeded(false);
|
||||
auto It =
|
||||
llvm::partition_point(DieArray, [=](const DWARFDebugInfoEntry &DIE) {
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_DWARF_DWARFVERIFIER_H
|
||||
#define LLVM_DEBUGINFO_DWARF_DWARFVERIFIER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/DIContext.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
|
||||
#include "llvm/DebugInfo/DWARF/DWARFAddressRange.h"
|
||||
|
@ -60,7 +59,7 @@ public:
|
|||
/// This is used for finding overlapping ranges in the DW_AT_ranges
|
||||
/// attribute of a DIE. It is also used as a set of address ranges that
|
||||
/// children address ranges must all be contained in.
|
||||
Optional<DWARFAddressRange> insert(const DWARFAddressRange &R);
|
||||
std::optional<DWARFAddressRange> insert(const DWARFAddressRange &R);
|
||||
|
||||
/// Inserts the address range info. If any of its ranges overlaps with a
|
||||
/// range in an existing range info, the range info is *not* added and an
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_GSYM_FUNCTIONINFO_H
|
||||
#define LLVM_DEBUGINFO_GSYM_FUNCTIONINFO_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/GSYM/ExtractRanges.h"
|
||||
#include "llvm/DebugInfo/GSYM/InlineInfo.h"
|
||||
#include "llvm/DebugInfo/GSYM/LineTable.h"
|
||||
|
@ -89,8 +88,8 @@ class GsymReader;
|
|||
struct FunctionInfo {
|
||||
AddressRange Range;
|
||||
uint32_t Name; ///< String table offset in the string table.
|
||||
llvm::Optional<LineTable> OptLineTable;
|
||||
llvm::Optional<InlineInfo> Inline;
|
||||
std::optional<LineTable> OptLineTable;
|
||||
std::optional<InlineInfo> Inline;
|
||||
|
||||
FunctionInfo(uint64_t Addr = 0, uint64_t Size = 0, uint32_t N = 0)
|
||||
: Range(Addr, Addr + Size), Name(N) {}
|
||||
|
|
|
@ -139,9 +139,9 @@ class GsymCreator {
|
|||
DenseMap<llvm::gsym::FileEntry, uint32_t> FileEntryToIndex;
|
||||
std::vector<llvm::gsym::FileEntry> Files;
|
||||
std::vector<uint8_t> UUID;
|
||||
Optional<AddressRanges> ValidTextRanges;
|
||||
std::optional<AddressRanges> ValidTextRanges;
|
||||
AddressRanges Ranges;
|
||||
llvm::Optional<uint64_t> BaseAddress;
|
||||
std::optional<uint64_t> BaseAddress;
|
||||
bool Finalized = false;
|
||||
bool Quiet;
|
||||
|
||||
|
@ -249,7 +249,7 @@ public:
|
|||
}
|
||||
|
||||
/// Get the valid text ranges.
|
||||
const Optional<AddressRanges> GetValidTextRanges() const {
|
||||
const std::optional<AddressRanges> GetValidTextRanges() const {
|
||||
return ValidTextRanges;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
/// \param Index An index into the file table.
|
||||
/// \returns An optional FileInfo that will be valid if the file index is
|
||||
/// valid, or llvm::None if the file index is out of bounds,
|
||||
Optional<FileEntry> getFile(uint32_t Index) const {
|
||||
std::optional<FileEntry> getFile(uint32_t Index) const {
|
||||
if (Index < Files.size())
|
||||
return Files[Index];
|
||||
return std::nullopt;
|
||||
|
@ -191,7 +191,7 @@ public:
|
|||
/// \param OS The output stream to dump to.
|
||||
///
|
||||
/// \param FE The object to dump.
|
||||
void dump(raw_ostream &OS, Optional<FileEntry> FE);
|
||||
void dump(raw_ostream &OS, std::optional<FileEntry> FE);
|
||||
|
||||
/// Get the number of addresses in this Gsym file.
|
||||
uint32_t getNumAddresses() const {
|
||||
|
@ -205,7 +205,7 @@ public:
|
|||
/// \param Index A index into the address table.
|
||||
/// \returns A resolved virtual address for adddress in the address table
|
||||
/// or llvm::None if Index is out of bounds.
|
||||
Optional<uint64_t> getAddress(size_t Index) const;
|
||||
std::optional<uint64_t> getAddress(size_t Index) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -237,8 +237,8 @@ protected:
|
|||
/// \param Index An index into the AddrOffsets array.
|
||||
/// \returns An virtual address that matches the original object file for the
|
||||
/// address as the specified index, or llvm::None if Index is out of bounds.
|
||||
template <class T> Optional<uint64_t>
|
||||
addressForIndex(size_t Index) const {
|
||||
template <class T>
|
||||
std::optional<uint64_t> addressForIndex(size_t Index) const {
|
||||
ArrayRef<T> AIO = getAddrOffsets<T>();
|
||||
if (Index < AIO.size())
|
||||
return AIO[Index] + Hdr->BaseAddress;
|
||||
|
@ -254,7 +254,8 @@ protected:
|
|||
/// \returns The matching address offset index. This index will be used to
|
||||
/// extract the FunctionInfo data's offset from the AddrInfoOffsets array.
|
||||
template <class T>
|
||||
llvm::Optional<uint64_t> getAddressOffsetIndex(const uint64_t AddrOffset) const {
|
||||
std::optional<uint64_t>
|
||||
getAddressOffsetIndex(const uint64_t AddrOffset) const {
|
||||
ArrayRef<T> AIO = getAddrOffsets<T>();
|
||||
const auto Begin = AIO.begin();
|
||||
const auto End = AIO.end();
|
||||
|
@ -301,7 +302,7 @@ protected:
|
|||
/// \param Index An index into the address table.
|
||||
/// \returns An optional GSYM data offset for the offset of the FunctionInfo
|
||||
/// that needs to be decoded.
|
||||
Optional<uint64_t> getAddressInfoOffset(size_t Index) const;
|
||||
std::optional<uint64_t> getAddressInfoOffset(size_t Index) const;
|
||||
};
|
||||
|
||||
} // namespace gsym
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_GSYM_INLINEINFO_H
|
||||
#define LLVM_DEBUGINFO_GSYM_INLINEINFO_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/GSYM/ExtractRanges.h"
|
||||
#include "llvm/DebugInfo/GSYM/LineEntry.h"
|
||||
#include "llvm/DebugInfo/GSYM/LookupResult.h"
|
||||
|
@ -133,7 +132,7 @@ struct InlineInfo {
|
|||
///
|
||||
/// \returns optional vector of InlineInfo objects that describe the
|
||||
/// inline call stack for a given address, false otherwise.
|
||||
llvm::Optional<InlineArray> getInlineStack(uint64_t Addr) const;
|
||||
std::optional<InlineArray> getInlineStack(uint64_t Addr) const;
|
||||
|
||||
/// Decode an InlineInfo object from a binary data stream.
|
||||
///
|
||||
|
|
|
@ -170,7 +170,7 @@ public:
|
|||
///
|
||||
/// \returns An optional line entry with the first line entry if the line
|
||||
/// table isn't empty, or llvm::None if the line table is emtpy.
|
||||
Optional<LineEntry> first() const {
|
||||
std::optional<LineEntry> first() const {
|
||||
if (Lines.empty())
|
||||
return std::nullopt;
|
||||
return Lines.front();
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
///
|
||||
/// \returns An optional line entry with the last line entry if the line
|
||||
/// table isn't empty, or llvm::None if the line table is emtpy.
|
||||
Optional<LineEntry> last() const {
|
||||
std::optional<LineEntry> last() const {
|
||||
if (Lines.empty())
|
||||
return std::nullopt;
|
||||
return Lines.back();
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
uint32_t getRecordCount() const override;
|
||||
std::string getName() const override;
|
||||
llvm::Optional<RecordType> getItemAtIndex(uint32_t Index) const override;
|
||||
std::optional<RecordType> getItemAtIndex(uint32_t Index) const override;
|
||||
bool getNext(RecordType &Record) override;
|
||||
void reset() override;
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
|
||||
#define LLVM_DEBUGINFO_PDB_IPDBDATASTREAM_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
namespace llvm {
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
|
||||
virtual uint32_t getRecordCount() const = 0;
|
||||
virtual std::string getName() const = 0;
|
||||
virtual Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
|
||||
virtual std::optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
|
||||
virtual bool getNext(RecordType &Record) = 0;
|
||||
virtual void reset() = 0;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_DBISTREAMBUILDER_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_DBISTREAMBUILDER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/BinaryFormat/COFF.h"
|
||||
|
@ -105,7 +104,7 @@ private:
|
|||
msf::MSFBuilder &Msf;
|
||||
BumpPtrAllocator &Allocator;
|
||||
|
||||
Optional<PdbRaw_DbiVer> VerHeader;
|
||||
std::optional<PdbRaw_DbiVer> VerHeader;
|
||||
uint32_t Age;
|
||||
uint16_t BuildNumber;
|
||||
uint16_t PdbDllVersion;
|
||||
|
@ -120,7 +119,7 @@ private:
|
|||
|
||||
std::vector<std::unique_ptr<DbiModuleDescriptorBuilder>> ModiList;
|
||||
|
||||
Optional<codeview::DebugFrameDataSubsection> NewFpoData;
|
||||
std::optional<codeview::DebugFrameDataSubsection> NewFpoData;
|
||||
std::vector<object::FpoData> OldFpoData;
|
||||
|
||||
StringMap<uint32_t> SourceFileNames;
|
||||
|
@ -130,7 +129,7 @@ private:
|
|||
MutableBinaryByteStream FileInfoBuffer;
|
||||
std::vector<SectionContrib> SectionContribs;
|
||||
std::vector<SecMapEntry> SectionMap;
|
||||
std::array<Optional<DebugStream>, (int)DbgHeaderType::Max> DbgStreams;
|
||||
std::array<std::optional<DebugStream>, (int)DbgHeaderType::Max> DbgStreams;
|
||||
};
|
||||
} // namespace pdb
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ public:
|
|||
const_iterator find_as(const Key &K, TraitsT &Traits) const {
|
||||
uint32_t H = Traits.hashLookupKey(K) % capacity();
|
||||
uint32_t I = H;
|
||||
Optional<uint32_t> FirstUnused;
|
||||
std::optional<uint32_t> FirstUnused;
|
||||
do {
|
||||
if (isPresent(I)) {
|
||||
if (Traits.storageKeyToLookupKey(Buckets[I].first) == K)
|
||||
|
@ -271,7 +271,7 @@ private:
|
|||
/// from a real key to an internal key.
|
||||
template <typename Key, typename TraitsT>
|
||||
bool set_as_internal(const Key &K, ValueT V, TraitsT &Traits,
|
||||
Optional<uint32_t> InternalKey) {
|
||||
std::optional<uint32_t> InternalKey) {
|
||||
auto Entry = find_as(K, Traits);
|
||||
if (Entry != end()) {
|
||||
assert(isPresent(Entry.index()));
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_INFOSTREAMBUILDER_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_INFOSTREAMBUILDER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
|
||||
#include "llvm/DebugInfo/CodeView/GUID.h"
|
||||
|
@ -46,7 +45,7 @@ public:
|
|||
bool hashPDBContentsToGUID() const { return HashPDBContentsToGUID; }
|
||||
uint32_t getAge() const { return Age; }
|
||||
codeview::GUID getGuid() const { return Guid; }
|
||||
Optional<uint32_t> getSignature() const { return Signature; }
|
||||
std::optional<uint32_t> getSignature() const { return Signature; }
|
||||
|
||||
uint32_t finalize();
|
||||
|
||||
|
@ -61,7 +60,7 @@ private:
|
|||
std::vector<PdbRaw_FeatureSig> Features;
|
||||
PdbRaw_ImplVer Ver;
|
||||
uint32_t Age;
|
||||
Optional<uint32_t> Signature;
|
||||
std::optional<uint32_t> Signature;
|
||||
codeview::GUID Guid;
|
||||
|
||||
bool HashPDBContentsToGUID = false;
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_INPUTFILE_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_INPUTFILE_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/PointerUnion.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/iterator.h"
|
||||
|
@ -149,7 +148,7 @@ private:
|
|||
bool isEnd() const;
|
||||
|
||||
uint32_t Index = 0;
|
||||
Optional<object::section_iterator> SectionIter;
|
||||
std::optional<object::section_iterator> SectionIter;
|
||||
SymbolGroup Value;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,10 +30,10 @@ struct FilterOptions {
|
|||
std::list<std::string> IncludeCompilands;
|
||||
uint32_t PaddingThreshold;
|
||||
uint32_t SizeThreshold;
|
||||
llvm::Optional<uint32_t> DumpModi;
|
||||
llvm::Optional<uint32_t> ParentRecurseDepth;
|
||||
llvm::Optional<uint32_t> ChildrenRecurseDepth;
|
||||
llvm::Optional<uint32_t> SymbolOffset;
|
||||
std::optional<uint32_t> DumpModi;
|
||||
std::optional<uint32_t> ParentRecurseDepth;
|
||||
std::optional<uint32_t> ChildrenRecurseDepth;
|
||||
std::optional<uint32_t> SymbolOffset;
|
||||
bool JustMyCode;
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEENUM_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEENUM_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
|
@ -65,9 +64,9 @@ public:
|
|||
|
||||
protected:
|
||||
codeview::TypeIndex Index;
|
||||
Optional<codeview::EnumRecord> Record;
|
||||
std::optional<codeview::EnumRecord> Record;
|
||||
NativeTypeEnum *UnmodifiedType = nullptr;
|
||||
Optional<codeview::ModifierRecord> Modifiers;
|
||||
std::optional<codeview::ModifierRecord> Modifiers;
|
||||
};
|
||||
|
||||
} // namespace pdb
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEPOINTER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
|
@ -52,7 +51,7 @@ public:
|
|||
protected:
|
||||
bool isMemberPointer() const;
|
||||
codeview::TypeIndex TI;
|
||||
Optional<codeview::PointerRecord> Record;
|
||||
std::optional<codeview::PointerRecord> Record;
|
||||
};
|
||||
|
||||
} // namespace pdb
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEUDT_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_NATIVETYPEUDT_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeRecord.h"
|
||||
#include "llvm/DebugInfo/PDB/IPDBRawSymbol.h"
|
||||
|
@ -64,11 +63,11 @@ public:
|
|||
protected:
|
||||
codeview::TypeIndex Index;
|
||||
|
||||
Optional<codeview::ClassRecord> Class;
|
||||
Optional<codeview::UnionRecord> Union;
|
||||
std::optional<codeview::ClassRecord> Class;
|
||||
std::optional<codeview::UnionRecord> Union;
|
||||
NativeTypeUDT *UnmodifiedType = nullptr;
|
||||
codeview::TagRecord *Tag = nullptr;
|
||||
Optional<codeview::ModifierRecord> Modifiers;
|
||||
std::optional<codeview::ModifierRecord> Modifiers;
|
||||
};
|
||||
|
||||
} // namespace pdb
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_PDB_NATIVE_TPISTREAMBUILDER_H
|
||||
#define LLVM_DEBUGINFO_PDB_NATIVE_TPISTREAMBUILDER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/DebugInfo/CodeView/CVRecord.h"
|
||||
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
|
||||
#include "llvm/DebugInfo/PDB/Native/RawConstants.h"
|
||||
|
@ -46,7 +45,7 @@ public:
|
|||
TpiStreamBuilder &operator=(const TpiStreamBuilder &) = delete;
|
||||
|
||||
void setVersionHeader(PdbRaw_TpiVer Version);
|
||||
void addTypeRecord(ArrayRef<uint8_t> Type, Optional<uint32_t> Hash);
|
||||
void addTypeRecord(ArrayRef<uint8_t> Type, std::optional<uint32_t> Hash);
|
||||
void addTypeRecords(ArrayRef<uint8_t> Types, ArrayRef<uint16_t> Sizes,
|
||||
ArrayRef<uint32_t> Hashes);
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H
|
||||
#define LLVM_DEBUGINFO_SYMBOLIZE_DIPRINTER_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/JSON.h"
|
||||
#include <memory>
|
||||
|
@ -34,7 +33,7 @@ class SourceCode;
|
|||
|
||||
struct Request {
|
||||
StringRef ModuleName;
|
||||
Optional<uint64_t> Address;
|
||||
std::optional<uint64_t> Address;
|
||||
};
|
||||
|
||||
class DIPrinter {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#ifndef LLVM_DEBUGINFO_SYMBOLIZE_MARKUP_H
|
||||
#define LLVM_DEBUGINFO_SYMBOLIZE_MARKUP_H
|
||||
|
||||
#include "llvm/ADT/Optional.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/StringSet.h"
|
||||
|
@ -80,17 +79,17 @@ public:
|
|||
/// previous call.
|
||||
///
|
||||
/// \returns the next markup node or None if none remain.
|
||||
Optional<MarkupNode> nextNode();
|
||||
std::optional<MarkupNode> nextNode();
|
||||
|
||||
bool isSGR(const MarkupNode &Node) const {
|
||||
return SGRSyntax.match(Node.Text);
|
||||
}
|
||||
|
||||
private:
|
||||
Optional<MarkupNode> parseElement(StringRef Line);
|
||||
std::optional<MarkupNode> parseElement(StringRef Line);
|
||||
void parseTextOutsideMarkup(StringRef Text);
|
||||
Optional<StringRef> parseMultiLineBegin(StringRef Line);
|
||||
Optional<StringRef> parseMultiLineEnd(StringRef Line);
|
||||
std::optional<StringRef> parseMultiLineBegin(StringRef Line);
|
||||
std::optional<StringRef> parseMultiLineEnd(StringRef Line);
|
||||
|
||||
// Tags of elements that can span multiple lines.
|
||||
const StringSet<> MultilineTags;
|
||||
|
|
|
@ -33,7 +33,7 @@ class LLVMSymbolizer;
|
|||
class MarkupFilter {
|
||||
public:
|
||||
MarkupFilter(raw_ostream &OS, LLVMSymbolizer &Symbolizer,
|
||||
Optional<bool> ColorsEnabled = std::nullopt);
|
||||
std::optional<bool> ColorsEnabled = std::nullopt);
|
||||
|
||||
/// Filters a line containing symbolizer markup and writes the human-readable
|
||||
/// results to the output stream.
|
||||
|
@ -110,16 +110,16 @@ private:
|
|||
void printRawElement(const MarkupNode &Element);
|
||||
void printValue(Twine Value);
|
||||
|
||||
Optional<Module> parseModule(const MarkupNode &Element) const;
|
||||
Optional<MMap> parseMMap(const MarkupNode &Element) const;
|
||||
std::optional<Module> parseModule(const MarkupNode &Element) const;
|
||||
std::optional<MMap> parseMMap(const MarkupNode &Element) const;
|
||||
|
||||
Optional<uint64_t> parseAddr(StringRef Str) const;
|
||||
Optional<uint64_t> parseModuleID(StringRef Str) const;
|
||||
Optional<uint64_t> parseSize(StringRef Str) const;
|
||||
Optional<SmallVector<uint8_t>> parseBuildID(StringRef Str) const;
|
||||
Optional<std::string> parseMode(StringRef Str) const;
|
||||
Optional<PCType> parsePCType(StringRef Str) const;
|
||||
Optional<uint64_t> parseFrameNumber(StringRef Str) const;
|
||||
std::optional<uint64_t> parseAddr(StringRef Str) const;
|
||||
std::optional<uint64_t> parseModuleID(StringRef Str) const;
|
||||
std::optional<uint64_t> parseSize(StringRef Str) const;
|
||||
std::optional<SmallVector<uint8_t>> parseBuildID(StringRef Str) const;
|
||||
std::optional<std::string> parseMode(StringRef Str) const;
|
||||
std::optional<PCType> parsePCType(StringRef Str) const;
|
||||
std::optional<uint64_t> parseFrameNumber(StringRef Str) const;
|
||||
|
||||
bool checkTag(const MarkupNode &Node) const;
|
||||
bool checkNumFields(const MarkupNode &Element, size_t Size) const;
|
||||
|
@ -147,10 +147,10 @@ private:
|
|||
|
||||
// A module info line currently being built. This incorporates as much mmap
|
||||
// information as possible before being emitted.
|
||||
Optional<ModuleInfoLine> MIL;
|
||||
std::optional<ModuleInfoLine> MIL;
|
||||
|
||||
// SGR state.
|
||||
Optional<raw_ostream::Colors> Color;
|
||||
std::optional<raw_ostream::Colors> Color;
|
||||
bool Bold = false;
|
||||
|
||||
// Map from Module ID to Module.
|
||||
|
|
|
@ -365,7 +365,8 @@ unsigned llvm::dwarf::LanguageVendor(dwarf::SourceLanguage Lang) {
|
|||
}
|
||||
}
|
||||
|
||||
Optional<unsigned> llvm::dwarf::LanguageLowerBound(dwarf::SourceLanguage Lang) {
|
||||
std::optional<unsigned>
|
||||
llvm::dwarf::LanguageLowerBound(dwarf::SourceLanguage Lang) {
|
||||
switch (Lang) {
|
||||
default:
|
||||
return std::nullopt;
|
||||
|
@ -691,8 +692,8 @@ StringRef llvm::dwarf::IndexString(unsigned Idx) {
|
|||
}
|
||||
}
|
||||
|
||||
Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
|
||||
FormParams Params) {
|
||||
std::optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
|
||||
FormParams Params) {
|
||||
switch (Form) {
|
||||
case DW_FORM_addr:
|
||||
if (Params)
|
||||
|
|
|
@ -730,7 +730,7 @@ void CodeViewDebug::emitTypeInformation() {
|
|||
TypeRecordMapping typeMapping(CVMCOS);
|
||||
Pipeline.addCallbackToPipeline(typeMapping);
|
||||
|
||||
Optional<TypeIndex> B = Table.getFirst();
|
||||
std::optional<TypeIndex> B = Table.getFirst();
|
||||
while (B) {
|
||||
// This will fail if the record data is invalid.
|
||||
CVType Record = Table.getType(*B);
|
||||
|
|
|
@ -425,7 +425,7 @@ void DIEInteger::emitValue(const AsmPrinter *Asm, dwarf::Form Form) const {
|
|||
///
|
||||
unsigned DIEInteger::sizeOf(const dwarf::FormParams &FormParams,
|
||||
dwarf::Form Form) const {
|
||||
if (Optional<uint8_t> FixedSize =
|
||||
if (std::optional<uint8_t> FixedSize =
|
||||
dwarf::getFixedFormByteSize(Form, FormParams))
|
||||
return *FixedSize;
|
||||
|
||||
|
|
|
@ -225,7 +225,8 @@ static void analyzeImportedModule(
|
|||
SysRoot = CU.getSysRoot();
|
||||
if (!SysRoot.empty() && Path.startswith(SysRoot))
|
||||
return;
|
||||
Optional<const char*> Name = dwarf::toString(DIE.find(dwarf::DW_AT_name));
|
||||
std::optional<const char *> Name =
|
||||
dwarf::toString(DIE.find(dwarf::DW_AT_name));
|
||||
if (!Name)
|
||||
return;
|
||||
auto &Entry = (*ParseableSwiftInterfaces)[*Name];
|
||||
|
@ -498,7 +499,7 @@ unsigned DWARFLinker::shouldKeepSubprogramDIE(
|
|||
|
||||
Flags |= TF_Keep;
|
||||
|
||||
Optional<uint64_t> HighPc = DIE.getHighPC(*LowPc);
|
||||
std::optional<uint64_t> HighPc = DIE.getHighPC(*LowPc);
|
||||
if (!HighPc) {
|
||||
reportWarning("Function without high_pc. Range will be discarded.\n", File,
|
||||
&DIE);
|
||||
|
@ -882,7 +883,7 @@ void DWARFLinker::assignAbbrev(DIEAbbrev &Abbrev) {
|
|||
unsigned DWARFLinker::DIECloner::cloneStringAttribute(
|
||||
DIE &Die, AttributeSpec AttrSpec, const DWARFFormValue &Val,
|
||||
const DWARFUnit &, OffsetsStringPool &StringPool, AttributesInfo &Info) {
|
||||
Optional<const char *> String = dwarf::toString(Val);
|
||||
std::optional<const char *> String = dwarf::toString(Val);
|
||||
if (!String)
|
||||
return 0;
|
||||
|
||||
|
@ -1107,7 +1108,7 @@ unsigned DWARFLinker::DIECloner::cloneAddressAttribute(
|
|||
dwarf::Form Form = AttrSpec.Form;
|
||||
uint64_t Addr = 0;
|
||||
if (Form == dwarf::DW_FORM_addrx) {
|
||||
if (Optional<uint64_t> AddrOffsetSectionBase =
|
||||
if (std::optional<uint64_t> AddrOffsetSectionBase =
|
||||
Unit.getOrigUnit().getAddrOffsetSectionBase()) {
|
||||
uint64_t StartOffset =
|
||||
*AddrOffsetSectionBase +
|
||||
|
@ -1943,7 +1944,7 @@ uint32_t DWARFLinker::DIECloner::hashFullyQualifiedName(DWARFDie DIE,
|
|||
const char *Name = nullptr;
|
||||
DWARFUnit *OrigUnit = &U.getOrigUnit();
|
||||
CompileUnit *CU = &U;
|
||||
Optional<DWARFFormValue> Ref;
|
||||
std::optional<DWARFFormValue> Ref;
|
||||
|
||||
while (true) {
|
||||
if (const char *CurrentName = DIE.getName(DINameKind::ShortName))
|
||||
|
|
|
@ -52,7 +52,7 @@ void CompileUnit::markEverythingAsKept() {
|
|||
DIE.getTag() != dwarf::DW_TAG_constant)
|
||||
continue;
|
||||
|
||||
Optional<DWARFFormValue> Value;
|
||||
std::optional<DWARFFormValue> Value;
|
||||
if (!(Value = DIE.find(dwarf::DW_AT_location))) {
|
||||
if ((Value = DIE.find(dwarf::DW_AT_const_value)) &&
|
||||
!inFunctionScope(*this, I.ParentIdx))
|
||||
|
|
|
@ -29,14 +29,14 @@ AppendingTypeTableBuilder::AppendingTypeTableBuilder(BumpPtrAllocator &Storage)
|
|||
|
||||
AppendingTypeTableBuilder::~AppendingTypeTableBuilder() = default;
|
||||
|
||||
Optional<TypeIndex> AppendingTypeTableBuilder::getFirst() {
|
||||
std::optional<TypeIndex> AppendingTypeTableBuilder::getFirst() {
|
||||
if (empty())
|
||||
return std::nullopt;
|
||||
|
||||
return TypeIndex(TypeIndex::FirstNonSimpleIndex);
|
||||
}
|
||||
|
||||
Optional<TypeIndex> AppendingTypeTableBuilder::getNext(TypeIndex Prev) {
|
||||
std::optional<TypeIndex> AppendingTypeTableBuilder::getNext(TypeIndex Prev) {
|
||||
if (++Prev == nextTypeIndex())
|
||||
return std::nullopt;
|
||||
return Prev;
|
||||
|
|
|
@ -157,7 +157,7 @@ Error CVTypeVisitor::visitTypeStream(CVTypeRange Types) {
|
|||
}
|
||||
|
||||
Error CVTypeVisitor::visitTypeStream(TypeCollection &Types) {
|
||||
Optional<TypeIndex> I = Types.getFirst();
|
||||
std::optional<TypeIndex> I = Types.getFirst();
|
||||
while (I) {
|
||||
CVType Type = Types.getType(*I);
|
||||
if (auto EC = visitTypeRecord(Type, *I))
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
using namespace llvm;
|
||||
using namespace llvm::codeview;
|
||||
|
||||
Error CodeViewRecordIO::beginRecord(Optional<uint32_t> MaxLength) {
|
||||
Error CodeViewRecordIO::beginRecord(std::optional<uint32_t> MaxLength) {
|
||||
RecordLimit Limit;
|
||||
Limit.MaxLength = MaxLength;
|
||||
Limit.BeginOffset = getCurrentOffset();
|
||||
|
@ -67,9 +67,9 @@ uint32_t CodeViewRecordIO::maxFieldLength() const {
|
|||
// ever be at most 1 sub-record deep (in a FieldList), but this works for
|
||||
// the general case.
|
||||
uint32_t Offset = getCurrentOffset();
|
||||
Optional<uint32_t> Min = Limits.front().bytesRemaining(Offset);
|
||||
std::optional<uint32_t> Min = Limits.front().bytesRemaining(Offset);
|
||||
for (auto X : makeArrayRef(Limits).drop_front()) {
|
||||
Optional<uint32_t> ThisMin = X.bytesRemaining(Offset);
|
||||
std::optional<uint32_t> ThisMin = X.bytesRemaining(Offset);
|
||||
if (ThisMin)
|
||||
Min = Min ? std::min(*Min, *ThisMin) : *ThisMin;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ void ContinuationRecordBuilder::insertSegmentEnd(uint32_t Offset) {
|
|||
}
|
||||
|
||||
CVType ContinuationRecordBuilder::createSegmentRecord(
|
||||
uint32_t OffBegin, uint32_t OffEnd, Optional<TypeIndex> RefersTo) {
|
||||
uint32_t OffBegin, uint32_t OffEnd, std::optional<TypeIndex> RefersTo) {
|
||||
assert(OffEnd - OffBegin <= USHRT_MAX);
|
||||
|
||||
MutableArrayRef<uint8_t> Data = Buffer.data();
|
||||
|
@ -228,7 +228,7 @@ std::vector<CVType> ContinuationRecordBuilder::end(TypeIndex Index) {
|
|||
|
||||
uint32_t End = SegmentWriter.getOffset();
|
||||
|
||||
Optional<TypeIndex> RefersTo;
|
||||
std::optional<TypeIndex> RefersTo;
|
||||
for (uint32_t Offset : reverse(SO)) {
|
||||
Types.push_back(createSegmentRecord(Offset, End, RefersTo));
|
||||
|
||||
|
|
|
@ -32,14 +32,14 @@ GlobalTypeTableBuilder::GlobalTypeTableBuilder(BumpPtrAllocator &Storage)
|
|||
|
||||
GlobalTypeTableBuilder::~GlobalTypeTableBuilder() = default;
|
||||
|
||||
Optional<TypeIndex> GlobalTypeTableBuilder::getFirst() {
|
||||
std::optional<TypeIndex> GlobalTypeTableBuilder::getFirst() {
|
||||
if (empty())
|
||||
return std::nullopt;
|
||||
|
||||
return TypeIndex(TypeIndex::FirstNonSimpleIndex);
|
||||
}
|
||||
|
||||
Optional<TypeIndex> GlobalTypeTableBuilder::getNext(TypeIndex Prev) {
|
||||
std::optional<TypeIndex> GlobalTypeTableBuilder::getNext(TypeIndex Prev) {
|
||||
if (++Prev == nextTypeIndex())
|
||||
return std::nullopt;
|
||||
return Prev;
|
||||
|
|
|
@ -98,7 +98,7 @@ CVType LazyRandomTypeCollection::getType(TypeIndex Index) {
|
|||
return Records[Index.toArrayIndex()].Type;
|
||||
}
|
||||
|
||||
Optional<CVType> LazyRandomTypeCollection::tryGetType(TypeIndex Index) {
|
||||
std::optional<CVType> LazyRandomTypeCollection::tryGetType(TypeIndex Index) {
|
||||
if (Index.isSimple())
|
||||
return std::nullopt;
|
||||
|
||||
|
@ -202,7 +202,7 @@ Error LazyRandomTypeCollection::visitRangeForType(TypeIndex TI) {
|
|||
return Error::success();
|
||||
}
|
||||
|
||||
Optional<TypeIndex> LazyRandomTypeCollection::getFirst() {
|
||||
std::optional<TypeIndex> LazyRandomTypeCollection::getFirst() {
|
||||
TypeIndex TI = TypeIndex::fromArrayIndex(0);
|
||||
if (auto EC = ensureTypeExists(TI)) {
|
||||
consumeError(std::move(EC));
|
||||
|
@ -211,7 +211,7 @@ Optional<TypeIndex> LazyRandomTypeCollection::getFirst() {
|
|||
return TI;
|
||||
}
|
||||
|
||||
Optional<TypeIndex> LazyRandomTypeCollection::getNext(TypeIndex Prev) {
|
||||
std::optional<TypeIndex> LazyRandomTypeCollection::getNext(TypeIndex Prev) {
|
||||
// We can't be sure how long this type stream is, given that the initial count
|
||||
// given to the constructor is just a hint. So just try to make sure the next
|
||||
// record exists, and if anything goes wrong, we must be at the end.
|
||||
|
|
|
@ -33,14 +33,14 @@ MergingTypeTableBuilder::MergingTypeTableBuilder(BumpPtrAllocator &Storage)
|
|||
|
||||
MergingTypeTableBuilder::~MergingTypeTableBuilder() = default;
|
||||
|
||||
Optional<TypeIndex> MergingTypeTableBuilder::getFirst() {
|
||||
std::optional<TypeIndex> MergingTypeTableBuilder::getFirst() {
|
||||
if (empty())
|
||||
return std::nullopt;
|
||||
|
||||
return TypeIndex(TypeIndex::FirstNonSimpleIndex);
|
||||
}
|
||||
|
||||
Optional<TypeIndex> MergingTypeTableBuilder::getNext(TypeIndex Prev) {
|
||||
std::optional<TypeIndex> MergingTypeTableBuilder::getNext(TypeIndex Prev) {
|
||||
if (++Prev == nextTypeIndex())
|
||||
return std::nullopt;
|
||||
return Prev;
|
||||
|
|
|
@ -236,7 +236,7 @@ Error TypeRecordMapping::visitTypeBegin(CVType &CVR) {
|
|||
// FieldList and MethodList records can be any length because they can be
|
||||
// split with continuation records. All other record types cannot be
|
||||
// longer than the maximum record length.
|
||||
Optional<uint32_t> MaxLen;
|
||||
std::optional<uint32_t> MaxLen;
|
||||
if (CVR.kind() != TypeLeafKind::LF_FIELDLIST &&
|
||||
CVR.kind() != TypeLeafKind::LF_METHODLIST)
|
||||
MaxLen = MaxRecordLength - sizeof(RecordPrefix);
|
||||
|
|
|
@ -79,7 +79,7 @@ public:
|
|||
Error mergeTypesAndIds(MergingTypeTableBuilder &DestIds,
|
||||
MergingTypeTableBuilder &DestTypes,
|
||||
const CVTypeArray &IdsAndTypes,
|
||||
Optional<PCHMergerInfo> &PCHInfo);
|
||||
std::optional<PCHMergerInfo> &PCHInfo);
|
||||
Error mergeIdRecords(MergingTypeTableBuilder &Dest,
|
||||
ArrayRef<TypeIndex> TypeSourceToDest,
|
||||
const CVTypeArray &Ids);
|
||||
|
@ -91,14 +91,14 @@ public:
|
|||
GlobalTypeTableBuilder &DestTypes,
|
||||
const CVTypeArray &IdsAndTypes,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
Optional<PCHMergerInfo> &PCHInfo);
|
||||
std::optional<PCHMergerInfo> &PCHInfo);
|
||||
Error mergeIdRecords(GlobalTypeTableBuilder &Dest,
|
||||
ArrayRef<TypeIndex> TypeSourceToDest,
|
||||
const CVTypeArray &Ids,
|
||||
ArrayRef<GloballyHashedType> Hashes);
|
||||
Error mergeTypeRecords(GlobalTypeTableBuilder &Dest, const CVTypeArray &Types,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
Optional<PCHMergerInfo> &PCHInfo);
|
||||
std::optional<PCHMergerInfo> &PCHInfo);
|
||||
|
||||
private:
|
||||
Error doit(const CVTypeArray &Types);
|
||||
|
@ -198,7 +198,7 @@ private:
|
|||
/// its type indices.
|
||||
SmallVector<uint8_t, 256> RemapStorage;
|
||||
|
||||
Optional<PCHMergerInfo> PCHInfo;
|
||||
std::optional<PCHMergerInfo> PCHInfo;
|
||||
};
|
||||
|
||||
} // end anonymous namespace
|
||||
|
@ -258,10 +258,9 @@ Error TypeStreamMerger::mergeIdRecords(MergingTypeTableBuilder &Dest,
|
|||
return doit(Ids);
|
||||
}
|
||||
|
||||
Error TypeStreamMerger::mergeTypesAndIds(MergingTypeTableBuilder &DestIds,
|
||||
MergingTypeTableBuilder &DestTypes,
|
||||
const CVTypeArray &IdsAndTypes,
|
||||
Optional<PCHMergerInfo> &PCHInfo) {
|
||||
Error TypeStreamMerger::mergeTypesAndIds(
|
||||
MergingTypeTableBuilder &DestIds, MergingTypeTableBuilder &DestTypes,
|
||||
const CVTypeArray &IdsAndTypes, std::optional<PCHMergerInfo> &PCHInfo) {
|
||||
DestIdStream = &DestIds;
|
||||
DestTypeStream = &DestTypes;
|
||||
UseGlobalHashes = false;
|
||||
|
@ -271,10 +270,10 @@ Error TypeStreamMerger::mergeTypesAndIds(MergingTypeTableBuilder &DestIds,
|
|||
}
|
||||
|
||||
// Global hashing entry points
|
||||
Error TypeStreamMerger::mergeTypeRecords(GlobalTypeTableBuilder &Dest,
|
||||
const CVTypeArray &Types,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
Optional<PCHMergerInfo> &PCHInfo) {
|
||||
Error TypeStreamMerger::mergeTypeRecords(
|
||||
GlobalTypeTableBuilder &Dest, const CVTypeArray &Types,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
std::optional<PCHMergerInfo> &PCHInfo) {
|
||||
DestGlobalTypeStream = &Dest;
|
||||
UseGlobalHashes = true;
|
||||
GlobalHashes = Hashes;
|
||||
|
@ -295,11 +294,10 @@ Error TypeStreamMerger::mergeIdRecords(GlobalTypeTableBuilder &Dest,
|
|||
return doit(Ids);
|
||||
}
|
||||
|
||||
Error TypeStreamMerger::mergeTypesAndIds(GlobalTypeTableBuilder &DestIds,
|
||||
GlobalTypeTableBuilder &DestTypes,
|
||||
const CVTypeArray &IdsAndTypes,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
Optional<PCHMergerInfo> &PCHInfo) {
|
||||
Error TypeStreamMerger::mergeTypesAndIds(
|
||||
GlobalTypeTableBuilder &DestIds, GlobalTypeTableBuilder &DestTypes,
|
||||
const CVTypeArray &IdsAndTypes, ArrayRef<GloballyHashedType> Hashes,
|
||||
std::optional<PCHMergerInfo> &PCHInfo) {
|
||||
DestGlobalIdStream = &DestIds;
|
||||
DestGlobalTypeStream = &DestTypes;
|
||||
UseGlobalHashes = true;
|
||||
|
@ -448,7 +446,7 @@ Error llvm::codeview::mergeIdRecords(MergingTypeTableBuilder &Dest,
|
|||
Error llvm::codeview::mergeTypeAndIdRecords(
|
||||
MergingTypeTableBuilder &DestIds, MergingTypeTableBuilder &DestTypes,
|
||||
SmallVectorImpl<TypeIndex> &SourceToDest, const CVTypeArray &IdsAndTypes,
|
||||
Optional<PCHMergerInfo> &PCHInfo) {
|
||||
std::optional<PCHMergerInfo> &PCHInfo) {
|
||||
TypeStreamMerger M(SourceToDest);
|
||||
return M.mergeTypesAndIds(DestIds, DestTypes, IdsAndTypes, PCHInfo);
|
||||
}
|
||||
|
@ -456,7 +454,8 @@ Error llvm::codeview::mergeTypeAndIdRecords(
|
|||
Error llvm::codeview::mergeTypeAndIdRecords(
|
||||
GlobalTypeTableBuilder &DestIds, GlobalTypeTableBuilder &DestTypes,
|
||||
SmallVectorImpl<TypeIndex> &SourceToDest, const CVTypeArray &IdsAndTypes,
|
||||
ArrayRef<GloballyHashedType> Hashes, Optional<PCHMergerInfo> &PCHInfo) {
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
std::optional<PCHMergerInfo> &PCHInfo) {
|
||||
TypeStreamMerger M(SourceToDest);
|
||||
return M.mergeTypesAndIds(DestIds, DestTypes, IdsAndTypes, Hashes, PCHInfo);
|
||||
}
|
||||
|
@ -465,7 +464,7 @@ Error llvm::codeview::mergeTypeRecords(GlobalTypeTableBuilder &Dest,
|
|||
SmallVectorImpl<TypeIndex> &SourceToDest,
|
||||
const CVTypeArray &Types,
|
||||
ArrayRef<GloballyHashedType> Hashes,
|
||||
Optional<PCHMergerInfo> &PCHInfo) {
|
||||
std::optional<PCHMergerInfo> &PCHInfo) {
|
||||
TypeStreamMerger M(SourceToDest);
|
||||
return M.mergeTypeRecords(Dest, Types, Hashes, PCHInfo);
|
||||
}
|
||||
|
|
|
@ -21,13 +21,13 @@ TypeTableCollection::TypeTableCollection(ArrayRef<ArrayRef<uint8_t>> Records)
|
|||
Names.resize(Records.size());
|
||||
}
|
||||
|
||||
Optional<TypeIndex> TypeTableCollection::getFirst() {
|
||||
std::optional<TypeIndex> TypeTableCollection::getFirst() {
|
||||
if (empty())
|
||||
return std::nullopt;
|
||||
return TypeIndex::fromArrayIndex(0);
|
||||
}
|
||||
|
||||
Optional<TypeIndex> TypeTableCollection::getNext(TypeIndex Prev) {
|
||||
std::optional<TypeIndex> TypeTableCollection::getNext(TypeIndex Prev) {
|
||||
assert(contains(Prev));
|
||||
++Prev;
|
||||
if (Prev.toArrayIndex() == size())
|
||||
|
|
|
@ -69,7 +69,7 @@ DWARFAbbreviationDeclaration::extract(DataExtractor Data,
|
|||
AttributeSpecs.push_back(AttributeSpec(A, F, V));
|
||||
continue;
|
||||
}
|
||||
Optional<uint8_t> ByteSize;
|
||||
std::optional<uint8_t> ByteSize;
|
||||
// If this abbrevation still has a fixed byte size, then update the
|
||||
// FixedAttributeSize as needed.
|
||||
switch (F) {
|
||||
|
@ -138,7 +138,7 @@ void DWARFAbbreviationDeclaration::dump(raw_ostream &OS) const {
|
|||
OS << '\n';
|
||||
}
|
||||
|
||||
Optional<uint32_t>
|
||||
std::optional<uint32_t>
|
||||
DWARFAbbreviationDeclaration::findAttributeIndex(dwarf::Attribute Attr) const {
|
||||
for (uint32_t i = 0, e = AttributeSpecs.size(); i != e; ++i) {
|
||||
if (AttributeSpecs[i].Attr == Attr)
|
||||
|
@ -164,7 +164,7 @@ uint64_t DWARFAbbreviationDeclaration::getAttributeOffsetFromIndex(
|
|||
return Offset;
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
DWARFAbbreviationDeclaration::getAttributeValueFromOffset(
|
||||
uint32_t AttrIndex, uint64_t Offset, const DWARFUnit &U) const {
|
||||
assert(AttributeSpecs.size() > AttrIndex &&
|
||||
|
@ -183,13 +183,13 @@ DWARFAbbreviationDeclaration::getAttributeValueFromOffset(
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
DWARFAbbreviationDeclaration::getAttributeValue(const uint64_t DIEOffset,
|
||||
const dwarf::Attribute Attr,
|
||||
const DWARFUnit &U) const {
|
||||
// Check if this abbreviation has this attribute without needing to skip
|
||||
// any data so we can return quickly if it doesn't.
|
||||
Optional<uint32_t> MatchAttrIndex = findAttributeIndex(Attr);
|
||||
std::optional<uint32_t> MatchAttrIndex = findAttributeIndex(Attr);
|
||||
if (!MatchAttrIndex)
|
||||
return std::nullopt;
|
||||
|
||||
|
@ -210,20 +210,20 @@ size_t DWARFAbbreviationDeclaration::FixedSizeInfo::getByteSize(
|
|||
return ByteSize;
|
||||
}
|
||||
|
||||
Optional<int64_t> DWARFAbbreviationDeclaration::AttributeSpec::getByteSize(
|
||||
std::optional<int64_t> DWARFAbbreviationDeclaration::AttributeSpec::getByteSize(
|
||||
const DWARFUnit &U) const {
|
||||
if (isImplicitConst())
|
||||
return 0;
|
||||
if (ByteSize.HasByteSize)
|
||||
return ByteSize.ByteSize;
|
||||
Optional<int64_t> S;
|
||||
std::optional<int64_t> S;
|
||||
auto FixedByteSize = dwarf::getFixedFormByteSize(Form, U.getFormParams());
|
||||
if (FixedByteSize)
|
||||
S = *FixedByteSize;
|
||||
return S;
|
||||
}
|
||||
|
||||
Optional<size_t> DWARFAbbreviationDeclaration::getFixedAttributesByteSize(
|
||||
std::optional<size_t> DWARFAbbreviationDeclaration::getFixedAttributesByteSize(
|
||||
const DWARFUnit &U) const {
|
||||
if (FixedAttributeSize)
|
||||
return FixedAttributeSize->getByteSize(U);
|
||||
|
|
|
@ -143,8 +143,8 @@ void AppleAcceleratorTable::Header::dump(ScopedPrinter &W) const {
|
|||
W.printNumber("HeaderData length", HeaderDataLength);
|
||||
}
|
||||
|
||||
Optional<uint64_t> AppleAcceleratorTable::HeaderData::extractOffset(
|
||||
Optional<DWARFFormValue> Value) const {
|
||||
std::optional<uint64_t> AppleAcceleratorTable::HeaderData::extractOffset(
|
||||
std::optional<DWARFFormValue> Value) const {
|
||||
if (!Value)
|
||||
return std::nullopt;
|
||||
|
||||
|
@ -185,7 +185,7 @@ bool AppleAcceleratorTable::dumpName(ScopedPrinter &W,
|
|||
W.startLine() << format("Atom[%d]: ", i);
|
||||
if (Atom.extractValue(AccelSection, DataOffset, FormParams)) {
|
||||
Atom.dump(W.getOStream());
|
||||
if (Optional<uint64_t> Val = Atom.getAsUnsignedConstant()) {
|
||||
if (std::optional<uint64_t> Val = Atom.getAsUnsignedConstant()) {
|
||||
StringRef Str = dwarf::AtomValueString(HdrData.Atoms[i].first, *Val);
|
||||
if (!Str.empty())
|
||||
W.getOStream() << " (" << Str << ")";
|
||||
|
@ -272,7 +272,7 @@ void AppleAcceleratorTable::Entry::extract(
|
|||
Atom.extractValue(AccelTable.AccelSection, Offset, FormParams);
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
AppleAcceleratorTable::Entry::lookup(HeaderData::AtomType Atom) const {
|
||||
assert(HdrData && "Dereferencing end iterator?");
|
||||
assert(HdrData->Atoms.size() == Values.size());
|
||||
|
@ -283,19 +283,20 @@ AppleAcceleratorTable::Entry::lookup(HeaderData::AtomType Atom) const {
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<uint64_t> AppleAcceleratorTable::Entry::getDIESectionOffset() const {
|
||||
std::optional<uint64_t>
|
||||
AppleAcceleratorTable::Entry::getDIESectionOffset() const {
|
||||
return HdrData->extractOffset(lookup(dwarf::DW_ATOM_die_offset));
|
||||
}
|
||||
|
||||
Optional<uint64_t> AppleAcceleratorTable::Entry::getCUOffset() const {
|
||||
std::optional<uint64_t> AppleAcceleratorTable::Entry::getCUOffset() const {
|
||||
return HdrData->extractOffset(lookup(dwarf::DW_ATOM_cu_offset));
|
||||
}
|
||||
|
||||
Optional<dwarf::Tag> AppleAcceleratorTable::Entry::getTag() const {
|
||||
Optional<DWARFFormValue> Tag = lookup(dwarf::DW_ATOM_die_tag);
|
||||
std::optional<dwarf::Tag> AppleAcceleratorTable::Entry::getTag() const {
|
||||
std::optional<DWARFFormValue> Tag = lookup(dwarf::DW_ATOM_die_tag);
|
||||
if (!Tag)
|
||||
return std::nullopt;
|
||||
if (Optional<uint64_t> Value = Tag->getAsUnsignedConstant())
|
||||
if (std::optional<uint64_t> Value = Tag->getAsUnsignedConstant())
|
||||
return dwarf::Tag(*Value);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
@ -534,7 +535,7 @@ DWARFDebugNames::Entry::Entry(const NameIndex &NameIdx, const Abbrev &Abbr)
|
|||
Values.emplace_back(Attr.Form);
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
DWARFDebugNames::Entry::lookup(dwarf::Index Index) const {
|
||||
assert(Abbr->Attributes.size() == Values.size());
|
||||
for (auto Tuple : zip_first(Abbr->Attributes, Values)) {
|
||||
|
@ -544,14 +545,14 @@ DWARFDebugNames::Entry::lookup(dwarf::Index Index) const {
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDebugNames::Entry::getDIEUnitOffset() const {
|
||||
if (Optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_die_offset))
|
||||
std::optional<uint64_t> DWARFDebugNames::Entry::getDIEUnitOffset() const {
|
||||
if (std::optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_die_offset))
|
||||
return Off->getAsReferenceUVal();
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDebugNames::Entry::getCUIndex() const {
|
||||
if (Optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_compile_unit))
|
||||
std::optional<uint64_t> DWARFDebugNames::Entry::getCUIndex() const {
|
||||
if (std::optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_compile_unit))
|
||||
return Off->getAsUnsignedConstant();
|
||||
// In a per-CU index, the entries without a DW_IDX_compile_unit attribute
|
||||
// implicitly refer to the single CU.
|
||||
|
@ -560,8 +561,8 @@ Optional<uint64_t> DWARFDebugNames::Entry::getCUIndex() const {
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDebugNames::Entry::getCUOffset() const {
|
||||
Optional<uint64_t> Index = getCUIndex();
|
||||
std::optional<uint64_t> DWARFDebugNames::Entry::getCUOffset() const {
|
||||
std::optional<uint64_t> Index = getCUIndex();
|
||||
if (!Index || *Index >= NameIdx->getCUCount())
|
||||
return std::nullopt;
|
||||
return NameIdx->getCUOffset(*Index);
|
||||
|
@ -683,7 +684,7 @@ bool DWARFDebugNames::NameIndex::dumpEntry(ScopedPrinter &W,
|
|||
|
||||
void DWARFDebugNames::NameIndex::dumpName(ScopedPrinter &W,
|
||||
const NameTableEntry &NTE,
|
||||
Optional<uint32_t> Hash) const {
|
||||
std::optional<uint32_t> Hash) const {
|
||||
DictScope NameScope(W, ("Name " + Twine(NTE.getIndex())).str());
|
||||
if (Hash)
|
||||
W.printHex("Hash", *Hash);
|
||||
|
@ -793,7 +794,7 @@ LLVM_DUMP_METHOD void DWARFDebugNames::dump(raw_ostream &OS) const {
|
|||
NI.dump(W);
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
DWARFDebugNames::ValueIterator::findEntryOffsetInCurrentIndex() {
|
||||
const Header &Hdr = CurrentIndex->Hdr;
|
||||
if (Hdr.BucketCount == 0) {
|
||||
|
@ -837,7 +838,7 @@ bool DWARFDebugNames::ValueIterator::getEntryAtCurrentOffset() {
|
|||
}
|
||||
|
||||
bool DWARFDebugNames::ValueIterator::findInCurrentIndex() {
|
||||
Optional<uint64_t> Offset = findEntryOffsetInCurrentIndex();
|
||||
std::optional<uint64_t> Offset = findEntryOffsetInCurrentIndex();
|
||||
if (!Offset)
|
||||
return false;
|
||||
DataOffset = *Offset;
|
||||
|
|
|
@ -103,7 +103,7 @@ static void dumpUUID(raw_ostream &OS, const ObjectFile &Obj) {
|
|||
}
|
||||
|
||||
using ContributionCollection =
|
||||
std::vector<Optional<StrOffsetsContributionDescriptor>>;
|
||||
std::vector<std::optional<StrOffsetsContributionDescriptor>>;
|
||||
|
||||
// Collect all the contributions to the string offsets table from all units,
|
||||
// sort them by their starting offsets and remove duplicates.
|
||||
|
@ -117,8 +117,8 @@ collectContributionData(DWARFContext::unit_iterator_range Units) {
|
|||
// the start of the contributions vector. This way they are reported
|
||||
// first.
|
||||
llvm::sort(Contributions,
|
||||
[](const Optional<StrOffsetsContributionDescriptor> &L,
|
||||
const Optional<StrOffsetsContributionDescriptor> &R) {
|
||||
[](const std::optional<StrOffsetsContributionDescriptor> &L,
|
||||
const std::optional<StrOffsetsContributionDescriptor> &R) {
|
||||
if (L && R)
|
||||
return L->Base < R->Base;
|
||||
return R.has_value();
|
||||
|
@ -129,8 +129,8 @@ collectContributionData(DWARFContext::unit_iterator_range Units) {
|
|||
// to report them more than once.
|
||||
Contributions.erase(
|
||||
std::unique(Contributions.begin(), Contributions.end(),
|
||||
[](const Optional<StrOffsetsContributionDescriptor> &L,
|
||||
const Optional<StrOffsetsContributionDescriptor> &R) {
|
||||
[](const std::optional<StrOffsetsContributionDescriptor> &L,
|
||||
const std::optional<StrOffsetsContributionDescriptor> &R) {
|
||||
if (L && R)
|
||||
return L->Base == R->Base && L->Size == R->Size;
|
||||
return false;
|
||||
|
@ -245,7 +245,7 @@ static void dumpAddrSection(raw_ostream &OS, DWARFDataExtractor &AddrData,
|
|||
// Dump the .debug_rnglists or .debug_rnglists.dwo section (DWARF v5).
|
||||
static void dumpRnglistsSection(
|
||||
raw_ostream &OS, DWARFDataExtractor &rnglistData,
|
||||
llvm::function_ref<Optional<object::SectionedAddress>(uint32_t)>
|
||||
llvm::function_ref<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress,
|
||||
DIDumpOptions DumpOpts) {
|
||||
uint64_t Offset = 0;
|
||||
|
@ -312,7 +312,7 @@ static void dumpLoclistsSection(raw_ostream &OS, DIDumpOptions DumpOpts,
|
|||
DWARFDataExtractor Data,
|
||||
const MCRegisterInfo *MRI,
|
||||
const DWARFObject &Obj,
|
||||
Optional<uint64_t> DumpOffset) {
|
||||
std::optional<uint64_t> DumpOffset) {
|
||||
uint64_t Offset = 0;
|
||||
|
||||
while (Data.isValidOffset(Offset)) {
|
||||
|
@ -351,7 +351,7 @@ static void dumpPubTableSection(raw_ostream &OS, DIDumpOptions DumpOpts,
|
|||
|
||||
void DWARFContext::dump(
|
||||
raw_ostream &OS, DIDumpOptions DumpOpts,
|
||||
std::array<Optional<uint64_t>, DIDT_ID_Count> DumpOffsets) {
|
||||
std::array<std::optional<uint64_t>, DIDT_ID_Count> DumpOffsets) {
|
||||
uint64_t DumpType = DumpOpts.DumpType;
|
||||
|
||||
StringRef Extension = sys::path::extension(DObj->getFileName());
|
||||
|
@ -368,7 +368,7 @@ void DWARFContext::dump(
|
|||
bool Explicit = DumpType != DIDT_All && !IsDWO;
|
||||
bool ExplicitDWO = Explicit && IsDWO;
|
||||
auto shouldDump = [&](bool Explicit, const char *Name, unsigned ID,
|
||||
StringRef Section) -> Optional<uint64_t> * {
|
||||
StringRef Section) -> std::optional<uint64_t> * {
|
||||
unsigned Mask = 1U << ID;
|
||||
bool Should = (DumpType & Mask) && (Explicit || !Section.empty());
|
||||
if (!Should)
|
||||
|
@ -459,7 +459,7 @@ void DWARFContext::dump(
|
|||
}
|
||||
}
|
||||
|
||||
if (const Optional<uint64_t> *Off =
|
||||
if (const std::optional<uint64_t> *Off =
|
||||
shouldDump(Explicit, ".debug_frame", DIDT_ID_DebugFrame,
|
||||
DObj->getFrameSection().Data)) {
|
||||
if (Expected<const DWARFDebugFrame *> DF = getDebugFrame())
|
||||
|
@ -468,7 +468,7 @@ void DWARFContext::dump(
|
|||
RecoverableErrorHandler(DF.takeError());
|
||||
}
|
||||
|
||||
if (const Optional<uint64_t> *Off =
|
||||
if (const std::optional<uint64_t> *Off =
|
||||
shouldDump(Explicit, ".eh_frame", DIDT_ID_DebugFrame,
|
||||
DObj->getEHFrameSection().Data)) {
|
||||
if (Expected<const DWARFDebugFrame *> DF = getEHFrame())
|
||||
|
@ -519,7 +519,7 @@ void DWARFContext::dump(
|
|||
|
||||
auto DumpLineSection = [&](DWARFDebugLine::SectionParser Parser,
|
||||
DIDumpOptions DumpOpts,
|
||||
Optional<uint64_t> DumpOffset) {
|
||||
std::optional<uint64_t> DumpOffset) {
|
||||
while (!Parser.done()) {
|
||||
if (DumpOffset && Parser.getOffset() != *DumpOffset) {
|
||||
Parser.skip(DumpOpts.WarningHandler, DumpOpts.WarningHandler);
|
||||
|
@ -612,7 +612,8 @@ void DWARFContext::dump(
|
|||
}
|
||||
}
|
||||
|
||||
auto LookupPooledAddress = [&](uint32_t Index) -> Optional<SectionedAddress> {
|
||||
auto LookupPooledAddress =
|
||||
[&](uint32_t Index) -> std::optional<SectionedAddress> {
|
||||
const auto &CUs = compile_units();
|
||||
auto I = CUs.begin();
|
||||
if (I == CUs.end())
|
||||
|
@ -712,7 +713,7 @@ DWARFTypeUnit *DWARFContext::getTypeUnitForHash(uint16_t Version, uint64_t Hash,
|
|||
|
||||
struct UnitContainers {
|
||||
const DWARFUnitVector &Units;
|
||||
Optional<DenseMap<uint64_t, DWARFTypeUnit *>> ⤅
|
||||
std::optional<DenseMap<uint64_t, DWARFTypeUnit *>> ⤅
|
||||
};
|
||||
UnitContainers Units = IsDWO ? UnitContainers{DWOUnits, DWOTypeUnits}
|
||||
: UnitContainers{NormalUnits, NormalTypeUnits};
|
||||
|
@ -744,8 +745,8 @@ DWARFCompileUnit *DWARFContext::getDWOCompileUnitForHash(uint64_t Hash) {
|
|||
for (const auto &DWOCU : dwo_compile_units()) {
|
||||
// Might not have parsed DWO ID yet.
|
||||
if (!DWOCU->getDWOId()) {
|
||||
if (Optional<uint64_t> DWOId =
|
||||
toUnsigned(DWOCU->getUnitDIE().find(DW_AT_GNU_dwo_id)))
|
||||
if (std::optional<uint64_t> DWOId =
|
||||
toUnsigned(DWOCU->getUnitDIE().find(DW_AT_GNU_dwo_id)))
|
||||
DWOCU->setDWOId(*DWOId);
|
||||
else
|
||||
// No DWO ID?
|
||||
|
@ -1111,7 +1112,7 @@ static bool getFunctionNameAndStartLineForAddress(
|
|||
DWARFCompileUnit *CU, uint64_t Address, FunctionNameKind Kind,
|
||||
DILineInfoSpecifier::FileLineInfoKind FileNameKind,
|
||||
std::string &FunctionName, std::string &StartFile, uint32_t &StartLine,
|
||||
Optional<uint64_t> &StartAddress) {
|
||||
std::optional<uint64_t> &StartAddress) {
|
||||
// The address may correspond to instruction in some inlined function,
|
||||
// so we have to build the chain of inlined functions and take the
|
||||
// name of the topmost function in it.
|
||||
|
@ -1141,9 +1142,9 @@ static bool getFunctionNameAndStartLineForAddress(
|
|||
return FoundResult;
|
||||
}
|
||||
|
||||
static Optional<int64_t>
|
||||
static std::optional<int64_t>
|
||||
getExpressionFrameOffset(ArrayRef<uint8_t> Expr,
|
||||
Optional<unsigned> FrameBaseReg) {
|
||||
std::optional<unsigned> FrameBaseReg) {
|
||||
if (!Expr.empty() &&
|
||||
(Expr[0] == DW_OP_fbreg ||
|
||||
(FrameBaseReg && Expr[0] == DW_OP_breg0 + *FrameBaseReg))) {
|
||||
|
@ -1168,9 +1169,9 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram,
|
|||
if (const char *Name = Subprogram.getSubroutineName(DINameKind::ShortName))
|
||||
Local.FunctionName = Name;
|
||||
|
||||
Optional<unsigned> FrameBaseReg;
|
||||
std::optional<unsigned> FrameBaseReg;
|
||||
if (auto FrameBase = Subprogram.find(DW_AT_frame_base))
|
||||
if (Optional<ArrayRef<uint8_t>> Expr = FrameBase->getAsBlock())
|
||||
if (std::optional<ArrayRef<uint8_t>> Expr = FrameBase->getAsBlock())
|
||||
if (!Expr->empty() && (*Expr)[0] >= DW_OP_reg0 &&
|
||||
(*Expr)[0] <= DW_OP_reg31) {
|
||||
FrameBaseReg = (*Expr)[0] - DW_OP_reg0;
|
||||
|
@ -1179,7 +1180,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram,
|
|||
if (Expected<std::vector<DWARFLocationExpression>> Loc =
|
||||
Die.getLocations(DW_AT_location)) {
|
||||
for (const auto &Entry : *Loc) {
|
||||
if (Optional<int64_t> FrameOffset =
|
||||
if (std::optional<int64_t> FrameOffset =
|
||||
getExpressionFrameOffset(Entry.Expr, FrameBaseReg)) {
|
||||
Local.FrameOffset = *FrameOffset;
|
||||
break;
|
||||
|
@ -1198,7 +1199,7 @@ void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram,
|
|||
Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin))
|
||||
Die = Origin;
|
||||
if (auto NameAttr = Die.find(DW_AT_name))
|
||||
if (Optional<const char *> Name = dwarf::toString(*NameAttr))
|
||||
if (std::optional<const char *> Name = dwarf::toString(*NameAttr))
|
||||
Local.Name = *Name;
|
||||
if (auto Type = Die.getAttributeValueAsReferencedDie(DW_AT_type))
|
||||
Local.Size = Type.getTypeSize(getCUAddrSize());
|
||||
|
@ -1285,7 +1286,7 @@ DILineInfoTable DWARFContext::getLineInfoForAddressRange(
|
|||
uint32_t StartLine = 0;
|
||||
std::string StartFileName;
|
||||
std::string FunctionName(DILineInfo::BadString);
|
||||
Optional<uint64_t> StartAddress;
|
||||
std::optional<uint64_t> StartAddress;
|
||||
getFunctionNameAndStartLineForAddress(CU, Address.Address, Spec.FNKind,
|
||||
Spec.FLIKind, FunctionName,
|
||||
StartFileName, StartLine, StartAddress);
|
||||
|
@ -1846,9 +1847,9 @@ public:
|
|||
if (Supports && Supports(Reloc.getType())) {
|
||||
auto I = Map->try_emplace(
|
||||
Reloc.getOffset(),
|
||||
RelocAddrEntry{SymInfoOrErr->SectionIndex, Reloc,
|
||||
SymInfoOrErr->Address,
|
||||
Optional<object::RelocationRef>(), 0, Resolver});
|
||||
RelocAddrEntry{
|
||||
SymInfoOrErr->SectionIndex, Reloc, SymInfoOrErr->Address,
|
||||
std::optional<object::RelocationRef>(), 0, Resolver});
|
||||
// If we didn't successfully insert that's because we already had a
|
||||
// relocation for that offset. Store it as a second relocation in the
|
||||
// same RelocAddrEntry instead.
|
||||
|
|
|
@ -68,7 +68,7 @@ uint64_t DWARFDataExtractor::getRelocatedValue(uint32_t Size, uint64_t *Off,
|
|||
return R;
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
DWARFDataExtractor::getEncodedPointer(uint64_t *Offset, uint8_t Encoding,
|
||||
uint64_t PCRelOffset) const {
|
||||
if (Encoding == dwarf::DW_EH_PE_omit)
|
||||
|
|
|
@ -177,9 +177,8 @@ Expected<uint64_t> DWARFDebugAddrTable::getAddrEntry(uint32_t Index) const {
|
|||
Index, Offset);
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDebugAddrTable::getFullLength() const {
|
||||
std::optional<uint64_t> DWARFDebugAddrTable::getFullLength() const {
|
||||
if (Length == 0)
|
||||
return std::nullopt;
|
||||
return Length + dwarf::getUnitLengthFieldByteSize(Format);
|
||||
}
|
||||
|
||||
|
|
|
@ -63,13 +63,13 @@ UnwindLocation UnwindLocation::createAtCFAPlusOffset(int32_t Offset) {
|
|||
|
||||
UnwindLocation
|
||||
UnwindLocation::createIsRegisterPlusOffset(uint32_t RegNum, int32_t Offset,
|
||||
Optional<uint32_t> AddrSpace) {
|
||||
std::optional<uint32_t> AddrSpace) {
|
||||
return {RegPlusOffset, RegNum, Offset, AddrSpace, false};
|
||||
}
|
||||
|
||||
UnwindLocation
|
||||
UnwindLocation::createAtRegisterPlusOffset(uint32_t RegNum, int32_t Offset,
|
||||
Optional<uint32_t> AddrSpace) {
|
||||
std::optional<uint32_t> AddrSpace) {
|
||||
return {RegPlusOffset, RegNum, Offset, AddrSpace, true};
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@ Error UnwindTable::parseRows(const CFIProgram &CFIP, UnwindRow &Row,
|
|||
llvm::Expected<uint64_t> RegNum = Inst.getOperandAsUnsigned(CFIP, 0);
|
||||
if (!RegNum)
|
||||
return RegNum.takeError();
|
||||
if (Optional<UnwindLocation> O =
|
||||
if (std::optional<UnwindLocation> O =
|
||||
InitialLocs->getRegisterLocation(*RegNum))
|
||||
Row.getRegisterLocations().setRegisterLocation(*RegNum, *O);
|
||||
else
|
||||
|
@ -1089,8 +1089,8 @@ Error DWARFDebugFrame::parse(DWARFDataExtractor Data) {
|
|||
StringRef AugmentationData("");
|
||||
uint32_t FDEPointerEncoding = DW_EH_PE_absptr;
|
||||
uint32_t LSDAPointerEncoding = DW_EH_PE_omit;
|
||||
Optional<uint64_t> Personality;
|
||||
Optional<uint32_t> PersonalityEncoding;
|
||||
std::optional<uint64_t> Personality;
|
||||
std::optional<uint32_t> PersonalityEncoding;
|
||||
if (IsEH) {
|
||||
std::optional<uint64_t> AugmentationLength;
|
||||
uint64_t StartAugmentationOffset;
|
||||
|
@ -1170,7 +1170,7 @@ Error DWARFDebugFrame::parse(DWARFDataExtractor Data) {
|
|||
uint64_t CIEPointer = Id;
|
||||
uint64_t InitialLocation = 0;
|
||||
uint64_t AddressRange = 0;
|
||||
Optional<uint64_t> LSDAAddress;
|
||||
std::optional<uint64_t> LSDAAddress;
|
||||
CIE *Cie = CIEs[IsEH ? (StartStructureOffset - CIEPointer) : CIEPointer];
|
||||
|
||||
if (IsEH) {
|
||||
|
@ -1244,7 +1244,7 @@ FrameEntry *DWARFDebugFrame::getEntryAtOffset(uint64_t Offset) const {
|
|||
|
||||
void DWARFDebugFrame::dump(raw_ostream &OS, DIDumpOptions DumpOpts,
|
||||
const MCRegisterInfo *MRI,
|
||||
Optional<uint64_t> Offset) const {
|
||||
std::optional<uint64_t> Offset) const {
|
||||
if (Offset) {
|
||||
if (auto *Entry = getEntryAtOffset(*Offset))
|
||||
Entry->dump(OS, DumpOpts, MRI, IsEH);
|
||||
|
|
|
@ -67,7 +67,8 @@ bool DWARFDebugInfoEntry::extractFast(const DWARFUnit &U, uint64_t *OffsetPtr,
|
|||
}
|
||||
// See if all attributes in this DIE have fixed byte sizes. If so, we can
|
||||
// just add this size to the offset to skip to the next DIE.
|
||||
if (Optional<size_t> FixedSize = AbbrevDecl->getFixedAttributesByteSize(U)) {
|
||||
if (std::optional<size_t> FixedSize =
|
||||
AbbrevDecl->getFixedAttributesByteSize(U)) {
|
||||
*OffsetPtr += *FixedSize;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -79,7 +79,8 @@ bool DWARFDebugLine::Prologue::hasFileAtIndex(uint64_t FileIndex) const {
|
|||
return FileIndex != 0 && FileIndex <= FileNames.size();
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDebugLine::Prologue::getLastValidFileIndex() const {
|
||||
std::optional<uint64_t>
|
||||
DWARFDebugLine::Prologue::getLastValidFileIndex() const {
|
||||
if (FileNames.empty())
|
||||
return std::nullopt;
|
||||
uint16_t DwarfVersion = getVersion();
|
||||
|
@ -717,8 +718,8 @@ DWARFDebugLine::ParsingState::handleSpecialOpcode(uint8_t Opcode,
|
|||
/// Parse a ULEB128 using the specified \p Cursor. \returns the parsed value on
|
||||
/// success, or None if \p Cursor is in a failing state.
|
||||
template <typename T>
|
||||
static Optional<T> parseULEB128(DWARFDataExtractor &Data,
|
||||
DataExtractor::Cursor &Cursor) {
|
||||
static std::optional<T> parseULEB128(DWARFDataExtractor &Data,
|
||||
DataExtractor::Cursor &Cursor) {
|
||||
T Value = Data.getULEB128(Cursor);
|
||||
if (Cursor)
|
||||
return Value;
|
||||
|
@ -1005,7 +1006,7 @@ Error DWARFDebugLine::LineTable::parse(
|
|||
// Takes a single unsigned LEB128 operand, multiplies it by the
|
||||
// min_inst_length field of the prologue, and adds the
|
||||
// result to the address register of the state machine.
|
||||
if (Optional<uint64_t> Operand =
|
||||
if (std::optional<uint64_t> Operand =
|
||||
parseULEB128<uint64_t>(TableData, Cursor)) {
|
||||
uint64_t AddrOffset =
|
||||
State.advanceAddr(*Operand, Opcode, OpcodeOffset);
|
||||
|
@ -1030,7 +1031,7 @@ Error DWARFDebugLine::LineTable::parse(
|
|||
case DW_LNS_set_file:
|
||||
// Takes a single unsigned LEB128 operand and stores it in the file
|
||||
// register of the state machine.
|
||||
if (Optional<uint16_t> File =
|
||||
if (std::optional<uint16_t> File =
|
||||
parseULEB128<uint16_t>(TableData, Cursor)) {
|
||||
State.Row.File = *File;
|
||||
if (Verbose)
|
||||
|
@ -1041,7 +1042,7 @@ Error DWARFDebugLine::LineTable::parse(
|
|||
case DW_LNS_set_column:
|
||||
// Takes a single unsigned LEB128 operand and stores it in the
|
||||
// column register of the state machine.
|
||||
if (Optional<uint16_t> Column =
|
||||
if (std::optional<uint16_t> Column =
|
||||
parseULEB128<uint16_t>(TableData, Cursor)) {
|
||||
State.Row.Column = *Column;
|
||||
if (Verbose)
|
||||
|
@ -1117,7 +1118,8 @@ Error DWARFDebugLine::LineTable::parse(
|
|||
case DW_LNS_set_isa:
|
||||
// Takes a single unsigned LEB128 operand and stores it in the
|
||||
// ISA register of the state machine.
|
||||
if (Optional<uint8_t> Isa = parseULEB128<uint8_t>(TableData, Cursor)) {
|
||||
if (std::optional<uint8_t> Isa =
|
||||
parseULEB128<uint8_t>(TableData, Cursor)) {
|
||||
State.Row.Isa = *Isa;
|
||||
if (Verbose)
|
||||
*OS << " (" << (uint64_t)State.Row.Isa << ")";
|
||||
|
@ -1135,7 +1137,7 @@ Error DWARFDebugLine::LineTable::parse(
|
|||
uint8_t OpcodeLength = Prologue.StandardOpcodeLengths[Opcode - 1];
|
||||
std::vector<uint64_t> Operands;
|
||||
for (uint8_t I = 0; I < OpcodeLength; ++I) {
|
||||
if (Optional<uint64_t> Value =
|
||||
if (std::optional<uint64_t> Value =
|
||||
parseULEB128<uint64_t>(TableData, Cursor))
|
||||
Operands.push_back(*Value);
|
||||
else
|
||||
|
@ -1330,8 +1332,9 @@ bool DWARFDebugLine::LineTable::lookupAddressRangeImpl(
|
|||
return true;
|
||||
}
|
||||
|
||||
Optional<StringRef> DWARFDebugLine::LineTable::getSourceByIndex(uint64_t FileIndex,
|
||||
FileLineInfoKind Kind) const {
|
||||
std::optional<StringRef>
|
||||
DWARFDebugLine::LineTable::getSourceByIndex(uint64_t FileIndex,
|
||||
FileLineInfoKind Kind) const {
|
||||
if (Kind == FileLineInfoKind::None || !Prologue.hasFileAtIndex(FileIndex))
|
||||
return std::nullopt;
|
||||
const FileNameEntry &Entry = Prologue.getFileNameEntry(FileIndex);
|
||||
|
|
|
@ -30,16 +30,17 @@ class DWARFObject;
|
|||
|
||||
namespace {
|
||||
class DWARFLocationInterpreter {
|
||||
Optional<object::SectionedAddress> Base;
|
||||
std::function<Optional<object::SectionedAddress>(uint32_t)> LookupAddr;
|
||||
std::optional<object::SectionedAddress> Base;
|
||||
std::function<std::optional<object::SectionedAddress>(uint32_t)> LookupAddr;
|
||||
|
||||
public:
|
||||
DWARFLocationInterpreter(
|
||||
Optional<object::SectionedAddress> Base,
|
||||
std::function<Optional<object::SectionedAddress>(uint32_t)> LookupAddr)
|
||||
std::optional<object::SectionedAddress> Base,
|
||||
std::function<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupAddr)
|
||||
: Base(Base), LookupAddr(std::move(LookupAddr)) {}
|
||||
|
||||
Expected<Optional<DWARFLocationExpression>>
|
||||
Expected<std::optional<DWARFLocationExpression>>
|
||||
Interpret(const DWARFLocationEntry &E);
|
||||
};
|
||||
} // namespace
|
||||
|
@ -48,7 +49,7 @@ static Error createResolverError(uint32_t Index, unsigned Kind) {
|
|||
return make_error<ResolverError>(Index, (dwarf::LoclistEntries)Kind);
|
||||
}
|
||||
|
||||
Expected<Optional<DWARFLocationExpression>>
|
||||
Expected<std::optional<DWARFLocationExpression>>
|
||||
DWARFLocationInterpreter::Interpret(const DWARFLocationEntry &E) {
|
||||
switch (E.Kind) {
|
||||
case dwarf::DW_LLE_end_of_list:
|
||||
|
@ -60,10 +61,10 @@ DWARFLocationInterpreter::Interpret(const DWARFLocationEntry &E) {
|
|||
return std::nullopt;
|
||||
}
|
||||
case dwarf::DW_LLE_startx_endx: {
|
||||
Optional<SectionedAddress> LowPC = LookupAddr(E.Value0);
|
||||
std::optional<SectionedAddress> LowPC = LookupAddr(E.Value0);
|
||||
if (!LowPC)
|
||||
return createResolverError(E.Value0, E.Kind);
|
||||
Optional<SectionedAddress> HighPC = LookupAddr(E.Value1);
|
||||
std::optional<SectionedAddress> HighPC = LookupAddr(E.Value1);
|
||||
if (!HighPC)
|
||||
return createResolverError(E.Value1, E.Kind);
|
||||
return DWARFLocationExpression{
|
||||
|
@ -71,7 +72,7 @@ DWARFLocationInterpreter::Interpret(const DWARFLocationEntry &E) {
|
|||
E.Loc};
|
||||
}
|
||||
case dwarf::DW_LLE_startx_length: {
|
||||
Optional<SectionedAddress> LowPC = LookupAddr(E.Value0);
|
||||
std::optional<SectionedAddress> LowPC = LookupAddr(E.Value0);
|
||||
if (!LowPC)
|
||||
return createResolverError(E.Value0, E.Kind);
|
||||
return DWARFLocationExpression{DWARFAddressRange{LowPC->Address,
|
||||
|
@ -120,21 +121,19 @@ static void dumpExpression(raw_ostream &OS, DIDumpOptions DumpOpts,
|
|||
DWARFExpression(Extractor, AddressSize).print(OS, DumpOpts, MRI, U);
|
||||
}
|
||||
|
||||
bool DWARFLocationTable::dumpLocationList(uint64_t *Offset, raw_ostream &OS,
|
||||
Optional<SectionedAddress> BaseAddr,
|
||||
const MCRegisterInfo *MRI,
|
||||
const DWARFObject &Obj, DWARFUnit *U,
|
||||
DIDumpOptions DumpOpts,
|
||||
unsigned Indent) const {
|
||||
bool DWARFLocationTable::dumpLocationList(
|
||||
uint64_t *Offset, raw_ostream &OS, std::optional<SectionedAddress> BaseAddr,
|
||||
const MCRegisterInfo *MRI, const DWARFObject &Obj, DWARFUnit *U,
|
||||
DIDumpOptions DumpOpts, unsigned Indent) const {
|
||||
DWARFLocationInterpreter Interp(
|
||||
BaseAddr, [U](uint32_t Index) -> Optional<SectionedAddress> {
|
||||
BaseAddr, [U](uint32_t Index) -> std::optional<SectionedAddress> {
|
||||
if (U)
|
||||
return U->getAddrOffsetSectionItem(Index);
|
||||
return std::nullopt;
|
||||
});
|
||||
OS << format("0x%8.8" PRIx64 ": ", *Offset);
|
||||
Error E = visitLocationList(Offset, [&](const DWARFLocationEntry &E) {
|
||||
Expected<Optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
|
||||
Expected<std::optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
|
||||
if (!Loc || DumpOpts.DisplayRawContents)
|
||||
dumpRawEntry(E, OS, Indent, DumpOpts, Obj);
|
||||
if (Loc && *Loc) {
|
||||
|
@ -170,12 +169,12 @@ bool DWARFLocationTable::dumpLocationList(uint64_t *Offset, raw_ostream &OS,
|
|||
}
|
||||
|
||||
Error DWARFLocationTable::visitAbsoluteLocationList(
|
||||
uint64_t Offset, Optional<SectionedAddress> BaseAddr,
|
||||
std::function<Optional<SectionedAddress>(uint32_t)> LookupAddr,
|
||||
uint64_t Offset, std::optional<SectionedAddress> BaseAddr,
|
||||
std::function<std::optional<SectionedAddress>(uint32_t)> LookupAddr,
|
||||
function_ref<bool(Expected<DWARFLocationExpression>)> Callback) const {
|
||||
DWARFLocationInterpreter Interp(BaseAddr, std::move(LookupAddr));
|
||||
return visitLocationList(&Offset, [&](const DWARFLocationEntry &E) {
|
||||
Expected<Optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
|
||||
Expected<std::optional<DWARFLocationExpression>> Loc = Interp.Interpret(E);
|
||||
if (!Loc)
|
||||
return Callback(Loc.takeError());
|
||||
if (*Loc)
|
||||
|
@ -186,7 +185,7 @@ Error DWARFLocationTable::visitAbsoluteLocationList(
|
|||
|
||||
void DWARFDebugLoc::dump(raw_ostream &OS, const MCRegisterInfo *MRI,
|
||||
const DWARFObject &Obj, DIDumpOptions DumpOpts,
|
||||
Optional<uint64_t> DumpOffset) const {
|
||||
std::optional<uint64_t> DumpOffset) const {
|
||||
auto BaseAddr = std::nullopt;
|
||||
unsigned Indent = 12;
|
||||
if (DumpOffset) {
|
||||
|
|
|
@ -105,8 +105,8 @@ void DWARFDebugMacro::dump(raw_ostream &OS) const {
|
|||
}
|
||||
|
||||
Error DWARFDebugMacro::parseImpl(
|
||||
Optional<DWARFUnitVector::compile_unit_range> Units,
|
||||
Optional<DataExtractor> StringExtractor, DWARFDataExtractor Data,
|
||||
std::optional<DWARFUnitVector::compile_unit_range> Units,
|
||||
std::optional<DataExtractor> StringExtractor, DWARFDataExtractor Data,
|
||||
bool IsMacro) {
|
||||
uint64_t Offset = 0;
|
||||
MacroList *M = nullptr;
|
||||
|
|
|
@ -85,7 +85,7 @@ void DWARFDebugRangeList::dump(raw_ostream &OS) const {
|
|||
}
|
||||
|
||||
DWARFAddressRangesVector DWARFDebugRangeList::getAbsoluteRanges(
|
||||
llvm::Optional<object::SectionedAddress> BaseAddr) const {
|
||||
std::optional<object::SectionedAddress> BaseAddr) const {
|
||||
DWARFAddressRangesVector Res;
|
||||
// debug_addr can't use the max integer tombstone because that's used for the
|
||||
// base address specifier entry - so use max-1.
|
||||
|
|
|
@ -86,15 +86,15 @@ Error RangeListEntry::extract(DWARFDataExtractor Data, uint64_t *OffsetPtr) {
|
|||
}
|
||||
|
||||
DWARFAddressRangesVector DWARFDebugRnglist::getAbsoluteRanges(
|
||||
llvm::Optional<object::SectionedAddress> BaseAddr, DWARFUnit &U) const {
|
||||
std::optional<object::SectionedAddress> BaseAddr, DWARFUnit &U) const {
|
||||
return getAbsoluteRanges(
|
||||
BaseAddr, U.getAddressByteSize(),
|
||||
[&](uint32_t Index) { return U.getAddrOffsetSectionItem(Index); });
|
||||
}
|
||||
|
||||
DWARFAddressRangesVector DWARFDebugRnglist::getAbsoluteRanges(
|
||||
Optional<object::SectionedAddress> BaseAddr, uint8_t AddressByteSize,
|
||||
function_ref<Optional<object::SectionedAddress>(uint32_t)>
|
||||
std::optional<object::SectionedAddress> BaseAddr, uint8_t AddressByteSize,
|
||||
function_ref<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress) const {
|
||||
DWARFAddressRangesVector Res;
|
||||
uint64_t Tombstone = dwarf::computeTombstoneAddress(AddressByteSize);
|
||||
|
@ -175,7 +175,7 @@ DWARFAddressRangesVector DWARFDebugRnglist::getAbsoluteRanges(
|
|||
void RangeListEntry::dump(
|
||||
raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength,
|
||||
uint64_t &CurrentBase, DIDumpOptions DumpOpts,
|
||||
llvm::function_ref<Optional<object::SectionedAddress>(uint32_t)>
|
||||
llvm::function_ref<std::optional<object::SectionedAddress>(uint32_t)>
|
||||
LookupPooledAddress) const {
|
||||
auto PrintRawEntry = [](raw_ostream &OS, const RangeListEntry &Entry,
|
||||
uint8_t AddrSize, DIDumpOptions DumpOpts) {
|
||||
|
|
|
@ -137,7 +137,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
|
|||
if (Attr == DW_AT_decl_file || Attr == DW_AT_call_file) {
|
||||
Color = HighlightColor::String;
|
||||
if (const auto *LT = U->getContext().getLineTableForUnit(U)) {
|
||||
if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant()) {
|
||||
if (std::optional<uint64_t> Val = FormValue.getAsUnsignedConstant()) {
|
||||
if (LT->getFileNameByIndex(
|
||||
*Val, U->getCompilationDir(),
|
||||
DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,
|
||||
|
@ -147,13 +147,13 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
|
||||
} else if (std::optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
|
||||
Name = AttributeValueString(Attr, *Val);
|
||||
|
||||
if (!Name.empty())
|
||||
WithColor(OS, Color) << Name;
|
||||
else if (Attr == DW_AT_decl_line || Attr == DW_AT_call_line) {
|
||||
if (Optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
|
||||
if (std::optional<uint64_t> Val = FormValue.getAsUnsignedConstant())
|
||||
OS << *Val;
|
||||
else
|
||||
FormValue.dump(OS, DumpOpts);
|
||||
|
@ -207,7 +207,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
|
|||
OS << '"';
|
||||
}
|
||||
} else if (Attr == DW_AT_APPLE_property_attribute) {
|
||||
if (Optional<uint64_t> OptVal = FormValue.getAsUnsignedConstant())
|
||||
if (std::optional<uint64_t> OptVal = FormValue.getAsUnsignedConstant())
|
||||
dumpApplePropertyAttribute(OS, *OptVal);
|
||||
} else if (Attr == DW_AT_ranges) {
|
||||
const DWARFObject &Obj = Die.getDwarfUnit()->getContext().getDWARFObj();
|
||||
|
@ -249,7 +249,7 @@ bool DWARFDie::isSubroutineDIE() const {
|
|||
return Tag == DW_TAG_subprogram || Tag == DW_TAG_inlined_subroutine;
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute Attr) const {
|
||||
std::optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute Attr) const {
|
||||
if (!isValid())
|
||||
return std::nullopt;
|
||||
auto AbbrevDecl = getAbbreviationDeclarationPtr();
|
||||
|
@ -258,7 +258,7 @@ Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute Attr) const {
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
DWARFDie::find(ArrayRef<dwarf::Attribute> Attrs) const {
|
||||
if (!isValid())
|
||||
return std::nullopt;
|
||||
|
@ -272,7 +272,7 @@ DWARFDie::find(ArrayRef<dwarf::Attribute> Attrs) const {
|
|||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue>
|
||||
std::optional<DWARFFormValue>
|
||||
DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const {
|
||||
SmallVector<DWARFDie, 3> Worklist;
|
||||
Worklist.push_back(*this);
|
||||
|
@ -307,7 +307,7 @@ DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const {
|
|||
|
||||
DWARFDie
|
||||
DWARFDie::getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const {
|
||||
if (Optional<DWARFFormValue> F = find(Attr))
|
||||
if (std::optional<DWARFFormValue> F = find(Attr))
|
||||
return getAttributeValueAsReferencedDie(*F);
|
||||
return DWARFDie();
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ DWARFDie::getAttributeValueAsReferencedDie(const DWARFFormValue &V) const {
|
|||
|
||||
DWARFDie DWARFDie::resolveTypeUnitReference() const {
|
||||
if (auto Attr = find(DW_AT_signature)) {
|
||||
if (Optional<uint64_t> Sig = Attr->getAsReferenceUVal()) {
|
||||
if (std::optional<uint64_t> Sig = Attr->getAsReferenceUVal()) {
|
||||
if (DWARFTypeUnit *TU = U->getContext().getTypeUnitForHash(
|
||||
U->getVersion(), *Sig, U->isDWOUnit()))
|
||||
return TU->getDIEForOffset(TU->getTypeOffset() + TU->getOffset());
|
||||
|
@ -337,15 +337,15 @@ DWARFDie DWARFDie::resolveTypeUnitReference() const {
|
|||
return *this;
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDie::getRangesBaseAttribute() const {
|
||||
std::optional<uint64_t> DWARFDie::getRangesBaseAttribute() const {
|
||||
return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base}));
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDie::getLocBaseAttribute() const {
|
||||
std::optional<uint64_t> DWARFDie::getLocBaseAttribute() const {
|
||||
return toSectionOffset(find(DW_AT_loclists_base));
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDie::getHighPC(uint64_t LowPC) const {
|
||||
std::optional<uint64_t> DWARFDie::getHighPC(uint64_t LowPC) const {
|
||||
uint64_t Tombstone = dwarf::computeTombstoneAddress(U->getAddressByteSize());
|
||||
if (LowPC == Tombstone)
|
||||
return std::nullopt;
|
||||
|
@ -385,7 +385,7 @@ Expected<DWARFAddressRangesVector> DWARFDie::getAddressRanges() const {
|
|||
if (getLowAndHighPC(LowPC, HighPC, Index))
|
||||
return DWARFAddressRangesVector{{LowPC, HighPC, Index}};
|
||||
|
||||
Optional<DWARFFormValue> Value = find(DW_AT_ranges);
|
||||
std::optional<DWARFFormValue> Value = find(DW_AT_ranges);
|
||||
if (Value) {
|
||||
if (Value->getForm() == DW_FORM_rnglistx)
|
||||
return U->findRnglistFromIndex(*Value->getAsSectionOffset());
|
||||
|
@ -409,12 +409,12 @@ bool DWARFDie::addressRangeContainsAddress(const uint64_t Address) const {
|
|||
|
||||
Expected<DWARFLocationExpressionsVector>
|
||||
DWARFDie::getLocations(dwarf::Attribute Attr) const {
|
||||
Optional<DWARFFormValue> Location = find(Attr);
|
||||
std::optional<DWARFFormValue> Location = find(Attr);
|
||||
if (!Location)
|
||||
return createStringError(inconvertibleErrorCode(), "No %s",
|
||||
dwarf::AttributeString(Attr).data());
|
||||
|
||||
if (Optional<uint64_t> Off = Location->getAsSectionOffset()) {
|
||||
if (std::optional<uint64_t> Off = Location->getAsSectionOffset()) {
|
||||
uint64_t Offset = *Off;
|
||||
|
||||
if (Location->getForm() == DW_FORM_loclistx) {
|
||||
|
@ -427,7 +427,7 @@ DWARFDie::getLocations(dwarf::Attribute Attr) const {
|
|||
return U->findLoclistFromOffset(Offset);
|
||||
}
|
||||
|
||||
if (Optional<ArrayRef<uint8_t>> Expr = Location->getAsBlock()) {
|
||||
if (std::optional<ArrayRef<uint8_t>> Expr = Location->getAsBlock()) {
|
||||
return DWARFLocationExpressionsVector{
|
||||
DWARFLocationExpression{std::nullopt, to_vector<4>(*Expr)}};
|
||||
}
|
||||
|
@ -492,9 +492,9 @@ void DWARFDie::getCallerFrame(uint32_t &CallFile, uint32_t &CallLine,
|
|||
CallDiscriminator = toUnsigned(find(DW_AT_GNU_discriminator), 0);
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) {
|
||||
std::optional<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) {
|
||||
if (auto SizeAttr = find(DW_AT_byte_size))
|
||||
if (Optional<uint64_t> Size = SizeAttr->getAsUnsignedConstant())
|
||||
if (std::optional<uint64_t> Size = SizeAttr->getAsUnsignedConstant())
|
||||
return Size;
|
||||
|
||||
switch (getTag()) {
|
||||
|
@ -521,7 +521,7 @@ Optional<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) {
|
|||
DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type);
|
||||
if (!BaseType)
|
||||
return std::nullopt;
|
||||
Optional<uint64_t> BaseSize = BaseType.getTypeSize(PointerSize);
|
||||
std::optional<uint64_t> BaseSize = BaseType.getTypeSize(PointerSize);
|
||||
if (!BaseSize)
|
||||
return std::nullopt;
|
||||
uint64_t Size = *BaseSize;
|
||||
|
@ -530,11 +530,11 @@ Optional<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) {
|
|||
continue;
|
||||
|
||||
if (auto ElemCountAttr = Child.find(DW_AT_count))
|
||||
if (Optional<uint64_t> ElemCount =
|
||||
if (std::optional<uint64_t> ElemCount =
|
||||
ElemCountAttr->getAsUnsignedConstant())
|
||||
Size *= *ElemCount;
|
||||
if (auto UpperBoundAttr = Child.find(DW_AT_upper_bound))
|
||||
if (Optional<int64_t> UpperBound =
|
||||
if (std::optional<int64_t> UpperBound =
|
||||
UpperBoundAttr->getAsSignedConstant()) {
|
||||
int64_t LowerBound = 0;
|
||||
if (auto LowerBoundAttr = Child.find(DW_AT_lower_bound))
|
||||
|
@ -592,7 +592,7 @@ void DWARFDie::dump(raw_ostream &OS, unsigned Indent,
|
|||
if (DumpOpts.Verbose) {
|
||||
OS << format(" [%u] %c", abbrCode,
|
||||
AbbrevDecl->hasChildren() ? '*' : ' ');
|
||||
if (Optional<uint32_t> ParentIdx = Die->getParentIdx())
|
||||
if (std::optional<uint32_t> ParentIdx = Die->getParentIdx())
|
||||
OS << format(" (0x%8.8" PRIx64 ")",
|
||||
U->getDIEAtIndex(*ParentIdx).getOffset());
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ static DWARFExpression::Operation::Description getOpDesc(unsigned OpCode) {
|
|||
|
||||
bool DWARFExpression::Operation::extract(DataExtractor Data,
|
||||
uint8_t AddressSize, uint64_t Offset,
|
||||
Optional<DwarfFormat> Format) {
|
||||
std::optional<DwarfFormat> Format) {
|
||||
EndOffset = Offset;
|
||||
Opcode = Data.getU8(&Offset);
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ bool DWARFFormValue::skipValue(dwarf::Form Form, DataExtractor DebugInfoData,
|
|||
case DW_FORM_GNU_ref_alt:
|
||||
case DW_FORM_GNU_strp_alt:
|
||||
case DW_FORM_implicit_const:
|
||||
if (Optional<uint8_t> FixedSize =
|
||||
if (std::optional<uint8_t> FixedSize =
|
||||
dwarf::getFixedFormByteSize(Form, Params)) {
|
||||
*OffsetPtr += *FixedSize;
|
||||
return true;
|
||||
|
@ -427,7 +427,8 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
|
|||
OS << "<invalid dwarf unit>";
|
||||
break;
|
||||
}
|
||||
Optional<object::SectionedAddress> A = U->getAddrOffsetSectionItem(UValue);
|
||||
std::optional<object::SectionedAddress> A =
|
||||
U->getAddrOffsetSectionItem(UValue);
|
||||
if (!A || DumpOpts.Verbose)
|
||||
AddrOS << format("indexed (%8.8x) address = ", (uint32_t)UValue);
|
||||
if (A)
|
||||
|
@ -443,7 +444,8 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
|
|||
}
|
||||
uint32_t Index = UValue >> 32;
|
||||
uint32_t Offset = UValue & 0xffffffff;
|
||||
Optional<object::SectionedAddress> A = U->getAddrOffsetSectionItem(Index);
|
||||
std::optional<object::SectionedAddress> A =
|
||||
U->getAddrOffsetSectionItem(Index);
|
||||
if (!A || DumpOpts.Verbose)
|
||||
AddrOS << format("indexed (%8.8x) + 0x%x address = ", Index, Offset);
|
||||
if (A) {
|
||||
|
@ -666,13 +668,13 @@ Expected<const char *> DWARFFormValue::getAsCString() const {
|
|||
inconvertibleErrorCode());
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFFormValue::getAsAddress() const {
|
||||
std::optional<uint64_t> DWARFFormValue::getAsAddress() const {
|
||||
if (auto SA = getAsSectionedAddress())
|
||||
return SA->Address;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<object::SectionedAddress>
|
||||
std::optional<object::SectionedAddress>
|
||||
DWARFFormValue::getAsSectionedAddress() const {
|
||||
if (!isFormClass(FC_Address))
|
||||
return std::nullopt;
|
||||
|
@ -682,7 +684,8 @@ DWARFFormValue::getAsSectionedAddress() const {
|
|||
uint32_t Index = AddrOffset ? (Value.uval >> 32) : Value.uval;
|
||||
if (!U)
|
||||
return std::nullopt;
|
||||
Optional<object::SectionedAddress> SA = U->getAddrOffsetSectionItem(Index);
|
||||
std::optional<object::SectionedAddress> SA =
|
||||
U->getAddrOffsetSectionItem(Index);
|
||||
if (!SA)
|
||||
return std::nullopt;
|
||||
if (AddrOffset)
|
||||
|
@ -692,13 +695,14 @@ DWARFFormValue::getAsSectionedAddress() const {
|
|||
return {{Value.uval, Value.SectionIndex}};
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFFormValue::getAsReference() const {
|
||||
std::optional<uint64_t> DWARFFormValue::getAsReference() const {
|
||||
if (auto R = getAsRelativeReference())
|
||||
return R->Unit ? R->Unit->getOffset() + R->Offset : R->Offset;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<DWARFFormValue::UnitOffset> DWARFFormValue::getAsRelativeReference() const {
|
||||
std::optional<DWARFFormValue::UnitOffset>
|
||||
DWARFFormValue::getAsRelativeReference() const {
|
||||
if (!isFormClass(FC_Reference))
|
||||
return std::nullopt;
|
||||
switch (Form) {
|
||||
|
@ -719,20 +723,20 @@ Optional<DWARFFormValue::UnitOffset> DWARFFormValue::getAsRelativeReference() co
|
|||
}
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFFormValue::getAsSectionOffset() const {
|
||||
std::optional<uint64_t> DWARFFormValue::getAsSectionOffset() const {
|
||||
if (!isFormClass(FC_SectionOffset))
|
||||
return std::nullopt;
|
||||
return Value.uval;
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFFormValue::getAsUnsignedConstant() const {
|
||||
std::optional<uint64_t> DWARFFormValue::getAsUnsignedConstant() const {
|
||||
if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag)) ||
|
||||
Form == DW_FORM_sdata)
|
||||
return std::nullopt;
|
||||
return Value.uval;
|
||||
}
|
||||
|
||||
Optional<int64_t> DWARFFormValue::getAsSignedConstant() const {
|
||||
std::optional<int64_t> DWARFFormValue::getAsSignedConstant() const {
|
||||
if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag)) ||
|
||||
(Form == DW_FORM_udata &&
|
||||
uint64_t(std::numeric_limits<int64_t>::max()) < Value.uval))
|
||||
|
@ -751,26 +755,26 @@ Optional<int64_t> DWARFFormValue::getAsSignedConstant() const {
|
|||
}
|
||||
}
|
||||
|
||||
Optional<ArrayRef<uint8_t>> DWARFFormValue::getAsBlock() const {
|
||||
std::optional<ArrayRef<uint8_t>> DWARFFormValue::getAsBlock() const {
|
||||
if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc) &&
|
||||
Form != DW_FORM_data16)
|
||||
return std::nullopt;
|
||||
return makeArrayRef(Value.data, Value.uval);
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFFormValue::getAsCStringOffset() const {
|
||||
std::optional<uint64_t> DWARFFormValue::getAsCStringOffset() const {
|
||||
if (!isFormClass(FC_String) && Form == DW_FORM_string)
|
||||
return std::nullopt;
|
||||
return Value.uval;
|
||||
}
|
||||
|
||||
Optional<uint64_t> DWARFFormValue::getAsReferenceUVal() const {
|
||||
std::optional<uint64_t> DWARFFormValue::getAsReferenceUVal() const {
|
||||
if (!isFormClass(FC_Reference))
|
||||
return std::nullopt;
|
||||
return Value.uval;
|
||||
}
|
||||
|
||||
Optional<std::string>
|
||||
std::optional<std::string>
|
||||
DWARFFormValue::getAsFile(DILineInfoSpecifier::FileLineInfoKind Kind) const {
|
||||
if (U == nullptr || !isFormClass(FC_Constant))
|
||||
return std::nullopt;
|
||||
|
|
|
@ -19,19 +19,19 @@ void DWARFTypePrinter::appendArrayType(const DWARFDie &D) {
|
|||
for (const DWARFDie &C : D.children()) {
|
||||
if (C.getTag() != DW_TAG_subrange_type)
|
||||
continue;
|
||||
Optional<uint64_t> LB;
|
||||
Optional<uint64_t> Count;
|
||||
Optional<uint64_t> UB;
|
||||
Optional<unsigned> DefaultLB;
|
||||
if (Optional<DWARFFormValue> L = C.find(DW_AT_lower_bound))
|
||||
std::optional<uint64_t> LB;
|
||||
std::optional<uint64_t> Count;
|
||||
std::optional<uint64_t> UB;
|
||||
std::optional<unsigned> DefaultLB;
|
||||
if (std::optional<DWARFFormValue> L = C.find(DW_AT_lower_bound))
|
||||
LB = L->getAsUnsignedConstant();
|
||||
if (Optional<DWARFFormValue> CountV = C.find(DW_AT_count))
|
||||
if (std::optional<DWARFFormValue> CountV = C.find(DW_AT_count))
|
||||
Count = CountV->getAsUnsignedConstant();
|
||||
if (Optional<DWARFFormValue> UpperV = C.find(DW_AT_upper_bound))
|
||||
if (std::optional<DWARFFormValue> UpperV = C.find(DW_AT_upper_bound))
|
||||
UB = UpperV->getAsUnsignedConstant();
|
||||
if (Optional<DWARFFormValue> LV =
|
||||
if (std::optional<DWARFFormValue> LV =
|
||||
D.getDwarfUnit()->getUnitDIE().find(DW_AT_language))
|
||||
if (Optional<uint64_t> LC = LV->getAsUnsignedConstant())
|
||||
if (std::optional<uint64_t> LC = LV->getAsUnsignedConstant())
|
||||
if ((DefaultLB =
|
||||
LanguageLowerBound(static_cast<dwarf::SourceLanguage>(*LC))))
|
||||
if (LB && *LB == *DefaultLB)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue