forked from OSchip/llvm-project
[tools] 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:
parent
110115993c
commit
b4482f7ca0
|
@ -59,8 +59,8 @@ static int RunProgramWithTimeout(StringRef ProgramPath,
|
|||
unsigned MemoryLimit = 0,
|
||||
std::string *ErrMsg = nullptr) {
|
||||
std::optional<StringRef> Redirects[3] = {StdInFile, StdOutFile, StdErrFile};
|
||||
return sys::ExecuteAndWait(ProgramPath, Args, None, Redirects, NumSeconds,
|
||||
MemoryLimit, ErrMsg);
|
||||
return sys::ExecuteAndWait(ProgramPath, Args, std::nullopt, Redirects,
|
||||
NumSeconds, MemoryLimit, ErrMsg);
|
||||
}
|
||||
|
||||
/// RunProgramRemotelyWithTimeout - This function runs the given program
|
||||
|
@ -76,8 +76,8 @@ static int RunProgramRemotelyWithTimeout(
|
|||
std::optional<StringRef> Redirects[3] = {StdInFile, StdOutFile, StdErrFile};
|
||||
|
||||
// Run the program remotely with the remote client
|
||||
int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, None, Redirects,
|
||||
NumSeconds, MemoryLimit);
|
||||
int ReturnCode = sys::ExecuteAndWait(RemoteClientPath, Args, std::nullopt,
|
||||
Redirects, NumSeconds, MemoryLimit);
|
||||
|
||||
// Has the remote client fail?
|
||||
if (255 == ReturnCode) {
|
||||
|
|
|
@ -151,7 +151,8 @@ void MachODebugMapParser::addCommonSymbols() {
|
|||
// The main binary doesn't have an address for the given symbol.
|
||||
continue;
|
||||
}
|
||||
if (!CurrentDebugMapObject->addSymbol(CommonSymbol, None /*ObjectAddress*/,
|
||||
if (!CurrentDebugMapObject->addSymbol(CommonSymbol,
|
||||
std::nullopt /*ObjectAddress*/,
|
||||
CommonAddr, 0 /*size*/)) {
|
||||
// The symbol is already present.
|
||||
continue;
|
||||
|
@ -533,9 +534,9 @@ void MachODebugMapParser::loadCurrentObjectFileSymbols(
|
|||
// in the DebugMap, leave it unassigned for these symbols.
|
||||
uint32_t Flags = cantFail(Sym.getFlags());
|
||||
if (Flags & SymbolRef::SF_Absolute) {
|
||||
CurrentObjectAddresses[*Name] = None;
|
||||
CurrentObjectAddresses[*Name] = std::nullopt;
|
||||
} else if (Flags & SymbolRef::SF_Common) {
|
||||
CurrentObjectAddresses[*Name] = None;
|
||||
CurrentObjectAddresses[*Name] = std::nullopt;
|
||||
CommonSymbols.push_back(std::string(*Name));
|
||||
} else {
|
||||
CurrentObjectAddresses[*Name] = Addr;
|
||||
|
|
|
@ -66,7 +66,8 @@ static bool runLipo(StringRef SDKPath, SmallVectorImpl<StringRef> &Args) {
|
|||
}
|
||||
|
||||
std::string ErrMsg;
|
||||
int result = sys::ExecuteAndWait(*Path, Args, None, {}, 0, 0, &ErrMsg);
|
||||
int result =
|
||||
sys::ExecuteAndWait(*Path, Args, std::nullopt, {}, 0, 0, &ErrMsg);
|
||||
if (result) {
|
||||
WithColor::error() << "lipo: " << ErrMsg << "\n";
|
||||
return false;
|
||||
|
|
|
@ -122,7 +122,7 @@ int main(int argc, char **argv) {
|
|||
SMDiagnostic Err;
|
||||
auto SetDataLayout = [](StringRef) -> Optional<std::string> {
|
||||
if (ClDataLayout.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return ClDataLayout;
|
||||
};
|
||||
ParsedModuleAndIndex ModuleAndIndex;
|
||||
|
|
|
@ -114,7 +114,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
BitcodeAnalyzer BA(MB->getBuffer(),
|
||||
BlockInfoMB ? Optional<StringRef>(BlockInfoMB->getBuffer())
|
||||
: None);
|
||||
: std::nullopt);
|
||||
|
||||
BCDumpOptions O(outs());
|
||||
O.Histogram = !NoHistogram;
|
||||
|
@ -124,7 +124,7 @@ int main(int argc, char **argv) {
|
|||
|
||||
ExitOnErr(BA.analyze(
|
||||
Dump ? Optional<BCDumpOptions>(O) : Optional<BCDumpOptions>(),
|
||||
CheckHash.empty() ? None : Optional<StringRef>(CheckHash)));
|
||||
CheckHash.empty() ? std::nullopt : Optional<StringRef>(CheckHash)));
|
||||
|
||||
if (Dump)
|
||||
outs() << "\n\n";
|
||||
|
|
|
@ -559,9 +559,10 @@ void CodeCoverageTool::demangleSymbols(const CoverageMapping &Coverage) {
|
|||
std::optional<StringRef> Redirects[] = {
|
||||
InputPath.str(), OutputPath.str(), {""}};
|
||||
std::string ErrMsg;
|
||||
int RC = sys::ExecuteAndWait(ViewOpts.DemanglerOpts[0], ArgsV,
|
||||
/*env=*/None, Redirects, /*secondsToWait=*/0,
|
||||
/*memoryLimit=*/0, &ErrMsg);
|
||||
int RC =
|
||||
sys::ExecuteAndWait(ViewOpts.DemanglerOpts[0], ArgsV,
|
||||
/*env=*/std::nullopt, Redirects, /*secondsToWait=*/0,
|
||||
/*memoryLimit=*/0, &ErrMsg);
|
||||
if (RC) {
|
||||
error(ErrMsg, ViewOpts.DemanglerOpts[0]);
|
||||
return;
|
||||
|
|
|
@ -560,7 +560,7 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L,
|
|||
else if (CurSeg->Col == ExpansionCol)
|
||||
Color = "cyan";
|
||||
else
|
||||
Color = None;
|
||||
Color = std::nullopt;
|
||||
|
||||
if (Color)
|
||||
Snippets[I + 1] = Highlight(Snippets[I + 1], CurSeg->Col,
|
||||
|
|
|
@ -128,7 +128,7 @@ void SourceCoverageViewText::renderLine(raw_ostream &OS, LineRef L,
|
|||
else if (Col == ExpansionCol)
|
||||
Highlight = raw_ostream::CYAN;
|
||||
else
|
||||
Highlight = None;
|
||||
Highlight = std::nullopt;
|
||||
}
|
||||
|
||||
// Show the rest of the line.
|
||||
|
|
|
@ -500,7 +500,8 @@ static void collectStatsRecursive(
|
|||
return;
|
||||
|
||||
// Handle any kind of lexical scope.
|
||||
const bool HasAbstractOrigin = Die.find(dwarf::DW_AT_abstract_origin) != None;
|
||||
const bool HasAbstractOrigin =
|
||||
Die.find(dwarf::DW_AT_abstract_origin) != std::nullopt;
|
||||
const bool IsFunction = Tag == dwarf::DW_TAG_subprogram;
|
||||
const bool IsBlock = Tag == dwarf::DW_TAG_lexical_block;
|
||||
const bool IsInlinedFunction = Tag == dwarf::DW_TAG_inlined_subroutine;
|
||||
|
|
|
@ -222,7 +222,8 @@ protected:
|
|||
|
||||
bool isDeadAddress(uint64_t LowPC, uint16_t Version, TombstoneKind Tombstone,
|
||||
uint8_t AddressByteSize) {
|
||||
return isDeadAddressRange(LowPC, None, Version, Tombstone, AddressByteSize);
|
||||
return isDeadAddressRange(LowPC, std::nullopt, Version, Tombstone,
|
||||
AddressByteSize);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -102,7 +102,7 @@ struct YamlContext {
|
|||
if (Iter != RegNameToRegNo.end())
|
||||
return Iter->second;
|
||||
ErrorStream << "No register with name '" << RegName << "'\n";
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -191,12 +191,12 @@ getImageBaseAddress(const object::ELFFile<ELFT> &ELFFile) {
|
|||
auto PhdrRangeOrErr = ELFFile.program_headers();
|
||||
if (!PhdrRangeOrErr) {
|
||||
consumeError(PhdrRangeOrErr.takeError());
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
for (const typename ELFT::Phdr &Phdr : *PhdrRangeOrErr)
|
||||
if (Phdr.p_type == ELF::PT_LOAD)
|
||||
return (uint64_t)Phdr.p_vaddr;
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Determine the virtual address that is considered the base address of mach-o
|
||||
|
@ -222,7 +222,7 @@ getImageBaseAddress(const object::MachOObjectFile *MachO) {
|
|||
return SLC.vmaddr;
|
||||
}
|
||||
}
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Determine the virtual address that is considered the base address of an
|
||||
|
@ -248,7 +248,7 @@ static llvm::Optional<uint64_t> getImageBaseAddress(object::ObjectFile &Obj) {
|
|||
return getImageBaseAddress(ELFObj->getELFFile());
|
||||
else if (const auto *ELFObj = dyn_cast<object::ELF64BEObjectFile>(&Obj))
|
||||
return getImageBaseAddress(ELFObj->getELFFile());
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static llvm::Error handleObjectFile(ObjectFile &Obj,
|
||||
|
|
|
@ -309,7 +309,7 @@ static DriverConfig parseArgs(int argc, char *const *argv) {
|
|||
Config.InputFormat = StringSwitch<Optional<FileFormat>>(A->getValue())
|
||||
.Case("IFS", FileFormat::IFS)
|
||||
.Case("ELF", FileFormat::ELF)
|
||||
.Default(None);
|
||||
.Default(std::nullopt);
|
||||
if (!Config.InputFormat)
|
||||
fatalError(Twine("invalid argument '") + A->getValue());
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ static DriverConfig parseArgs(int argc, char *const *argv) {
|
|||
.Case("IFS", FileFormat::IFS)
|
||||
.Case("ELF", FileFormat::ELF)
|
||||
.Case("TBD", FileFormat::TBD)
|
||||
.Default(None);
|
||||
.Default(std::nullopt);
|
||||
if (!Config.OutputFormat)
|
||||
OptionNotFound("--output-format", A->getValue());
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ static DriverConfig parseArgs(int argc, char *const *argv) {
|
|||
StringSwitch<Optional<IFSEndiannessType>>(A->getValue())
|
||||
.Case("little", IFSEndiannessType::Little)
|
||||
.Case("big", IFSEndiannessType::Big)
|
||||
.Default(None);
|
||||
.Default(std::nullopt);
|
||||
if (!Config.OverrideEndianness)
|
||||
OptionNotFound("--endianness", A->getValue());
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ static Expected<std::string> searchForFile(const Twine &FileName) {
|
|||
|
||||
GlobalDependencyInfo->addMissingInput(Path);
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
Optional<std::string> Found = FindLib(LibrarySearchDirs);
|
||||
|
|
|
@ -182,7 +182,7 @@ static Config parseLipoOptions(ArrayRef<const char *> ArgsArr) {
|
|||
reportError("unknown argument '" + Arg->getAsString(InputArgs) + "'");
|
||||
|
||||
for (auto *Arg : InputArgs.filtered(LIPO_INPUT))
|
||||
C.InputFiles.push_back({None, Arg->getValue()});
|
||||
C.InputFiles.push_back({std::nullopt, Arg->getValue()});
|
||||
for (auto *Arg : InputArgs.filtered(LIPO_arch)) {
|
||||
validateArchitectureName(Arg->getValue(0));
|
||||
assert(Arg->getValue(1) && "file_name is missing");
|
||||
|
|
|
@ -651,7 +651,7 @@ static Optional<std::string> demangle(StringRef Name) {
|
|||
std::string Demangled;
|
||||
if (nonMicrosoftDemangle(Name.str().c_str(), Demangled))
|
||||
return Demangled;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static Optional<std::string> demangleXCOFF(StringRef Name) {
|
||||
|
@ -662,7 +662,7 @@ static Optional<std::string> demangleXCOFF(StringRef Name) {
|
|||
Optional<std::string> DemangledName = demangle(Name);
|
||||
if (DemangledName)
|
||||
return "." + *DemangledName;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static Optional<std::string> demangleMachO(StringRef Name) {
|
||||
|
|
|
@ -31,7 +31,7 @@ unsigned getInstStartColumn(const MCSubtargetInfo &STI) {
|
|||
}
|
||||
|
||||
bool LiveVariable::liveAtAddress(object::SectionedAddress Addr) {
|
||||
if (LocExpr.Range == None)
|
||||
if (LocExpr.Range == std::nullopt)
|
||||
return false;
|
||||
return LocExpr.Range->SectionIndex == Addr.SectionIndex &&
|
||||
LocExpr.Range->LowPC <= Addr.Address &&
|
||||
|
|
|
@ -49,11 +49,11 @@ objdump::getXCOFFSymbolCsectSMC(const XCOFFObjectFile &Obj,
|
|||
const XCOFFSymbolRef SymRef = Obj.toSymbolRef(Sym.getRawDataRefImpl());
|
||||
|
||||
if (!SymRef.isCsectSymbol())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto CsectAuxEntOrErr = SymRef.getXCOFFCsectAuxRef();
|
||||
if (!CsectAuxEntOrErr)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return CsectAuxEntOrErr.get().getStorageMappingClass();
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ objdump::getXCOFFSymbolContainingSymbolRef(const XCOFFObjectFile &Obj,
|
|||
const SymbolRef &Sym) {
|
||||
const XCOFFSymbolRef SymRef = Obj.toSymbolRef(Sym.getRawDataRefImpl());
|
||||
if (!SymRef.isCsectSymbol())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
Expected<XCOFFCsectAuxRef> CsectAuxEntOrErr = SymRef.getXCOFFCsectAuxRef();
|
||||
if (!CsectAuxEntOrErr || !CsectAuxEntOrErr.get().isLabel())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
uint32_t Idx =
|
||||
static_cast<uint32_t>(CsectAuxEntOrErr.get().getSectionOrLength());
|
||||
DataRefImpl DRI;
|
||||
|
|
|
@ -869,7 +869,7 @@ static Optional<SectionRef> getWasmCodeSection(const WasmObjectFile &Obj) {
|
|||
if (Section.Type == wasm::WASM_SEC_CODE)
|
||||
return SecI;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1101,7 +1101,7 @@ static SymbolInfoTy createDummySymbolInfo(const ObjectFile &Obj,
|
|||
const uint64_t Addr, StringRef &Name,
|
||||
uint8_t Type) {
|
||||
if (Obj.isXCOFF() && SymbolDescription)
|
||||
return SymbolInfoTy(Addr, Name, None, None, false);
|
||||
return SymbolInfoTy(Addr, Name, std::nullopt, std::nullopt, false);
|
||||
else
|
||||
return SymbolInfoTy(Addr, Name, Type);
|
||||
}
|
||||
|
@ -1276,14 +1276,14 @@ static Optional<OwningBinary<Binary>>
|
|||
fetchBinaryByBuildID(const ObjectFile &Obj) {
|
||||
Optional<object::BuildIDRef> BuildID = getBuildID(&Obj);
|
||||
if (!BuildID)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
Optional<std::string> Path = BIDFetcher->fetch(*BuildID);
|
||||
if (!Path)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
Expected<OwningBinary<Binary>> DebugBinary = createBinary(*Path);
|
||||
if (!DebugBinary) {
|
||||
reportWarning(toString(DebugBinary.takeError()), *Path);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
return std::move(*DebugBinary);
|
||||
}
|
||||
|
@ -1423,13 +1423,12 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
|
|||
LLVM_DEBUG(LVP.dump());
|
||||
|
||||
std::unordered_map<uint64_t, BBAddrMap> AddrToBBAddrMap;
|
||||
auto ReadBBAddrMap = [&](Optional<unsigned> SectionIndex = None) {
|
||||
auto ReadBBAddrMap = [&](Optional<unsigned> SectionIndex = std::nullopt) {
|
||||
AddrToBBAddrMap.clear();
|
||||
if (const auto *Elf = dyn_cast<ELFObjectFileBase>(&Obj)) {
|
||||
auto BBAddrMapsOrErr = Elf->readBBAddrMap(SectionIndex);
|
||||
if (!BBAddrMapsOrErr)
|
||||
reportWarning(toString(BBAddrMapsOrErr.takeError()),
|
||||
Obj.getFileName());
|
||||
reportWarning(toString(BBAddrMapsOrErr.takeError()), Obj.getFileName());
|
||||
for (auto &FunctionBBAddrMap : *BBAddrMapsOrErr)
|
||||
AddrToBBAddrMap.emplace(FunctionBBAddrMap.Addr,
|
||||
std::move(FunctionBBAddrMap));
|
||||
|
|
|
@ -131,7 +131,7 @@ Optional<uint32_t> ExplainOutputStyle::getPdbBlockStreamIndex() const {
|
|||
continue;
|
||||
return Entry.index();
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool ExplainOutputStyle::explainPdbBlockStatus() {
|
||||
|
|
|
@ -865,7 +865,7 @@ static void yamlToPdb(StringRef Path) {
|
|||
AppendingTypeTableBuilder TS(Allocator);
|
||||
for (const auto &R : Tpi.Records) {
|
||||
CVType Type = R.toCodeViewRecord(TS);
|
||||
TpiBuilder.addTypeRecord(Type.RecordData, None);
|
||||
TpiBuilder.addTypeRecord(Type.RecordData, std::nullopt);
|
||||
}
|
||||
|
||||
const auto &Ipi = YamlObj.IpiStream.value_or(DefaultIpiStream);
|
||||
|
@ -873,7 +873,7 @@ static void yamlToPdb(StringRef Path) {
|
|||
IpiBuilder.setVersionHeader(Ipi.Version);
|
||||
for (const auto &R : Ipi.Records) {
|
||||
CVType Type = R.toCodeViewRecord(TS);
|
||||
IpiBuilder.addTypeRecord(Type.RecordData, None);
|
||||
IpiBuilder.addTypeRecord(Type.RecordData, std::nullopt);
|
||||
}
|
||||
|
||||
Builder.getStringTableBuilder().setStrings(*Strings.strings());
|
||||
|
@ -1353,10 +1353,10 @@ static void mergePdbs() {
|
|||
auto &DestTpi = Builder.getTpiBuilder();
|
||||
auto &DestIpi = Builder.getIpiBuilder();
|
||||
MergedTpi.ForEachRecord([&DestTpi](TypeIndex TI, const CVType &Type) {
|
||||
DestTpi.addTypeRecord(Type.RecordData, None);
|
||||
DestTpi.addTypeRecord(Type.RecordData, std::nullopt);
|
||||
});
|
||||
MergedIpi.ForEachRecord([&DestIpi](TypeIndex TI, const CVType &Type) {
|
||||
DestIpi.addTypeRecord(Type.RecordData, None);
|
||||
DestIpi.addTypeRecord(Type.RecordData, std::nullopt);
|
||||
});
|
||||
Builder.getInfoBuilder().addFeature(PdbRaw_FeatureSig::VC140);
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ PerfInputFile PerfScriptReader::convertPerfDataToTrace(
|
|||
StringRef ScriptSampleArgs[] = {PerfPath, "script", "--show-mmap-events",
|
||||
"-F", "ip,brstack", "--pid",
|
||||
PIDs, "-i", PerfData};
|
||||
sys::ExecuteAndWait(PerfPath, ScriptSampleArgs, llvm::None, Redirects);
|
||||
sys::ExecuteAndWait(PerfPath, ScriptSampleArgs, std::nullopt, Redirects);
|
||||
|
||||
return {PerfTraceFile, PerfFormat::PerfScript, PerfContent::UnknownContent};
|
||||
}
|
||||
|
|
|
@ -502,7 +502,7 @@ void PrinterContext<ET>::PrintExceptionTable(const Elf_Shdr &EHT,
|
|||
: PREL31(Word, EHT.sh_addr + TableEntryOffset);
|
||||
SW.printHex("PersonalityRoutineAddress", Address);
|
||||
Optional<unsigned> SecIndex =
|
||||
IsRelocatable ? Optional<unsigned>(EHT.sh_link) : None;
|
||||
IsRelocatable ? Optional<unsigned>(EHT.sh_link) : std::nullopt;
|
||||
if (ErrorOr<StringRef> Name = FunctionAtAddress(Address, SecIndex))
|
||||
SW.printString("PersonalityRoutineName", *Name);
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ void PrinterContext<ET>::PrintIndexTable(unsigned SectionIndex,
|
|||
// the sh_link field is not reliable, because we have one .ARM.exidx section
|
||||
// normally, but might have many code sections.
|
||||
Optional<unsigned> SecIndex =
|
||||
IsRelocatable ? Optional<unsigned>(IT->sh_link) : None;
|
||||
IsRelocatable ? Optional<unsigned>(IT->sh_link) : std::nullopt;
|
||||
if (ErrorOr<StringRef> Name = FunctionAtAddress(Address, SecIndex))
|
||||
SW.printString("FunctionName", *Name);
|
||||
|
||||
|
|
|
@ -942,7 +942,7 @@ ELFDumper<ELFT>::getSymbolSectionIndex(const Elf_Sym &Symbol, unsigned SymIndex,
|
|||
return Ndx;
|
||||
|
||||
auto CreateErr = [&](const Twine &Name,
|
||||
std::optional<unsigned> Offset = None) {
|
||||
std::optional<unsigned> Offset = std::nullopt) {
|
||||
std::string Desc;
|
||||
if (Offset)
|
||||
Desc = (Name + "+0x" + Twine::utohexstr(*Offset)).str();
|
||||
|
@ -4640,7 +4640,7 @@ void GNUELFDumper<ELFT>::printVersionSymbolSection(const Elf_Shdr *Sec) {
|
|||
|
||||
bool IsDefault;
|
||||
Expected<StringRef> NameOrErr = this->Obj.getSymbolVersionByIndex(
|
||||
Ndx, IsDefault, *VersionMap, /*IsSymHidden=*/None);
|
||||
Ndx, IsDefault, *VersionMap, /*IsSymHidden=*/std::nullopt);
|
||||
if (!NameOrErr) {
|
||||
this->reportUniqueWarning("unable to get a version for entry " +
|
||||
Twine(I) + " of " + this->describe(*Sec) +
|
||||
|
@ -5233,11 +5233,11 @@ template <typename ELFT>
|
|||
static Optional<FreeBSDNote>
|
||||
getFreeBSDNote(uint32_t NoteType, ArrayRef<uint8_t> Desc, bool IsCore) {
|
||||
if (IsCore)
|
||||
return None; // No pretty-printing yet.
|
||||
return std::nullopt; // No pretty-printing yet.
|
||||
switch (NoteType) {
|
||||
case ELF::NT_FREEBSD_ABI_TAG:
|
||||
if (Desc.size() != 4)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return FreeBSDNote{
|
||||
"ABI tag",
|
||||
utostr(support::endian::read32<ELFT::TargetEndianness>(Desc.data()))};
|
||||
|
@ -5245,7 +5245,7 @@ getFreeBSDNote(uint32_t NoteType, ArrayRef<uint8_t> Desc, bool IsCore) {
|
|||
return FreeBSDNote{"Arch tag", toStringRef(Desc).str()};
|
||||
case ELF::NT_FREEBSD_FEATURE_CTL: {
|
||||
if (Desc.size() != 4)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
unsigned Value =
|
||||
support::endian::read32<ELFT::TargetEndianness>(Desc.data());
|
||||
std::string FlagsStr;
|
||||
|
@ -5258,7 +5258,7 @@ getFreeBSDNote(uint32_t NoteType, ArrayRef<uint8_t> Desc, bool IsCore) {
|
|||
return FreeBSDNote{"Feature flags", OS.str()};
|
||||
}
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5725,7 +5725,7 @@ static void printNotesHelper(
|
|||
const typename ELFT::Phdr &P = (*PhdrsOrErr)[I];
|
||||
if (P.p_type != PT_NOTE)
|
||||
continue;
|
||||
StartNotesFn(/*SecName=*/None, P.p_offset, P.p_filesz);
|
||||
StartNotesFn(/*SecName=*/std::nullopt, P.p_offset, P.p_filesz);
|
||||
Error Err = Error::success();
|
||||
size_t Index = 0;
|
||||
for (const typename ELFT::Note Note : Obj.notes(P, Err)) {
|
||||
|
@ -6186,8 +6186,8 @@ void ELFDumper<ELFT>::printNonRelocatableStackSizes(
|
|||
break;
|
||||
}
|
||||
uint64_t SymValue = Data.getAddress(&Offset);
|
||||
if (!printFunctionStackSize(SymValue, /*FunctionSec=*/None, Sec, Data,
|
||||
&Offset))
|
||||
if (!printFunctionStackSize(SymValue, /*FunctionSec=*/std::nullopt, Sec,
|
||||
Data, &Offset))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -6742,7 +6742,7 @@ void LLVMELFDumper<ELFT>::printSymbolSection(
|
|||
return StringRef("Common");
|
||||
if (Symbol.isReserved() && Symbol.st_shndx != SHN_XINDEX)
|
||||
return StringRef("Reserved");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
if (Optional<StringRef> Type = GetSectionSpecialType()) {
|
||||
|
|
|
@ -634,7 +634,7 @@ bool MachODumper::compareSymbolsByType(SymbolRef LHS, SymbolRef RHS) const {
|
|||
return getSymbolType(LHS) < getSymbolType(RHS);
|
||||
}
|
||||
|
||||
void MachODumper::printSymbols() { printSymbols(None); }
|
||||
void MachODumper::printSymbols() { printSymbols(std::nullopt); }
|
||||
|
||||
void MachODumper::printSymbols(Optional<SymbolComparator> SymComp) {
|
||||
ListScope Group(W, "Symbols");
|
||||
|
|
|
@ -601,7 +601,7 @@ static void printUnexpectedRawAuxEnt(ScopedPrinter &W, uintptr_t AuxAddress) {
|
|||
ArrayRef<uint8_t>(
|
||||
reinterpret_cast<const uint8_t *>(AuxAddress),
|
||||
XCOFF::SymbolTableEntrySize),
|
||||
None, XCOFF::SymbolTableEntrySize)
|
||||
std::nullopt, XCOFF::SymbolTableEntrySize)
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -49,9 +49,9 @@ int TestRunner::run(StringRef Filename) const {
|
|||
for (int i = 0; i < 3; ++i)
|
||||
Redirects.push_back(Empty);
|
||||
}
|
||||
int Result =
|
||||
sys::ExecuteAndWait(TestName, ProgramArgs, /*Env=*/None, Redirects,
|
||||
/*SecondsToWait=*/0, /*MemoryLimit=*/0, &ErrMsg);
|
||||
int Result = sys::ExecuteAndWait(
|
||||
TestName, ProgramArgs, /*Env=*/std::nullopt, Redirects,
|
||||
/*SecondsToWait=*/0, /*MemoryLimit=*/0, &ErrMsg);
|
||||
|
||||
if (Result < 0) {
|
||||
Error E = make_error<StringError>("Error running interesting-ness test: " +
|
||||
|
|
|
@ -27,7 +27,7 @@ static bool shouldIgnoreArgument(const Value *V) {
|
|||
|
||||
static Value *replaceIntrinsic(Module &M, IntrinsicInst *II,
|
||||
Intrinsic::ID NewIID,
|
||||
ArrayRef<Type *> Tys = None) {
|
||||
ArrayRef<Type *> Tys = std::nullopt) {
|
||||
Function *NewFunc = Intrinsic::getDeclaration(&M, NewIID, Tys);
|
||||
II->setCalledFunction(NewFunc);
|
||||
return II;
|
||||
|
|
|
@ -30,7 +30,7 @@ static void runPasses(Oracle &O, Module &Program) {
|
|||
PassInstrumentationCallbacks PIC;
|
||||
PIC.registerShouldRunOptionalPassCallback(
|
||||
[&](StringRef, Any) { return !O.shouldKeep(); });
|
||||
PassBuilder PB(nullptr, PipelineTuningOptions(), None, &PIC);
|
||||
PassBuilder PB(nullptr, PipelineTuningOptions(), std::nullopt, &PIC);
|
||||
|
||||
PB.registerModuleAnalyses(MAM);
|
||||
PB.registerCGSCCAnalyses(CGAM);
|
||||
|
|
|
@ -47,7 +47,7 @@ getPositionInModule(const Instruction *I,
|
|||
assert(I && "Instruction is nullptr!");
|
||||
DenseMap<Instruction *, unsigned>::const_iterator It = LLVMInstNum.find(I);
|
||||
if (It == LLVMInstNum.end())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return It->second;
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ static void symbolizeInput(const opt::InputArgList &Args,
|
|||
uint64_t Offset = 0;
|
||||
if (!parseCommand(Args.getLastArgValue(OPT_obj_EQ), IsAddr2Line,
|
||||
StringRef(InputString), Cmd, ModuleName, BuildID, Offset)) {
|
||||
Printer.printInvalidCommand({ModuleName, None}, InputString);
|
||||
Printer.printInvalidCommand({ModuleName, std::nullopt}, InputString);
|
||||
return;
|
||||
}
|
||||
bool ShouldInline = Args.hasFlag(OPT_inlines, OPT_no_inlines, !IsAddr2Line);
|
||||
|
@ -348,8 +348,8 @@ static Optional<bool> parseColorArg(const opt::InputArgList &Args) {
|
|||
return StringSwitch<Optional<bool>>(A->getValue())
|
||||
.Case("always", true)
|
||||
.Case("never", false)
|
||||
.Case("auto", None);
|
||||
return None;
|
||||
.Case("auto", std::nullopt);
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static object::BuildID parseBuildIDArg(const opt::InputArgList &Args, int ID) {
|
||||
|
|
|
@ -396,7 +396,7 @@ bool lto_codegen_set_pic_model(lto_code_gen_t cg, lto_codegen_model model) {
|
|||
unwrap(cg)->setCodePICModel(Reloc::DynamicNoPIC);
|
||||
return false;
|
||||
case LTO_CODEGEN_PIC_MODEL_DEFAULT:
|
||||
unwrap(cg)->setCodePICModel(None);
|
||||
unwrap(cg)->setCodePICModel(std::nullopt);
|
||||
return false;
|
||||
}
|
||||
sLastErrorString = "Unknown PIC model";
|
||||
|
@ -673,7 +673,7 @@ lto_bool_t thinlto_codegen_set_pic_model(thinlto_code_gen_t cg,
|
|||
unwrap(cg)->setCodePICModel(Reloc::DynamicNoPIC);
|
||||
return false;
|
||||
case LTO_CODEGEN_PIC_MODEL_DEFAULT:
|
||||
unwrap(cg)->setCodePICModel(None);
|
||||
unwrap(cg)->setCodePICModel(std::nullopt);
|
||||
return false;
|
||||
}
|
||||
sLastErrorString = "Unknown PIC model";
|
||||
|
|
|
@ -178,7 +178,7 @@ dumpPubSection(const DWARFContext &DCtx, const DWARFSection &Section,
|
|||
[](Error Err) { consumeError(std::move(Err)); });
|
||||
ArrayRef<DWARFDebugPubTable::Set> Sets = Table.getData();
|
||||
if (Sets.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// FIXME: Currently, obj2yaml only supports dumping the first pubtable.
|
||||
Y.Format = Sets[0].Format;
|
||||
|
|
|
@ -550,7 +550,7 @@ Optional<DWARFYAML::Data> ELFDumper<ELFT>::dumpDWARFSections(
|
|||
}
|
||||
|
||||
if (DWARF.getNonEmptySectionNames().empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return DWARF;
|
||||
}
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM,
|
|||
P = PGOOptions("", "", "", PGOOptions::NoAction, PGOOptions::NoCSAction,
|
||||
DebugInfoForProfiling, PseudoProbeForProfiling);
|
||||
else
|
||||
P = None;
|
||||
P = std::nullopt;
|
||||
}
|
||||
if (CSPGOKindFlag != NoCSPGO) {
|
||||
if (P && (P->Action == PGOOptions::IRInstr ||
|
||||
|
|
|
@ -515,7 +515,7 @@ int main(int argc, char **argv) {
|
|||
// Load the input module...
|
||||
auto SetDataLayout = [](StringRef) -> Optional<std::string> {
|
||||
if (ClDataLayout.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return ClDataLayout;
|
||||
};
|
||||
std::unique_ptr<Module> M;
|
||||
|
|
Loading…
Reference in New Issue