mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
[BOLT] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
@@ -323,7 +323,7 @@ public:
|
||||
if (FileBuildID)
|
||||
return StringRef(*FileBuildID);
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
void setFileBuildID(StringRef ID) { FileBuildID = std::string(ID); }
|
||||
|
||||
|
||||
@@ -980,7 +980,7 @@ public:
|
||||
if (Callback(StringRef(Name)))
|
||||
return StringRef(Name);
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Check if (possibly one out of many) function name matches the given
|
||||
@@ -1318,7 +1318,7 @@ public:
|
||||
/// Return the name of the section this function originated from.
|
||||
Optional<StringRef> getOriginSectionName() const {
|
||||
if (!OriginSection)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return OriginSection->getName();
|
||||
}
|
||||
|
||||
|
||||
@@ -1016,7 +1016,8 @@ public:
|
||||
/// Most of the time, using type units with DWO is not a good idea.
|
||||
/// If type units are used, the caller is responsible for verifying
|
||||
/// that abbreviations are shared by CU and TUs.
|
||||
DebugAbbrevWriter(DWARFContext &Context, Optional<uint64_t> DWOId = None)
|
||||
DebugAbbrevWriter(DWARFContext &Context,
|
||||
Optional<uint64_t> DWOId = std::nullopt)
|
||||
: Context(Context), DWOId(DWOId) {}
|
||||
|
||||
DebugAbbrevWriter(const DebugAbbrevWriter &) = delete;
|
||||
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
unsigned Index) const {
|
||||
const MCInst *AnnotationInst = getAnnotationInst(Inst);
|
||||
if (!AnnotationInst)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
for (int I = AnnotationInst->getNumOperands() - 1; I >= 0; --I) {
|
||||
int64_t ImmValue = AnnotationInst->getOperand(I).getImm();
|
||||
@@ -145,7 +145,7 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
protected:
|
||||
@@ -1670,7 +1670,7 @@ public:
|
||||
auto AI = AnnotationNameIndexMap.find(Name);
|
||||
if (AI != AnnotationNameIndexMap.end())
|
||||
return AI->second;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Return annotation index matching the \p Name. Create a new index if the
|
||||
|
||||
@@ -34,7 +34,7 @@ class ReachingDefOrUse
|
||||
|
||||
public:
|
||||
ReachingDefOrUse(const RegAnalysis &RA, BinaryFunction &BF,
|
||||
Optional<MCPhysReg> TrackingReg = None,
|
||||
Optional<MCPhysReg> TrackingReg = std::nullopt,
|
||||
MCPlusBuilder::AllocatorIdTy AllocId = 0)
|
||||
: InstrsDataflowAnalysis<ReachingDefOrUse<Def>, !Def>(BF, AllocId),
|
||||
RA(RA), TrackingReg(TrackingReg) {}
|
||||
@@ -125,7 +125,7 @@ protected:
|
||||
}
|
||||
// Gen
|
||||
if (!this->BC.MIB->isCFI(Point)) {
|
||||
if (TrackingReg == None) {
|
||||
if (TrackingReg == std::nullopt) {
|
||||
// Track all instructions
|
||||
Next.set(this->ExprToIdx[&Point]);
|
||||
} else {
|
||||
|
||||
@@ -98,7 +98,7 @@ private:
|
||||
DebugAbbrevWriter &AbbrevWriter,
|
||||
DebugLocWriter &DebugLocWriter,
|
||||
DebugRangesSectionWriter &RangesWriter,
|
||||
Optional<uint64_t> RangesBase = None);
|
||||
Optional<uint64_t> RangesBase = std::nullopt);
|
||||
|
||||
/// Patches the binary for an object's address ranges to be updated.
|
||||
/// The object can be anything that has associated address ranges via either
|
||||
@@ -109,12 +109,10 @@ private:
|
||||
/// \p DIE is the object's DIE in the input binary.
|
||||
/// \p RangesBase if present, update \p DIE to use DW_AT_GNU_ranges_base
|
||||
/// attribute.
|
||||
void updateDWARFObjectAddressRanges(const DWARFDie DIE,
|
||||
uint64_t DebugRangesOffset,
|
||||
SimpleBinaryPatcher &DebugInfoPatcher,
|
||||
DebugAbbrevWriter &AbbrevWriter,
|
||||
uint64_t LowPCToUse,
|
||||
Optional<uint64_t> RangesBase = None);
|
||||
void updateDWARFObjectAddressRanges(
|
||||
const DWARFDie DIE, uint64_t DebugRangesOffset,
|
||||
SimpleBinaryPatcher &DebugInfoPatcher, DebugAbbrevWriter &AbbrevWriter,
|
||||
uint64_t LowPCToUse, Optional<uint64_t> RangesBase = std::nullopt);
|
||||
|
||||
std::unique_ptr<DebugBufferVector>
|
||||
makeFinalLocListsSection(DebugInfoBinaryPatcher &DebugInfoPatcher,
|
||||
@@ -165,15 +163,16 @@ private:
|
||||
void convertToRangesPatchAbbrev(const DWARFUnit &Unit,
|
||||
const DWARFAbbreviationDeclaration *Abbrev,
|
||||
DebugAbbrevWriter &AbbrevWriter,
|
||||
Optional<uint64_t> RangesBase = None);
|
||||
Optional<uint64_t> RangesBase = std::nullopt);
|
||||
|
||||
/// Update \p DIE that was using DW_AT_(low|high)_pc with DW_AT_ranges offset.
|
||||
/// Updates to the DIE should be synced with abbreviation updates using the
|
||||
/// function above.
|
||||
void convertToRangesPatchDebugInfo(DWARFDie DIE, uint64_t RangesSectionOffset,
|
||||
SimpleBinaryPatcher &DebugInfoPatcher,
|
||||
uint64_t LowPCToUse,
|
||||
Optional<uint64_t> RangesBase = None);
|
||||
void
|
||||
convertToRangesPatchDebugInfo(DWARFDie DIE, uint64_t RangesSectionOffset,
|
||||
SimpleBinaryPatcher &DebugInfoPatcher,
|
||||
uint64_t LowPCToUse,
|
||||
Optional<uint64_t> RangesBase = std::nullopt);
|
||||
|
||||
/// Helper function for creating and returning per-DWO patchers/writers.
|
||||
template <class T, class Patcher>
|
||||
|
||||
@@ -1494,8 +1494,8 @@ unsigned BinaryContext::addDebugFilenameToUnit(const uint32_t DestCUID,
|
||||
FileName = *FName;
|
||||
assert(FileName != "");
|
||||
DWARFCompileUnit *DstUnit = DwCtx->getCompileUnitForOffset(DestCUID);
|
||||
return cantFail(getDwarfFile(Dir, FileName, 0, None, None, DestCUID,
|
||||
DstUnit->getVersion()));
|
||||
return cantFail(getDwarfFile(Dir, FileName, 0, std::nullopt, std::nullopt,
|
||||
DestCUID, DstUnit->getVersion()));
|
||||
}
|
||||
|
||||
std::vector<BinaryFunction *> BinaryContext::getSortedFunctions() {
|
||||
@@ -1530,7 +1530,7 @@ std::vector<BinaryFunction *> BinaryContext::getAllBinaryFunctions() {
|
||||
Optional<DWARFUnit *> BinaryContext::getDWOCU(uint64_t DWOId) {
|
||||
auto Iter = DWOCUs.find(DWOId);
|
||||
if (Iter == DWOCUs.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return Iter->second;
|
||||
}
|
||||
@@ -1657,7 +1657,7 @@ void BinaryContext::preprocessDebugInfo() {
|
||||
Iter->second->getUnitDIE().find(dwarf::DW_AT_name), nullptr);
|
||||
}
|
||||
BinaryLineTable.setRootFile(CU->getCompilationDir(), *Name, Checksum,
|
||||
None);
|
||||
std::nullopt);
|
||||
}
|
||||
|
||||
BinaryLineTable.setDwarfVersion(DwarfVersion);
|
||||
@@ -1665,8 +1665,8 @@ void BinaryContext::preprocessDebugInfo() {
|
||||
// Assign a unique label to every line table, one per CU.
|
||||
// Make sure empty debug line tables are registered too.
|
||||
if (FileNames.empty()) {
|
||||
cantFail(
|
||||
getDwarfFile("", "<unknown>", 0, None, None, CUID, DwarfVersion));
|
||||
cantFail(getDwarfFile("", "<unknown>", 0, std::nullopt, std::nullopt,
|
||||
CUID, DwarfVersion));
|
||||
continue;
|
||||
}
|
||||
const uint32_t Offset = DwarfVersion < 5 ? 1 : 0;
|
||||
@@ -1686,8 +1686,8 @@ void BinaryContext::preprocessDebugInfo() {
|
||||
Optional<MD5::MD5Result> Checksum;
|
||||
if (DwarfVersion >= 5 && LineTable->Prologue.ContentTypes.HasMD5)
|
||||
Checksum = LineTable->Prologue.FileNames[I].Checksum;
|
||||
cantFail(
|
||||
getDwarfFile(Dir, FileName, 0, Checksum, None, CUID, DwarfVersion));
|
||||
cantFail(getDwarfFile(Dir, FileName, 0, Checksum, std::nullopt, CUID,
|
||||
DwarfVersion));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1897,7 +1897,7 @@ BinaryContext::getBaseAddressForMapping(uint64_t MMapAddress,
|
||||
}
|
||||
}
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ErrorOr<BinarySection &> BinaryContext::getSectionForAddress(uint64_t Address) {
|
||||
|
||||
@@ -52,7 +52,7 @@ findAttributeInfo(const DWARFDie DIE,
|
||||
Optional<DWARFFormValue> Value =
|
||||
AbbrevDecl->getAttributeValueFromOffset(Index, Offset, U);
|
||||
if (!Value)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
// AttributeSpec
|
||||
const DWARFAbbreviationDeclaration::AttributeSpec *AttrVal =
|
||||
AbbrevDecl->attributes().begin() + Index;
|
||||
@@ -76,14 +76,14 @@ findAttributeInfo(const DWARFDie DIE,
|
||||
Optional<AttrInfo> findAttributeInfo(const DWARFDie DIE,
|
||||
dwarf::Attribute Attr) {
|
||||
if (!DIE.isValid())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
const DWARFAbbreviationDeclaration *AbbrevDecl =
|
||||
DIE.getAbbreviationDeclarationPtr();
|
||||
if (!AbbrevDecl)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
Optional<uint32_t> Index = AbbrevDecl->findAttributeIndex(Attr);
|
||||
if (!Index)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return findAttributeInfo(DIE, AbbrevDecl, *Index);
|
||||
}
|
||||
|
||||
@@ -1585,7 +1585,7 @@ void DwarfLineTable::emit(BinaryContext &BC, MCStreamer &Streamer) {
|
||||
if (LineTables.empty())
|
||||
return;
|
||||
// In a v5 non-split line table, put the strings in a separate section.
|
||||
Optional<MCDwarfLineStr> LineStr(None);
|
||||
Optional<MCDwarfLineStr> LineStr(std::nullopt);
|
||||
ErrorOr<BinarySection &> LineStrSection =
|
||||
BC.getUniqueSectionByName(".debug_line_str");
|
||||
// Some versions of GCC output DWARF5 .debug_info, but DWARF4 or lower
|
||||
|
||||
@@ -135,15 +135,15 @@ bool MCPlusBuilder::isTailCall(const MCInst &Inst) const {
|
||||
|
||||
Optional<MCLandingPad> MCPlusBuilder::getEHInfo(const MCInst &Inst) const {
|
||||
if (!isCall(Inst))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
Optional<int64_t> LPSym =
|
||||
getAnnotationOpValue(Inst, MCAnnotation::kEHLandingPad);
|
||||
if (!LPSym)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
Optional<int64_t> Action =
|
||||
getAnnotationOpValue(Inst, MCAnnotation::kEHAction);
|
||||
if (!Action)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return std::make_pair(reinterpret_cast<const MCSymbol *>(*LPSym),
|
||||
static_cast<uint64_t>(*Action));
|
||||
@@ -221,7 +221,7 @@ MCPlusBuilder::getConditionalTailCall(const MCInst &Inst) const {
|
||||
Optional<int64_t> Value =
|
||||
getAnnotationOpValue(Inst, MCAnnotation::kConditionalTailCall);
|
||||
if (!Value)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return static_cast<uint64_t>(*Value);
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ bool MCPlusBuilder::unsetConditionalTailCall(MCInst &Inst) {
|
||||
Optional<uint32_t> MCPlusBuilder::getOffset(const MCInst &Inst) const {
|
||||
Optional<int64_t> Value = getAnnotationOpValue(Inst, MCAnnotation::kOffset);
|
||||
if (!Value)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return static_cast<uint32_t>(*Value);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ void dumpFunction(const BinaryFunction &BF) {
|
||||
/*ShowInst=*/false));
|
||||
AsmStreamer->initSections(true, *BC.STI);
|
||||
std::unique_ptr<TargetMachine> TM(BC.TheTarget->createTargetMachine(
|
||||
BC.TripleName, "", "", TargetOptions(), None));
|
||||
BC.TripleName, "", "", TargetOptions(), std::nullopt));
|
||||
std::unique_ptr<AsmPrinter> MAP(
|
||||
BC.TheTarget->createAsmPrinter(*TM, std::move(AsmStreamer)));
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ ReachingDefOrUse</*Def=*/true> &DataflowInfoManager::getReachingDefs() {
|
||||
if (RD)
|
||||
return *RD;
|
||||
assert(RA && "RegAnalysis required");
|
||||
RD.reset(new ReachingDefOrUse<true>(*RA, BF, None, AllocatorId));
|
||||
RD.reset(new ReachingDefOrUse<true>(*RA, BF, std::nullopt, AllocatorId));
|
||||
RD->run();
|
||||
return *RD;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ ReachingDefOrUse</*Def=*/false> &DataflowInfoManager::getReachingUses() {
|
||||
if (RU)
|
||||
return *RU;
|
||||
assert(RA && "RegAnalysis required");
|
||||
RU.reset(new ReachingDefOrUse<false>(*RA, BF, None, AllocatorId));
|
||||
RU.reset(new ReachingDefOrUse<false>(*RA, BF, std::nullopt, AllocatorId));
|
||||
RU->run();
|
||||
return *RU;
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ BoltAddressTranslation::getFallthroughsInTrace(uint64_t FuncAddress,
|
||||
|
||||
auto Iter = Maps.find(FuncAddress);
|
||||
if (Iter == Maps.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
const MapTy &Map = Iter->second;
|
||||
auto FromIter = Map.upper_bound(From);
|
||||
|
||||
@@ -247,7 +247,7 @@ void DataAggregator::launchPerfProcess(StringRef Name, PerfProcessInfo &PPI,
|
||||
TempFiles.push_back(PPI.StderrPath.data());
|
||||
|
||||
std::optional<StringRef> Redirects[] = {
|
||||
llvm::None, // Stdin
|
||||
std::nullopt, // Stdin
|
||||
StringRef(PPI.StdoutPath.data()), // Stdout
|
||||
StringRef(PPI.StderrPath.data())}; // Stderr
|
||||
|
||||
@@ -261,9 +261,9 @@ void DataAggregator::launchPerfProcess(StringRef Name, PerfProcessInfo &PPI,
|
||||
|
||||
if (Wait)
|
||||
PPI.PI.ReturnCode = sys::ExecuteAndWait(PerfPath.data(), Argv,
|
||||
/*envp*/ llvm::None, Redirects);
|
||||
/*envp*/ std::nullopt, Redirects);
|
||||
else
|
||||
PPI.PI = sys::ExecuteNoWait(PerfPath.data(), Argv, /*envp*/ llvm::None,
|
||||
PPI.PI = sys::ExecuteNoWait(PerfPath.data(), Argv, /*envp*/ std::nullopt,
|
||||
Redirects);
|
||||
|
||||
free(WritableArgsString);
|
||||
@@ -943,7 +943,7 @@ DataAggregator::getFallthroughsInTrace(BinaryFunction &BF,
|
||||
SmallVector<std::pair<uint64_t, uint64_t>, 16> Res;
|
||||
|
||||
if (!recordTrace(BF, FirstLBR, SecondLBR, Count, &Res))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return Res;
|
||||
}
|
||||
@@ -1820,13 +1820,13 @@ Optional<int32_t> DataAggregator::parseCommExecEvent() {
|
||||
if (LineEnd == StringRef::npos) {
|
||||
reportError("expected rest of line");
|
||||
Diag << "Found: " << ParsingBuf << "\n";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
StringRef Line = ParsingBuf.substr(0, LineEnd);
|
||||
|
||||
size_t Pos = Line.find("PERF_RECORD_COMM exec");
|
||||
if (Pos == StringRef::npos)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
Line = Line.drop_front(Pos);
|
||||
|
||||
// Line:
|
||||
@@ -1836,7 +1836,7 @@ Optional<int32_t> DataAggregator::parseCommExecEvent() {
|
||||
if (PIDStr.getAsInteger(10, PID)) {
|
||||
reportError("expected PID");
|
||||
Diag << "Found: " << PIDStr << "in '" << Line << "'\n";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return PID;
|
||||
@@ -1850,7 +1850,7 @@ Optional<uint64_t> parsePerfTime(const StringRef TimeStr) {
|
||||
uint64_t USecTime;
|
||||
if (SecTimeStr.getAsInteger(10, SecTime) ||
|
||||
USecTimeStr.getAsInteger(10, USecTime))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return SecTime * 1000000ULL + USecTime;
|
||||
}
|
||||
}
|
||||
@@ -1863,14 +1863,14 @@ Optional<DataAggregator::ForkInfo> DataAggregator::parseForkEvent() {
|
||||
if (LineEnd == StringRef::npos) {
|
||||
reportError("expected rest of line");
|
||||
Diag << "Found: " << ParsingBuf << "\n";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
StringRef Line = ParsingBuf.substr(0, LineEnd);
|
||||
|
||||
size_t Pos = Line.find("PERF_RECORD_FORK");
|
||||
if (Pos == StringRef::npos) {
|
||||
consumeRestOfLine();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ForkInfo FI;
|
||||
@@ -1889,14 +1889,14 @@ Optional<DataAggregator::ForkInfo> DataAggregator::parseForkEvent() {
|
||||
if (ChildPIDStr.getAsInteger(10, FI.ChildPID)) {
|
||||
reportError("expected PID");
|
||||
Diag << "Found: " << ChildPIDStr << "in '" << Line << "'\n";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const StringRef ParentPIDStr = Line.rsplit('(').second.split(':').first;
|
||||
if (ParentPIDStr.getAsInteger(10, FI.ParentPID)) {
|
||||
reportError("expected PID");
|
||||
Diag << "Found: " << ParentPIDStr << "in '" << Line << "'\n";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
consumeRestOfLine();
|
||||
@@ -2147,17 +2147,17 @@ DataAggregator::parseNameBuildIDPair() {
|
||||
|
||||
ErrorOr<StringRef> BuildIDStr = parseString(FieldSeparator, true);
|
||||
if (std::error_code EC = BuildIDStr.getError())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// If one of the strings is missing, don't issue a parsing error, but still
|
||||
// do not return a value.
|
||||
consumeAllRemainingFS();
|
||||
if (checkNewLine())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
ErrorOr<StringRef> NameStr = parseString(FieldSeparator, true);
|
||||
if (std::error_code EC = NameStr.getError())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
consumeRestOfLine();
|
||||
return std::make_pair(NameStr.get(), BuildIDStr.get());
|
||||
@@ -2205,7 +2205,7 @@ DataAggregator::getFileNameForBuildID(StringRef FileBuildID) {
|
||||
if (!FileName.empty())
|
||||
return FileName;
|
||||
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::error_code
|
||||
|
||||
@@ -49,7 +49,7 @@ Optional<StringRef> getLTOCommonName(const StringRef Name) {
|
||||
return Name.substr(0, LTOSuffixPos + 11);
|
||||
if ((LTOSuffixPos = Name.find(".llvm.")) != StringRef::npos)
|
||||
return Name.substr(0, LTOSuffixPos + 6);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -67,7 +67,7 @@ Optional<AttrInfo> findAttributeInfo(const DWARFDie DIE,
|
||||
for (dwarf::Attribute &Attr : Attrs)
|
||||
if (Optional<AttrInfo> Info = findAttributeInfo(DIE, Attr))
|
||||
return Info;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
} // namespace bolt
|
||||
} // namespace llvm
|
||||
@@ -302,7 +302,7 @@ void DWARFRewriter::updateDebugInfo() {
|
||||
DebugLocWriter->finalize(*DwoDebugInfoPatcher, *DWOAbbrevWriter);
|
||||
DwoDebugInfoPatcher->clearDestinationLabels();
|
||||
if (!DwoDebugInfoPatcher->getWasRangBasedUsed())
|
||||
RangesBase = None;
|
||||
RangesBase = std::nullopt;
|
||||
if (Unit->getVersion() >= 5)
|
||||
TempRangesSectionWriter->finalizeSection();
|
||||
}
|
||||
@@ -821,7 +821,7 @@ void DWARFRewriter::updateDWARFObjectAddressRanges(
|
||||
DebugInfoPatcher.addLE32Patch(RangesBaseAttrInfo->Offset,
|
||||
static_cast<uint32_t>(*RangesBase),
|
||||
RangesBaseAttrInfo->Size);
|
||||
RangesBase = None;
|
||||
RangesBase = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1218,7 +1218,7 @@ updateDebugData(DWARFContext &DWCtx, std::string &Storage,
|
||||
|
||||
auto SectionIter = KnownSections.find(SectionName);
|
||||
if (SectionIter == KnownSections.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Streamer.switchSection(SectionIter->second.first);
|
||||
StringRef OutData = SectionContents;
|
||||
|
||||
@@ -229,7 +229,7 @@ Optional<uint64_t> readStartAddress(const MachOObjectFile &O) {
|
||||
}
|
||||
return (TextVMAddr && StartOffset)
|
||||
? Optional<uint64_t>(*TextVMAddr + *StartOffset)
|
||||
: llvm::None;
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
@@ -681,7 +681,7 @@ void RewriteInstance::parseBuildID() {
|
||||
|
||||
Optional<std::string> RewriteInstance::getPrintableBuildID() const {
|
||||
if (BuildID.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
std::string Str;
|
||||
raw_string_ostream OS(Str);
|
||||
@@ -4763,7 +4763,7 @@ void RewriteInstance::updateELFSymbolTable(
|
||||
assert(SymbolName && "cannot get symbol name");
|
||||
|
||||
auto updateSymbolValue = [&](const StringRef Name,
|
||||
Optional<uint64_t> Value = None) {
|
||||
Optional<uint64_t> Value = std::nullopt) {
|
||||
NewSymbol.st_value = Value ? *Value : getNewValueForSymbol(Name);
|
||||
NewSymbol.st_shndx = ELF::SHN_ABS;
|
||||
outs() << "BOLT-INFO: setting " << Name << " to 0x"
|
||||
|
||||
@@ -2600,7 +2600,7 @@ public:
|
||||
if (FKI.Flags & MCFixupKindInfo::FKF_IsPCRel) {
|
||||
switch (FKI.TargetSize) {
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
case 8: RelType = ELF::R_X86_64_PC8; break;
|
||||
case 16: RelType = ELF::R_X86_64_PC16; break;
|
||||
case 32: RelType = ELF::R_X86_64_PC32; break;
|
||||
@@ -2609,7 +2609,7 @@ public:
|
||||
} else {
|
||||
switch (FKI.TargetSize) {
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
case 8: RelType = ELF::R_X86_64_8; break;
|
||||
case 16: RelType = ELF::R_X86_64_16; break;
|
||||
case 32: RelType = ELF::R_X86_64_32; break;
|
||||
|
||||
@@ -69,7 +69,7 @@ std::string getUnescapedName(const StringRef &Name) {
|
||||
Optional<uint8_t> readDWARFExpressionTargetReg(StringRef ExprBytes) {
|
||||
uint8_t Opcode = ExprBytes[0];
|
||||
if (Opcode == dwarf::DW_CFA_def_cfa_expression)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
assert((Opcode == dwarf::DW_CFA_expression ||
|
||||
Opcode == dwarf::DW_CFA_val_expression) &&
|
||||
"invalid DWARF expression CFI");
|
||||
|
||||
Reference in New Issue
Block a user