forked from OSchip/llvm-project
[llvm] 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
ed88e60b37
commit
aadaaface2
|
@ -181,7 +181,7 @@ namespace llvm {
|
|||
BlockAddressPFS(nullptr) {}
|
||||
bool Run(
|
||||
bool UpgradeDebugInfo, DataLayoutCallbackTy DataLayoutCallback =
|
||||
[](StringRef) { return None; });
|
||||
[](StringRef) { return std::nullopt; });
|
||||
|
||||
bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots);
|
||||
|
||||
|
|
|
@ -87,7 +87,9 @@ struct ParsedModuleAndIndex {
|
|||
ParsedModuleAndIndex parseAssemblyFileWithIndex(
|
||||
StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
|
||||
SlotMapping *Slots = nullptr,
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
/// Only for use in llvm-as for testing; this does not produce a valid module.
|
||||
ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo(
|
||||
|
@ -126,7 +128,9 @@ parseSummaryIndexAssemblyString(StringRef AsmString, SMDiagnostic &Err);
|
|||
std::unique_ptr<Module> parseAssembly(
|
||||
MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
|
||||
SlotMapping *Slots = nullptr,
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
/// Parse LLVM Assembly including the summary index from a MemoryBuffer.
|
||||
///
|
||||
|
@ -166,7 +170,9 @@ parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err);
|
|||
bool parseAssemblyInto(
|
||||
MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index, SMDiagnostic &Err,
|
||||
SlotMapping *Slots = nullptr,
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
/// Parse a type and a constant value in the given string.
|
||||
///
|
||||
|
|
|
@ -50,7 +50,7 @@ class MetadataVerifier {
|
|||
bool verifyInteger(msgpack::DocNode &Node);
|
||||
bool verifyArray(msgpack::DocNode &Node,
|
||||
function_ref<bool(msgpack::DocNode &)> verifyNode,
|
||||
Optional<size_t> Size = None);
|
||||
Optional<size_t> Size = std::nullopt);
|
||||
bool verifyEntry(msgpack::MapDocNode &MapNode, StringRef Key, bool Required,
|
||||
function_ref<bool(msgpack::DocNode &)> verifyNode);
|
||||
bool
|
||||
|
|
|
@ -916,7 +916,7 @@ HANDLE_DW_LANG(0x0023, Fortran08, 1, 5, DWARF)
|
|||
HANDLE_DW_LANG(0x0024, RenderScript, 0, 5, DWARF)
|
||||
HANDLE_DW_LANG(0x0025, BLISS, 0, 5, DWARF)
|
||||
// Vendor extensions:
|
||||
HANDLE_DW_LANG(0x8001, Mips_Assembler, None, 0, MIPS)
|
||||
HANDLE_DW_LANG(0x8001, Mips_Assembler, std::nullopt, 0, MIPS)
|
||||
HANDLE_DW_LANG(0x8e57, GOOGLE_RenderScript, 0, 0, GOOGLE)
|
||||
HANDLE_DW_LANG(0xb000, BORLAND_Delphi, 0, 0, BORLAND)
|
||||
|
||||
|
|
|
@ -502,7 +502,8 @@ public:
|
|||
/// the first entry.
|
||||
template <typename Container>
|
||||
void EmitRecordWithAbbrev(unsigned Abbrev, const Container &Vals) {
|
||||
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), StringRef(), None);
|
||||
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), StringRef(),
|
||||
std::nullopt);
|
||||
}
|
||||
|
||||
/// EmitRecordWithBlob - Emit the specified record to the stream, using an
|
||||
|
@ -513,13 +514,13 @@ public:
|
|||
template <typename Container>
|
||||
void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals,
|
||||
StringRef Blob) {
|
||||
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Blob, None);
|
||||
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Blob, std::nullopt);
|
||||
}
|
||||
template <typename Container>
|
||||
void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals,
|
||||
const char *BlobData, unsigned BlobLen) {
|
||||
return EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals),
|
||||
StringRef(BlobData, BlobLen), None);
|
||||
StringRef(BlobData, BlobLen), std::nullopt);
|
||||
}
|
||||
|
||||
/// EmitRecordWithArray - Just like EmitRecordWithBlob, works with records
|
||||
|
@ -527,13 +528,14 @@ public:
|
|||
template <typename Container>
|
||||
void EmitRecordWithArray(unsigned Abbrev, const Container &Vals,
|
||||
StringRef Array) {
|
||||
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Array, None);
|
||||
EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Array, std::nullopt);
|
||||
}
|
||||
template <typename Container>
|
||||
void EmitRecordWithArray(unsigned Abbrev, const Container &Vals,
|
||||
const char *ArrayData, unsigned ArrayLen) {
|
||||
return EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals),
|
||||
StringRef(ArrayData, ArrayLen), None);
|
||||
StringRef(ArrayData, ArrayLen),
|
||||
std::nullopt);
|
||||
}
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
|
@ -44,7 +44,7 @@ struct InfoSectionUnitHeader {
|
|||
|
||||
// dwo_id field. This resides in the header only if Version >= 5.
|
||||
// In earlier versions, it is read from DW_AT_GNU_dwo_id.
|
||||
Optional<uint64_t> Signature = None;
|
||||
Optional<uint64_t> Signature = std::nullopt;
|
||||
|
||||
// Derived from the length of Length field.
|
||||
dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32;
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
JITDylib &PlatformJD, const char *OrcRuntimePath,
|
||||
LoadDynamicLibrary LoadDynLibrary, bool StaticVCRuntime = false,
|
||||
const char *VCRuntimePath = nullptr,
|
||||
Optional<SymbolAliasMap> RuntimeAliases = None);
|
||||
Optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
|
||||
|
||||
ExecutionSession &getExecutionSession() const { return ES; }
|
||||
ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; }
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
static Expected<std::unique_ptr<ELFNixPlatform>>
|
||||
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
||||
JITDylib &PlatformJD, const char *OrcRuntimePath,
|
||||
Optional<SymbolAliasMap> RuntimeAliases = None);
|
||||
Optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
|
||||
|
||||
ExecutionSession &getExecutionSession() const { return ES; }
|
||||
ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; }
|
||||
|
|
|
@ -58,7 +58,7 @@ private:
|
|||
/// loaded to find the registration functions.
|
||||
Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
|
||||
ExecutionSession &ES,
|
||||
Optional<ExecutorAddr> RegistrationFunctionDylib = None);
|
||||
Optional<ExecutorAddr> RegistrationFunctionDylib = std::nullopt);
|
||||
|
||||
} // end namespace orc
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
/// will be loaded to find the registration functions.
|
||||
static Expected<std::unique_ptr<EPCEHFrameRegistrar>>
|
||||
Create(ExecutionSession &ES,
|
||||
Optional<ExecutorAddr> RegistrationFunctionsDylib = None);
|
||||
Optional<ExecutorAddr> RegistrationFunctionsDylib = std::nullopt);
|
||||
|
||||
/// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl
|
||||
/// object and registration/deregistration function addresses.
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
static Expected<std::unique_ptr<MachOPlatform>>
|
||||
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
|
||||
JITDylib &PlatformJD, const char *OrcRuntimePath,
|
||||
Optional<SymbolAliasMap> RuntimeAliases = None);
|
||||
Optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
|
||||
|
||||
ExecutionSession &getExecutionSession() const { return ES; }
|
||||
ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; }
|
||||
|
|
|
@ -50,7 +50,7 @@ private:
|
|||
if (Position != Maps.end())
|
||||
return Position->getSecond();
|
||||
else
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::mutex ConcurrentAccess;
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace orc {
|
|||
/// many main functions will expect a name argument at least, and will fail
|
||||
/// if none is provided.
|
||||
int runAsMain(int (*Main)(int, char *[]), ArrayRef<std::string> Args,
|
||||
Optional<StringRef> ProgramName = None);
|
||||
Optional<StringRef> ProgramName = std::nullopt);
|
||||
|
||||
int runAsVoidFunction(int (*Func)(void));
|
||||
int runAsIntFunction(int (*Func)(int), int Arg);
|
||||
|
|
|
@ -924,7 +924,7 @@ __OMP_RTL_ATTRS(__kmpc_doacross_fini, BarrierAttrs, AttributeSet(),
|
|||
__OMP_RTL_ATTRS(__kmpc_alloc_shared, AttributeSet(
|
||||
EnumAttr(NoUnwind),
|
||||
EnumAttr(NoSync),
|
||||
AllocSizeAttr(0, None)), ReturnPtrAttrs, ParamAttrs())
|
||||
AllocSizeAttr(0, std::nullopt)), ReturnPtrAttrs, ParamAttrs())
|
||||
__OMP_RTL_ATTRS(__kmpc_free_shared, DeviceAllocAttrs, AttributeSet(),
|
||||
ParamAttrs(AttributeSet(EnumAttr(NoCapture), EnumAttr(AllocatedPointer))))
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ static inline SourcePred anyType() {
|
|||
auto Pred = [](ArrayRef<Value *>, const Value *V) {
|
||||
return !V->getType()->isVoidTy();
|
||||
};
|
||||
auto Make = None;
|
||||
auto Make = std::nullopt;
|
||||
return {Pred, Make};
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ static inline SourcePred anyIntType() {
|
|||
auto Pred = [](ArrayRef<Value *>, const Value *V) {
|
||||
return V->getType()->isIntegerTy();
|
||||
};
|
||||
auto Make = None;
|
||||
auto Make = std::nullopt;
|
||||
return {Pred, Make};
|
||||
}
|
||||
|
||||
|
@ -121,7 +121,7 @@ static inline SourcePred anyFloatType() {
|
|||
auto Pred = [](ArrayRef<Value *>, const Value *V) {
|
||||
return V->getType()->isFloatingPointTy();
|
||||
};
|
||||
auto Make = None;
|
||||
auto Make = std::nullopt;
|
||||
return {Pred, Make};
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ static inline SourcePred anyAggregateType() {
|
|||
};
|
||||
// TODO: For now we only find aggregates in BaseTypes. It might be better to
|
||||
// manufacture them out of the base types in some cases.
|
||||
auto Find = None;
|
||||
auto Find = std::nullopt;
|
||||
return {Pred, Find};
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ static inline SourcePred anyVectorType() {
|
|||
// TODO: For now we only find vectors in BaseTypes. It might be better to
|
||||
// manufacture vectors out of the base types, but it's tricky to be sure
|
||||
// that's actually a reasonable type.
|
||||
auto Make = None;
|
||||
auto Make = std::nullopt;
|
||||
return {Pred, Make};
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,9 @@ getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
|
|||
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
|
||||
std::unique_ptr<Module> parseIR(
|
||||
MemoryBufferRef Buffer, SMDiagnostic &Err, LLVMContext &Context,
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
|
||||
return std::nullopt;
|
||||
});
|
||||
|
||||
/// If the given file holds a bitcode image, return a Module for it.
|
||||
/// Otherwise, attempt to parse it as LLVM Assembly and return a Module
|
||||
|
@ -64,7 +66,9 @@ std::unique_ptr<Module> parseIR(
|
|||
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
|
||||
std::unique_ptr<Module> parseIRFile(
|
||||
StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
|
||||
DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
|
||||
return std::nullopt;
|
||||
});
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,7 +52,7 @@ struct Config {
|
|||
/// For adding passes that run right before codegen.
|
||||
std::function<void(legacy::PassManager &)> PreCodeGenPassesHook;
|
||||
Optional<Reloc::Model> RelocModel = Reloc::PIC_;
|
||||
Optional<CodeModel::Model> CodeModel = None;
|
||||
Optional<CodeModel::Model> CodeModel = std::nullopt;
|
||||
CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default;
|
||||
CodeGenFileType CGFileType = CGFT_ObjectFile;
|
||||
unsigned OptLevel = 2;
|
||||
|
|
|
@ -672,11 +672,13 @@ public:
|
|||
bool hasXCOFFSection(StringRef Section,
|
||||
XCOFF::CsectProperties CsectProp) const;
|
||||
|
||||
MCSectionXCOFF *getXCOFFSection(
|
||||
StringRef Section, SectionKind K,
|
||||
Optional<XCOFF::CsectProperties> CsectProp = None,
|
||||
bool MultiSymbolsAllowed = false, const char *BeginSymName = nullptr,
|
||||
Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags = None);
|
||||
MCSectionXCOFF *
|
||||
getXCOFFSection(StringRef Section, SectionKind K,
|
||||
Optional<XCOFF::CsectProperties> CsectProp = std::nullopt,
|
||||
bool MultiSymbolsAllowed = false,
|
||||
const char *BeginSymName = nullptr,
|
||||
Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags =
|
||||
std::nullopt);
|
||||
|
||||
// Create and save a copy of STI and return a reference to the copy.
|
||||
MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);
|
||||
|
|
|
@ -210,25 +210,28 @@ public:
|
|||
const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) = 0;
|
||||
|
||||
/// Emit a note at the location \p L, with the message \p Msg.
|
||||
virtual void Note(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
|
||||
virtual void Note(SMLoc L, const Twine &Msg,
|
||||
SMRange Range = std::nullopt) = 0;
|
||||
|
||||
/// Emit a warning at the location \p L, with the message \p Msg.
|
||||
///
|
||||
/// \return The return value is true, if warnings are fatal.
|
||||
virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
|
||||
virtual bool Warning(SMLoc L, const Twine &Msg,
|
||||
SMRange Range = std::nullopt) = 0;
|
||||
|
||||
/// Return an error at the location \p L, with the message \p Msg. This
|
||||
/// may be modified before being emitted.
|
||||
///
|
||||
/// \return The return value is always true, as an idiomatic convenience to
|
||||
/// clients.
|
||||
bool Error(SMLoc L, const Twine &Msg, SMRange Range = None);
|
||||
bool Error(SMLoc L, const Twine &Msg, SMRange Range = std::nullopt);
|
||||
|
||||
/// Emit an error at the location \p L, with the message \p Msg.
|
||||
///
|
||||
/// \return The return value is always true, as an idiomatic convenience to
|
||||
/// clients.
|
||||
virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
|
||||
virtual bool printError(SMLoc L, const Twine &Msg,
|
||||
SMRange Range = std::nullopt) = 0;
|
||||
|
||||
bool hasPendingError() { return !PendingErrors.empty(); }
|
||||
|
||||
|
@ -253,7 +256,7 @@ public:
|
|||
const AsmToken &getTok() const;
|
||||
|
||||
/// Report an error at the current lexer location.
|
||||
bool TokError(const Twine &Msg, SMRange Range = None);
|
||||
bool TokError(const Twine &Msg, SMRange Range = std::nullopt);
|
||||
|
||||
bool parseTokenLoc(SMLoc &Loc);
|
||||
bool parseToken(AsmToken::TokenKind T, const Twine &Msg = "unexpected token");
|
||||
|
|
|
@ -46,7 +46,7 @@ class MCSectionXCOFF final : public MCSection {
|
|||
bool MultiSymbolsAllowed)
|
||||
: MCSection(SV_XCOFF, Name, K, Begin),
|
||||
CsectProp(XCOFF::CsectProperties(SMC, ST)), QualName(QualName),
|
||||
SymbolTableName(SymbolTableName), DwarfSubtypeFlags(None),
|
||||
SymbolTableName(SymbolTableName), DwarfSubtypeFlags(std::nullopt),
|
||||
MultiSymbolsAllowed(MultiSymbolsAllowed) {
|
||||
assert(
|
||||
(ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM || ST == XCOFF::XTY_ER) &&
|
||||
|
|
|
@ -905,11 +905,10 @@ public:
|
|||
|
||||
/// Associate a filename with a specified logical file number. This
|
||||
/// implements the DWARF2 '.file 4 "foo.c"' assembler directive.
|
||||
unsigned emitDwarfFileDirective(unsigned FileNo, StringRef Directory,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = None,
|
||||
Optional<StringRef> Source = None,
|
||||
unsigned CUID = 0) {
|
||||
unsigned emitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
Optional<StringRef> Source = std::nullopt, unsigned CUID = 0) {
|
||||
return cantFail(
|
||||
tryEmitDwarfFileDirective(FileNo, Directory, Filename, Checksum,
|
||||
Source, CUID));
|
||||
|
@ -922,8 +921,8 @@ public:
|
|||
/// '.file 4 "dir/foo.c" md5 "..." source "..."' assembler directive.
|
||||
virtual Expected<unsigned> tryEmitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = None, Optional<StringRef> Source = None,
|
||||
unsigned CUID = 0);
|
||||
Optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
Optional<StringRef> Source = std::nullopt, unsigned CUID = 0);
|
||||
|
||||
/// Specify the "root" file of the compilation, using the ".file 0" extension.
|
||||
virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
|
||||
|
@ -1089,7 +1088,7 @@ public:
|
|||
virtual Optional<std::pair<bool, std::string>>
|
||||
emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr,
|
||||
SMLoc Loc, const MCSubtargetInfo &STI) {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
virtual void emitAddrsig() {}
|
||||
|
|
|
@ -478,13 +478,12 @@ public:
|
|||
/// feature set; it should always be provided. Generally this should be
|
||||
/// either the target triple from the module, or the target triple of the
|
||||
/// host if that does not exist.
|
||||
TargetMachine *createTargetMachine(StringRef TT, StringRef CPU,
|
||||
StringRef Features,
|
||||
const TargetOptions &Options,
|
||||
Optional<Reloc::Model> RM,
|
||||
Optional<CodeModel::Model> CM = None,
|
||||
CodeGenOpt::Level OL = CodeGenOpt::Default,
|
||||
bool JIT = false) const {
|
||||
TargetMachine *
|
||||
createTargetMachine(StringRef TT, StringRef CPU, StringRef Features,
|
||||
const TargetOptions &Options, Optional<Reloc::Model> RM,
|
||||
Optional<CodeModel::Model> CM = std::nullopt,
|
||||
CodeGenOpt::Level OL = CodeGenOpt::Default,
|
||||
bool JIT = false) const {
|
||||
if (!TargetMachineCtorFn)
|
||||
return nullptr;
|
||||
return TargetMachineCtorFn(*this, Triple(TT), CPU, Features, Options, RM,
|
||||
|
|
|
@ -118,7 +118,7 @@ public:
|
|||
Optional<StringRef> getName() const {
|
||||
if (!R && !G)
|
||||
return Name;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
bool operator==(StringRef S) const {
|
||||
return R ? R->match(S) : G ? G->match(S) : Name == S;
|
||||
|
|
|
@ -120,7 +120,7 @@ template <class T> struct DataRegion {
|
|||
}
|
||||
|
||||
const T *First;
|
||||
Optional<uint64_t> Size = None;
|
||||
Optional<uint64_t> Size = std::nullopt;
|
||||
const uint8_t *BufEnd = nullptr;
|
||||
};
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
// `TextSectionIndex` is specified, only returns the BB address maps
|
||||
// corresponding to the section with that index.
|
||||
Expected<std::vector<BBAddrMap>>
|
||||
readBBAddrMap(Optional<unsigned> TextSectionIndex = None) const;
|
||||
readBBAddrMap(Optional<unsigned> TextSectionIndex = std::nullopt) const;
|
||||
};
|
||||
|
||||
class ELFSectionRef : public SectionRef {
|
||||
|
|
|
@ -337,7 +337,7 @@ public:
|
|||
virtual StringRef getFileFormatName() const = 0;
|
||||
virtual Triple::ArchType getArch() const = 0;
|
||||
virtual SubtargetFeatures getFeatures() const = 0;
|
||||
virtual Optional<StringRef> tryGetCPUName() const { return None; };
|
||||
virtual Optional<StringRef> tryGetCPUName() const { return std::nullopt; };
|
||||
virtual void setARMSubArch(Triple &TheTriple) const { }
|
||||
virtual Expected<uint64_t> getStartAddress() const {
|
||||
return errorCodeToError(object_error::parse_failed);
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
|
||||
explicit PassBuilder(TargetMachine *TM = nullptr,
|
||||
PipelineTuningOptions PTO = PipelineTuningOptions(),
|
||||
Optional<PGOOptions> PGOOpt = None,
|
||||
Optional<PGOOptions> PGOOpt = std::nullopt,
|
||||
PassInstrumentationCallbacks *PIC = nullptr);
|
||||
|
||||
/// Cross register the analysis managers through their proxies.
|
||||
|
|
|
@ -323,7 +323,7 @@ class CounterMappingContext {
|
|||
|
||||
public:
|
||||
CounterMappingContext(ArrayRef<CounterExpression> Expressions,
|
||||
ArrayRef<uint64_t> CounterValues = None)
|
||||
ArrayRef<uint64_t> CounterValues = std::nullopt)
|
||||
: Expressions(Expressions), CounterValues(CounterValues) {}
|
||||
|
||||
void setCounts(ArrayRef<uint64_t> Counts) { CounterValues = Counts; }
|
||||
|
@ -605,7 +605,8 @@ public:
|
|||
/// Ignores non-instrumented object files unless all are not instrumented.
|
||||
static Expected<std::unique_ptr<CoverageMapping>>
|
||||
load(ArrayRef<StringRef> ObjectFilenames, StringRef ProfileFilename,
|
||||
ArrayRef<StringRef> Arches = None, StringRef CompilationDir = "");
|
||||
ArrayRef<StringRef> Arches = std::nullopt,
|
||||
StringRef CompilationDir = "");
|
||||
|
||||
/// The number of functions that couldn't have their profiles mapped.
|
||||
///
|
||||
|
|
|
@ -868,7 +868,7 @@ private:
|
|||
ArrayRef<InstrProfValueSiteRecord>
|
||||
getValueSitesForKind(uint32_t ValueKind) const {
|
||||
if (!ValueData)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
switch (ValueKind) {
|
||||
case IPVK_IndirectCallTarget:
|
||||
return ValueData->IndirectCallSites;
|
||||
|
|
|
@ -106,8 +106,8 @@ struct BitstreamRemarkSerializerHelper {
|
|||
/// Emit the metadata for the remarks.
|
||||
void emitMetaBlock(uint64_t ContainerVersion,
|
||||
Optional<uint64_t> RemarkVersion,
|
||||
Optional<const StringTable *> StrTab = None,
|
||||
Optional<StringRef> Filename = None);
|
||||
Optional<const StringTable *> StrTab = std::nullopt,
|
||||
Optional<StringRef> Filename = std::nullopt);
|
||||
|
||||
/// Emit a remark block. The string table is required.
|
||||
void emitRemarkBlock(const Remark &Remark, StringTable &StrTab);
|
||||
|
@ -148,7 +148,7 @@ struct BitstreamRemarkSerializer : public RemarkSerializer {
|
|||
/// metadata serializer will change.
|
||||
std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = None) override;
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
|
||||
static bool classof(const RemarkSerializer *S) {
|
||||
return S->SerializerFormat == Format::Bitstream;
|
||||
|
@ -172,10 +172,10 @@ struct BitstreamMetaSerializer : public MetaSerializer {
|
|||
/// Create a new meta serializer based on \p ContainerType.
|
||||
BitstreamMetaSerializer(raw_ostream &OS,
|
||||
BitstreamRemarkContainerType ContainerType,
|
||||
Optional<const StringTable *> StrTab = None,
|
||||
Optional<StringRef> ExternalFilename = None)
|
||||
: MetaSerializer(OS), TmpHelper(None), Helper(nullptr), StrTab(StrTab),
|
||||
ExternalFilename(ExternalFilename) {
|
||||
Optional<const StringTable *> StrTab = std::nullopt,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt)
|
||||
: MetaSerializer(OS), TmpHelper(std::nullopt), Helper(nullptr),
|
||||
StrTab(StrTab), ExternalFilename(ExternalFilename) {
|
||||
TmpHelper.emplace(ContainerType);
|
||||
Helper = &*TmpHelper;
|
||||
}
|
||||
|
@ -183,10 +183,10 @@ struct BitstreamMetaSerializer : public MetaSerializer {
|
|||
/// Create a new meta serializer based on a previously built \p Helper.
|
||||
BitstreamMetaSerializer(raw_ostream &OS,
|
||||
BitstreamRemarkSerializerHelper &Helper,
|
||||
Optional<const StringTable *> StrTab = None,
|
||||
Optional<StringRef> ExternalFilename = None)
|
||||
: MetaSerializer(OS), TmpHelper(None), Helper(&Helper), StrTab(StrTab),
|
||||
ExternalFilename(ExternalFilename) {}
|
||||
Optional<const StringTable *> StrTab = std::nullopt,
|
||||
Optional<StringRef> ExternalFilename = std::nullopt)
|
||||
: MetaSerializer(OS), TmpHelper(std::nullopt), Helper(&Helper),
|
||||
StrTab(StrTab), ExternalFilename(ExternalFilename) {}
|
||||
|
||||
void emit() override;
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace remarks {
|
|||
// be filled later during PSI.
|
||||
inline Expected<Optional<uint64_t>> parseHotnessThresholdOption(StringRef Arg) {
|
||||
if (Arg == "auto")
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
int64_t Val;
|
||||
if (Arg.getAsInteger(10, Val))
|
||||
|
|
|
@ -65,12 +65,12 @@ public:
|
|||
/// \p Buffer.
|
||||
/// \p Buffer can be either a standalone remark container or just
|
||||
/// metadata. This takes care of uniquing and merging the remarks.
|
||||
Error link(StringRef Buffer, Optional<Format> RemarkFormat = None);
|
||||
Error link(StringRef Buffer, Optional<Format> RemarkFormat = std::nullopt);
|
||||
|
||||
/// Link the remarks found in \p Obj by looking for the right section and
|
||||
/// calling the method above.
|
||||
Error link(const object::ObjectFile &Obj,
|
||||
Optional<Format> RemarkFormat = None);
|
||||
Optional<Format> RemarkFormat = std::nullopt);
|
||||
|
||||
/// Serialize the linked remarks to the stream \p OS, using the format \p
|
||||
/// RemarkFormat.
|
||||
|
|
|
@ -82,10 +82,10 @@ Expected<std::unique_ptr<RemarkParser>>
|
|||
createRemarkParser(Format ParserFormat, StringRef Buf,
|
||||
ParsedStringTable StrTab);
|
||||
|
||||
Expected<std::unique_ptr<RemarkParser>>
|
||||
createRemarkParserFromMeta(Format ParserFormat, StringRef Buf,
|
||||
Optional<ParsedStringTable> StrTab = None,
|
||||
Optional<StringRef> ExternalFilePrependPath = None);
|
||||
Expected<std::unique_ptr<RemarkParser>> createRemarkParserFromMeta(
|
||||
Format ParserFormat, StringRef Buf,
|
||||
Optional<ParsedStringTable> StrTab = std::nullopt,
|
||||
Optional<StringRef> ExternalFilePrependPath = std::nullopt);
|
||||
|
||||
} // end namespace remarks
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -60,7 +60,7 @@ struct RemarkSerializer {
|
|||
/// Return the corresponding metadata serializer.
|
||||
virtual std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = None) = 0;
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) = 0;
|
||||
};
|
||||
|
||||
/// This is the base class for a remark metadata serializer.
|
||||
|
|
|
@ -51,11 +51,11 @@ class RemarkStreamer final {
|
|||
|
||||
public:
|
||||
RemarkStreamer(std::unique_ptr<remarks::RemarkSerializer> RemarkSerializer,
|
||||
Optional<StringRef> Filename = None);
|
||||
Optional<StringRef> Filename = std::nullopt);
|
||||
|
||||
/// Return the filename that the remark diagnostics are emitted to.
|
||||
Optional<StringRef> getFilename() const {
|
||||
return Filename ? Optional<StringRef>(*Filename) : None;
|
||||
return Filename ? Optional<StringRef>(*Filename) : std::nullopt;
|
||||
}
|
||||
/// Return stream that the remark diagnostics are emitted to.
|
||||
raw_ostream &getStream() { return RemarkSerializer->OS; }
|
||||
|
|
|
@ -35,12 +35,12 @@ struct YAMLRemarkSerializer : public RemarkSerializer {
|
|||
yaml::Output YAMLOutput;
|
||||
|
||||
YAMLRemarkSerializer(raw_ostream &OS, SerializerMode Mode,
|
||||
Optional<StringTable> StrTab = None);
|
||||
Optional<StringTable> StrTab = std::nullopt);
|
||||
|
||||
void emit(const Remark &Remark) override;
|
||||
std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = None) override;
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
|
||||
static bool classof(const RemarkSerializer *S) {
|
||||
return S->SerializerFormat == Format::YAML;
|
||||
|
@ -49,7 +49,7 @@ struct YAMLRemarkSerializer : public RemarkSerializer {
|
|||
protected:
|
||||
YAMLRemarkSerializer(Format SerializerFormat, raw_ostream &OS,
|
||||
SerializerMode Mode,
|
||||
Optional<StringTable> StrTab = None);
|
||||
Optional<StringTable> StrTab = std::nullopt);
|
||||
};
|
||||
|
||||
struct YAMLMetaSerializer : public MetaSerializer {
|
||||
|
@ -83,7 +83,7 @@ struct YAMLStrTabRemarkSerializer : public YAMLRemarkSerializer {
|
|||
|
||||
std::unique_ptr<MetaSerializer>
|
||||
metaSerializer(raw_ostream &OS,
|
||||
Optional<StringRef> ExternalFilename = None) override;
|
||||
Optional<StringRef> ExternalFilename = std::nullopt) override;
|
||||
|
||||
static bool classof(const RemarkSerializer *S) {
|
||||
return S->SerializerFormat == Format::YAMLStrTab;
|
||||
|
|
|
@ -29,7 +29,7 @@ inline Optional<CodeModel::Model> unwrap(LLVMCodeModel Model, bool &JIT) {
|
|||
JIT = true;
|
||||
[[fallthrough]];
|
||||
case LLVMCodeModelDefault:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
case LLVMCodeModelTiny:
|
||||
return CodeModel::Tiny;
|
||||
case LLVMCodeModelSmall:
|
||||
|
|
|
@ -110,7 +110,7 @@ protected: // Can only create subclasses.
|
|||
unsigned O0WantsFastISel : 1;
|
||||
|
||||
// PGO related tunables.
|
||||
Optional<PGOOptions> PGOOption = None;
|
||||
Optional<PGOOptions> PGOOption = std::nullopt;
|
||||
|
||||
public:
|
||||
const TargetOptions DefaultOptions;
|
||||
|
|
|
@ -783,7 +783,7 @@ bool LLParser::parseMDNodeID(MDNode *&Result) {
|
|||
|
||||
// Otherwise, create MDNode forward reference.
|
||||
auto &FwdRef = ForwardRefMDNodes[MID];
|
||||
FwdRef = std::make_pair(MDTuple::getTemporary(Context, None), IDLoc);
|
||||
FwdRef = std::make_pair(MDTuple::getTemporary(Context, std::nullopt), IDLoc);
|
||||
|
||||
Result = FwdRef.first.get();
|
||||
NumberedMetadata[MID].reset(Result);
|
||||
|
@ -2132,7 +2132,7 @@ bool LLParser::parseOptionalFunctionMetadata(Function &F) {
|
|||
/// ::= /* empty */
|
||||
/// ::= 'align' 4
|
||||
bool LLParser::parseOptionalAlignment(MaybeAlign &Alignment, bool AllowParens) {
|
||||
Alignment = None;
|
||||
Alignment = std::nullopt;
|
||||
if (!EatIfPresent(lltok::kw_align))
|
||||
return false;
|
||||
LocTy AlignLoc = Lex.getLoc();
|
||||
|
@ -2244,7 +2244,7 @@ static Optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
|
|||
case lltok::kw_inaccessiblemem:
|
||||
return MemoryEffects::InaccessibleMem;
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2259,7 +2259,7 @@ static Optional<ModRefInfo> keywordToModRef(lltok::Kind Tok) {
|
|||
case lltok::kw_readwrite:
|
||||
return ModRefInfo::ModRef;
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2274,7 +2274,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
|
|||
Lex.Lex();
|
||||
if (!EatIfPresent(lltok::lparen)) {
|
||||
tokError("expected '('");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool SeenLoc = false;
|
||||
|
@ -2284,7 +2284,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
|
|||
Lex.Lex();
|
||||
if (!EatIfPresent(lltok::colon)) {
|
||||
tokError("expected ':' after location");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2295,7 +2295,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
|
|||
"or access kind (none, read, write, readwrite)");
|
||||
else
|
||||
tokError("expected access kind (none, read, write, readwrite)");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Lex.Lex();
|
||||
|
@ -2305,7 +2305,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
|
|||
} else {
|
||||
if (SeenLoc) {
|
||||
tokError("default access kind must be specified first");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
ME = MemoryEffects(*MR);
|
||||
}
|
||||
|
@ -2315,7 +2315,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
|
|||
} while (EatIfPresent(lltok::comma));
|
||||
|
||||
tokError("unterminated memory attribute");
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// parseOptionalCommaAlign
|
||||
|
@ -2392,7 +2392,7 @@ bool LLParser::parseAllocSizeArguments(unsigned &BaseSizeArg,
|
|||
"'allocsize' indices can't refer to the same parameter");
|
||||
HowManyArg = HowMany;
|
||||
} else
|
||||
HowManyArg = None;
|
||||
HowManyArg = std::nullopt;
|
||||
|
||||
auto EndParen = Lex.getLoc();
|
||||
if (!EatIfPresent(lltok::rparen))
|
||||
|
|
|
@ -93,7 +93,7 @@ ParsedModuleAndIndex llvm::parseAssemblyWithIndex(MemoryBufferRef F,
|
|||
SlotMapping *Slots) {
|
||||
return ::parseAssemblyWithIndex(F, Err, Context, Slots,
|
||||
/*UpgradeDebugInfo*/ true,
|
||||
[](StringRef) { return None; });
|
||||
[](StringRef) { return std::nullopt; });
|
||||
}
|
||||
|
||||
static ParsedModuleAndIndex
|
||||
|
@ -150,7 +150,7 @@ static bool parseSummaryIndexAssemblyInto(MemoryBufferRef F,
|
|||
// index, but we need to initialize it.
|
||||
LLVMContext unusedContext;
|
||||
return LLParser(F.getBuffer(), SM, Err, nullptr, &Index, unusedContext)
|
||||
.Run(true, [](StringRef) { return None; });
|
||||
.Run(true, [](StringRef) { return std::nullopt; });
|
||||
}
|
||||
|
||||
std::unique_ptr<ModuleSummaryIndex>
|
||||
|
|
|
@ -368,7 +368,7 @@ unsigned llvm::dwarf::LanguageVendor(dwarf::SourceLanguage Lang) {
|
|||
Optional<unsigned> llvm::dwarf::LanguageLowerBound(dwarf::SourceLanguage Lang) {
|
||||
switch (Lang) {
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
#define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
|
||||
case DW_LANG_##NAME: \
|
||||
return LOWER_BOUND;
|
||||
|
@ -697,7 +697,7 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
|
|||
case DW_FORM_addr:
|
||||
if (Params)
|
||||
return Params.AddrSize;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
case DW_FORM_block: // ULEB128 length L followed by L bytes.
|
||||
case DW_FORM_block1: // 1 byte length L followed by L bytes.
|
||||
|
@ -715,12 +715,12 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
|
|||
case DW_FORM_rnglistx: // ULEB128.
|
||||
case DW_FORM_GNU_addr_index: // ULEB128.
|
||||
case DW_FORM_GNU_str_index: // ULEB128.
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
case DW_FORM_ref_addr:
|
||||
if (Params)
|
||||
return Params.getRefAddrByteSize();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
case DW_FORM_flag:
|
||||
case DW_FORM_data1:
|
||||
|
@ -753,7 +753,7 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
|
|||
case DW_FORM_strp_sup:
|
||||
if (Params)
|
||||
return Params.getDwarfOffsetByteSize();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
case DW_FORM_data8:
|
||||
case DW_FORM_ref8:
|
||||
|
@ -775,7 +775,7 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
|
||||
|
|
|
@ -438,7 +438,7 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
|
|||
switch (Entry.Kind) {
|
||||
case llvm::BitstreamEntry::SubBlock: // Handled for us already.
|
||||
case llvm::BitstreamEntry::Error:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
case llvm::BitstreamEntry::EndBlock:
|
||||
return std::move(NewBlockInfo);
|
||||
case llvm::BitstreamEntry::Record:
|
||||
|
@ -448,7 +448,8 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
|
|||
|
||||
// Read abbrev records, associate them with CurBID.
|
||||
if (Entry.ID == bitc::DEFINE_ABBREV) {
|
||||
if (!CurBlockInfo) return None;
|
||||
if (!CurBlockInfo)
|
||||
return std::nullopt;
|
||||
if (Error Err = ReadAbbrevRecord())
|
||||
return std::move(Err);
|
||||
|
||||
|
@ -469,24 +470,25 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
|
|||
break; // Default behavior, ignore unknown content.
|
||||
case bitc::BLOCKINFO_CODE_SETBID:
|
||||
if (Record.size() < 1)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
CurBlockInfo = &NewBlockInfo.getOrCreateBlockInfo((unsigned)Record[0]);
|
||||
break;
|
||||
case bitc::BLOCKINFO_CODE_BLOCKNAME: {
|
||||
if (!CurBlockInfo)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
if (!ReadBlockInfoNames)
|
||||
break; // Ignore name.
|
||||
CurBlockInfo->Name = std::string(Record.begin(), Record.end());
|
||||
break;
|
||||
}
|
||||
case bitc::BLOCKINFO_CODE_SETRECORDNAME: {
|
||||
if (!CurBlockInfo) return None;
|
||||
if (!ReadBlockInfoNames)
|
||||
break; // Ignore name.
|
||||
CurBlockInfo->RecordNames.emplace_back(
|
||||
(unsigned)Record[0], std::string(Record.begin() + 1, Record.end()));
|
||||
break;
|
||||
if (!CurBlockInfo)
|
||||
return std::nullopt;
|
||||
if (!ReadBlockInfoNames)
|
||||
break; // Ignore name.
|
||||
CurBlockInfo->RecordNames.emplace_back(
|
||||
(unsigned)Record[0], std::string(Record.begin() + 1, Record.end()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ bool DwarfStreamer::init(Triple TheTriple,
|
|||
|
||||
// Finally create the AsmPrinter we'll use to emit the DIEs.
|
||||
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
|
||||
None));
|
||||
std::nullopt));
|
||||
if (!TM)
|
||||
return error("no target machine for target " + TripleName, Context), false;
|
||||
|
||||
|
|
|
@ -27,5 +27,5 @@ DebuginfodFetcher::fetch(ArrayRef<uint8_t> BuildID) const {
|
|||
if (PathOrErr)
|
||||
return *PathOrErr;
|
||||
consumeError(PathOrErr.takeError());
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
|
@ -434,7 +434,7 @@ DebuginfodCollection::getBinaryPath(BuildIDRef ID) {
|
|||
std::string Path = Loc->getValue();
|
||||
return Path;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Expected<Optional<std::string>>
|
||||
|
@ -446,7 +446,7 @@ DebuginfodCollection::getDebugBinaryPath(BuildIDRef ID) {
|
|||
std::string Path = Loc->getValue();
|
||||
return Path;
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Expected<std::string> DebuginfodCollection::findBinaryPath(BuildIDRef ID) {
|
||||
|
|
|
@ -395,7 +395,7 @@ void ExecutionEngine::runStaticConstructorsDestructors(Module &module,
|
|||
|
||||
// Execute the ctor/dtor function!
|
||||
if (Function *F = dyn_cast<Function>(FP))
|
||||
runFunction(F, None);
|
||||
runFunction(F, std::nullopt);
|
||||
|
||||
// FIXME: It is marginally lame that we just do nothing here if we see an
|
||||
// entry we don't recognize. It might not be unreasonable for the verifier
|
||||
|
|
|
@ -69,7 +69,7 @@ Interpreter::~Interpreter() {
|
|||
|
||||
void Interpreter::runAtExitHandlers () {
|
||||
while (!AtExitHandlers.empty()) {
|
||||
callFunction(AtExitHandlers.back(), None);
|
||||
callFunction(AtExitHandlers.back(), std::nullopt);
|
||||
AtExitHandlers.pop_back();
|
||||
run();
|
||||
}
|
||||
|
|
|
@ -613,7 +613,7 @@ COFFLinkGraphBuilder::exportCOMDATSymbol(COFFSymbolIndex SymIndex,
|
|||
setGraphSymbol(Symbol.getSectionNumber(), PendingComdatExport->SymbolIndex,
|
||||
*GSym);
|
||||
DefinedSymbols[SymbolName] = GSym;
|
||||
PendingComdatExport = None;
|
||||
PendingComdatExport = std::nullopt;
|
||||
return GSym;
|
||||
}
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ Block &LinkGraph::splitBlock(Block &B, size_t SplitIndex,
|
|||
SplitBlockCache LocalBlockSymbolsCache;
|
||||
if (!Cache)
|
||||
Cache = &LocalBlockSymbolsCache;
|
||||
if (*Cache == None) {
|
||||
if (*Cache == std::nullopt) {
|
||||
*Cache = SplitBlockCache::value_type();
|
||||
for (auto *Sym : B.getSection().symbols())
|
||||
if (&Sym->getBlock() == &B)
|
||||
|
|
|
@ -157,8 +157,8 @@ COFFVCRuntimeBootstrapper::getMSVCToolchainPath() {
|
|||
std::string VCToolChainPath;
|
||||
ToolsetLayout VSLayout;
|
||||
IntrusiveRefCntPtr<vfs::FileSystem> VFS = vfs::getRealFileSystem();
|
||||
if (!findVCToolChainViaCommandLine(*VFS, None, None, None, VCToolChainPath,
|
||||
VSLayout) &&
|
||||
if (!findVCToolChainViaCommandLine(*VFS, std::nullopt, std::nullopt,
|
||||
std::nullopt, VCToolChainPath, VSLayout) &&
|
||||
!findVCToolChainViaEnvironment(*VFS, VCToolChainPath, VSLayout) &&
|
||||
!findVCToolChainViaSetupConfig(*VFS, VCToolChainPath, VSLayout) &&
|
||||
!findVCToolChainViaRegistry(VCToolChainPath, VSLayout))
|
||||
|
@ -167,8 +167,8 @@ COFFVCRuntimeBootstrapper::getMSVCToolchainPath() {
|
|||
|
||||
std::string UniversalCRTSdkPath;
|
||||
std::string UCRTVersion;
|
||||
if (!getUniversalCRTSdkDir(*VFS, None, None, None, UniversalCRTSdkPath,
|
||||
UCRTVersion))
|
||||
if (!getUniversalCRTSdkDir(*VFS, std::nullopt, std::nullopt, std::nullopt,
|
||||
UniversalCRTSdkPath, UCRTVersion))
|
||||
return make_error<StringError>("Couldn't find universal sdk.",
|
||||
inconvertibleErrorCode());
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ CompileOnDemandLayer::compileRequested(GlobalValueSet Requested) {
|
|||
|
||||
Optional<CompileOnDemandLayer::GlobalValueSet>
|
||||
CompileOnDemandLayer::compileWholeModule(GlobalValueSet Requested) {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
CompileOnDemandLayer::CompileOnDemandLayer(
|
||||
|
@ -287,7 +287,7 @@ void CompileOnDemandLayer::emitPartition(
|
|||
// Take a 'None' partition to mean the whole module (as opposed to an empty
|
||||
// partition, which means "materialize nothing"). Emit the whole module
|
||||
// unmodified to the base layer.
|
||||
if (GVsToExtract == None) {
|
||||
if (GVsToExtract == std::nullopt) {
|
||||
Defs.clear();
|
||||
BaseLayer.emit(std::move(R), std::move(TSM));
|
||||
return;
|
||||
|
|
|
@ -179,7 +179,7 @@ getCOFFObjectFileSymbolInfo(ExecutionSession &ES,
|
|||
if (Def->Selection != COFF::IMAGE_COMDAT_SELECT_NODUPLICATES) {
|
||||
IsWeak = true;
|
||||
}
|
||||
ComdatDefs[COFFSym.getSectionNumber()] = None;
|
||||
ComdatDefs[COFFSym.getSectionNumber()] = std::nullopt;
|
||||
} else {
|
||||
// Skip symbols not defined in this object file.
|
||||
if (*SymFlagsOrErr & object::BasicSymbolRef::SF_Undefined)
|
||||
|
|
|
@ -97,7 +97,7 @@ BlockFreqQuery::ResultTy BlockFreqQuery::operator()(Function &F) {
|
|||
auto IBBs = findBBwithCalls(F);
|
||||
|
||||
if (IBBs.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(F);
|
||||
|
||||
|
@ -288,7 +288,7 @@ SpeculateQuery::ResultTy SequenceBBQuery::operator()(Function &F) {
|
|||
|
||||
CallerBlocks = findBBwithCalls(F);
|
||||
if (CallerBlocks.empty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
if (isStraightLine(F))
|
||||
SequencedBlocks = rearrangeBB(F, CallerBlocks);
|
||||
|
|
|
@ -702,7 +702,7 @@ Pattern::parseCallExpr(StringRef &Expr, StringRef FuncName,
|
|||
.Case("min", min)
|
||||
.Case("mul", operator*)
|
||||
.Case("sub", operator-)
|
||||
.Default(None);
|
||||
.Default(std::nullopt);
|
||||
|
||||
if (!OptFunc)
|
||||
return ErrorDiagnostic::get(
|
||||
|
@ -770,7 +770,7 @@ Expected<std::unique_ptr<Expression>> Pattern::parseNumericSubstitutionBlock(
|
|||
FileCheckPatternContext *Context, const SourceMgr &SM) {
|
||||
std::unique_ptr<ExpressionAST> ExpressionASTPointer = nullptr;
|
||||
StringRef DefExpr = StringRef();
|
||||
DefinedNumericVariable = None;
|
||||
DefinedNumericVariable = std::nullopt;
|
||||
ExpressionFormat ExplicitFormat = ExpressionFormat();
|
||||
unsigned Precision = 0;
|
||||
|
||||
|
@ -2703,8 +2703,9 @@ Error FileCheckPatternContext::defineCmdlineVariables(
|
|||
StringRef CmdlineDefExpr = CmdlineDef.substr(1);
|
||||
Optional<NumericVariable *> DefinedNumericVariable;
|
||||
Expected<std::unique_ptr<Expression>> ExpressionResult =
|
||||
Pattern::parseNumericSubstitutionBlock(
|
||||
CmdlineDefExpr, DefinedNumericVariable, false, None, this, SM);
|
||||
Pattern::parseNumericSubstitutionBlock(CmdlineDefExpr,
|
||||
DefinedNumericVariable, false,
|
||||
std::nullopt, this, SM);
|
||||
if (!ExpressionResult) {
|
||||
Errs = joinErrors(std::move(Errs), ExpressionResult.takeError());
|
||||
continue;
|
||||
|
|
|
@ -282,7 +282,7 @@ public:
|
|||
/// defined at line \p DefLineNumber or defined before input is parsed if
|
||||
/// \p DefLineNumber is None.
|
||||
explicit NumericVariable(StringRef Name, ExpressionFormat ImplicitFormat,
|
||||
Optional<size_t> DefLineNumber = None)
|
||||
Optional<size_t> DefLineNumber = std::nullopt)
|
||||
: Name(Name), ImplicitFormat(ImplicitFormat),
|
||||
DefLineNumber(DefLineNumber) {}
|
||||
|
||||
|
@ -306,7 +306,7 @@ public:
|
|||
/// buffer string from which it was parsed to \p NewStrValue. See comments on
|
||||
/// getStringValue for a discussion of when the latter can be None.
|
||||
void setValue(ExpressionValue NewValue,
|
||||
Optional<StringRef> NewStrValue = None) {
|
||||
Optional<StringRef> NewStrValue = std::nullopt) {
|
||||
Value = NewValue;
|
||||
StrValue = NewStrValue;
|
||||
}
|
||||
|
@ -314,8 +314,8 @@ public:
|
|||
/// Clears value of this numeric variable, regardless of whether it is
|
||||
/// currently defined or not.
|
||||
void clearValue() {
|
||||
Value = None;
|
||||
StrValue = None;
|
||||
Value = std::nullopt;
|
||||
StrValue = std::nullopt;
|
||||
}
|
||||
|
||||
/// \returns the line number where this variable is defined, if any, or None
|
||||
|
@ -555,7 +555,7 @@ public:
|
|||
SMRange getRange() const { return Range; }
|
||||
|
||||
static Error get(const SourceMgr &SM, SMLoc Loc, const Twine &ErrMsg,
|
||||
SMRange Range = None) {
|
||||
SMRange Range = std::nullopt) {
|
||||
return make_error<ErrorDiagnostic>(
|
||||
SM.GetMessage(Loc, SourceMgr::DK_Error, ErrMsg), Range);
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ class Pattern {
|
|||
|
||||
public:
|
||||
Pattern(Check::FileCheckType Ty, FileCheckPatternContext *Context,
|
||||
Optional<size_t> Line = None)
|
||||
Optional<size_t> Line = std::nullopt)
|
||||
: Context(Context), CheckTy(Ty), LineNumber(Line) {}
|
||||
|
||||
/// \returns the location in source code.
|
||||
|
|
|
@ -169,13 +169,13 @@ static int isVariantApplicableInContextHelper(
|
|||
if (MK == MK_ANY) {
|
||||
if (WasFound)
|
||||
return true;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// In "all" or "none" mode we accept a matching or non-matching property
|
||||
// respectively and move on. We are not done yet!
|
||||
if ((WasFound && MK == MK_ALL) || (!WasFound && MK == MK_NONE))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// We missed a property, provide some debug output and indicate failure.
|
||||
LLVM_DEBUG({
|
||||
|
|
|
@ -3194,8 +3194,8 @@ createTargetMachine(Function *F, CodeGenOpt::Level OptLevel) {
|
|||
|
||||
llvm::TargetOptions Options;
|
||||
return std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
|
||||
Triple, CPU, Features, Options, /*RelocModel=*/None, /*CodeModel=*/None,
|
||||
OptLevel));
|
||||
Triple, CPU, Features, Options, /*RelocModel=*/std::nullopt,
|
||||
/*CodeModel=*/std::nullopt, OptLevel));
|
||||
}
|
||||
|
||||
/// Heuristically determine the best-performant unroll factor for \p CLI. This
|
||||
|
@ -3240,12 +3240,12 @@ static int32_t computeHeuristicUnrollFactor(CanonicalLoopInfo *CLI) {
|
|||
gatherUnrollingPreferences(L, SE, TTI,
|
||||
/*BlockFrequencyInfo=*/nullptr,
|
||||
/*ProfileSummaryInfo=*/nullptr, ORE, OptLevel,
|
||||
/*UserThreshold=*/None,
|
||||
/*UserCount=*/None,
|
||||
/*UserThreshold=*/std::nullopt,
|
||||
/*UserCount=*/std::nullopt,
|
||||
/*UserAllowPartial=*/true,
|
||||
/*UserAllowRuntime=*/true,
|
||||
/*UserUpperBound=*/None,
|
||||
/*UserFullUnrollMaxCount=*/None);
|
||||
/*UserUpperBound=*/std::nullopt,
|
||||
/*UserFullUnrollMaxCount=*/std::nullopt);
|
||||
|
||||
UP.Force = true;
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ InjectorIRStrategy::chooseOperation(Value *Src, RandomIRBuilder &IB) {
|
|||
};
|
||||
auto RS = makeSampler(IB.Rand, make_filter_range(Operations, OpMatchesPred));
|
||||
if (RS.isEmpty())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return *RS;
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ OpDescriptor llvm::fuzzerop::splitBlockDescriptor(unsigned Weight) {
|
|||
SourcePred isInt1Ty{[](ArrayRef<Value *>, const Value *V) {
|
||||
return V->getType()->isIntegerTy(1);
|
||||
},
|
||||
None};
|
||||
std::nullopt};
|
||||
return {Weight, {isInt1Ty}, buildSplitBlock};
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ OpDescriptor llvm::fuzzerop::gepDescriptor(unsigned Weight) {
|
|||
// TODO: Try to avoid meaningless accesses.
|
||||
SourcePred sizedType(
|
||||
[](ArrayRef<Value *>, const Value *V) { return V->getType()->isSized(); },
|
||||
None);
|
||||
std::nullopt);
|
||||
return {Weight, {sizedPtrType(), sizedType, anyIntType()}, buildGEP};
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
|
|||
Context.setDiscardValueNames(LTODiscardValueNames);
|
||||
Context.enableDebugTypeODRUniquing();
|
||||
|
||||
Config.CodeModel = None;
|
||||
Config.CodeModel = std::nullopt;
|
||||
Config.StatsFile = LTOStatsFile;
|
||||
Config.PreCodeGenPassesHook = [](legacy::PassManager &PM) {
|
||||
PM.add(createObjCARCContractPass());
|
||||
|
@ -446,7 +446,7 @@ std::unique_ptr<TargetMachine> LTOCodeGenerator::createTargetMachine() {
|
|||
assert(MArch && "MArch is not set!");
|
||||
return std::unique_ptr<TargetMachine>(MArch->createTargetMachine(
|
||||
TripleStr, Config.CPU, FeatureStr, Config.Options, Config.RelocModel,
|
||||
None, Config.CGOptLevel));
|
||||
std::nullopt, Config.CGOptLevel));
|
||||
}
|
||||
|
||||
// If a linkonce global is present in the MustPreserveSymbols, we need to make
|
||||
|
|
|
@ -229,8 +229,8 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
|
|||
CPU = "cyclone";
|
||||
}
|
||||
|
||||
TargetMachine *target =
|
||||
march->createTargetMachine(TripleStr, CPU, FeatureStr, options, None);
|
||||
TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr,
|
||||
options, std::nullopt);
|
||||
|
||||
std::unique_ptr<LTOModule> Ret(new LTOModule(std::move(M), Buffer, target));
|
||||
Ret->parseSymbols();
|
||||
|
|
|
@ -618,7 +618,7 @@ std::unique_ptr<TargetMachine> TargetMachineBuilder::create() const {
|
|||
|
||||
std::unique_ptr<TargetMachine> TM(
|
||||
TheTarget->createTargetMachine(TheTriple.str(), MCpu, FeatureStr, Options,
|
||||
RelocModel, None, CGOptLevel));
|
||||
RelocModel, std::nullopt, CGOptLevel));
|
||||
assert(TM && "Cannot create target machine");
|
||||
|
||||
return TM;
|
||||
|
|
|
@ -255,7 +255,7 @@ Optional<std::string> LineEditor::readLine() const {
|
|||
|
||||
// Either of these may mean end-of-file.
|
||||
if (!Line || LineLen == 0)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
// Strip any newlines off the end of the string.
|
||||
while (LineLen > 0 &&
|
||||
|
|
|
@ -1056,7 +1056,7 @@ void ELFWriter::writeSectionHeader(
|
|||
// Null section first.
|
||||
uint64_t FirstSectionSize =
|
||||
(NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
|
||||
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, None, 0);
|
||||
WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, std::nullopt, 0);
|
||||
|
||||
for (const MCSectionELF *Section : SectionTable) {
|
||||
uint32_t GroupSymbolIndex;
|
||||
|
|
|
@ -75,7 +75,7 @@ MCAsmBackend::createDwoObjectWriter(raw_pwrite_stream &OS,
|
|||
}
|
||||
|
||||
Optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
|
||||
|
|
|
@ -266,12 +266,10 @@ public:
|
|||
void emitFileDirective(StringRef Filename) override;
|
||||
void emitFileDirective(StringRef Filename, StringRef CompilerVerion,
|
||||
StringRef TimeStamp, StringRef Description) override;
|
||||
Expected<unsigned> tryEmitDwarfFileDirective(unsigned FileNo,
|
||||
StringRef Directory,
|
||||
StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = None,
|
||||
Optional<StringRef> Source = None,
|
||||
unsigned CUID = 0) override;
|
||||
Expected<unsigned> tryEmitDwarfFileDirective(
|
||||
unsigned FileNo, StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum = std::nullopt,
|
||||
Optional<StringRef> Source = std::nullopt, unsigned CUID = 0) override;
|
||||
void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
|
||||
Optional<MD5::MD5Result> Checksum,
|
||||
Optional<StringRef> Source,
|
||||
|
@ -1499,7 +1497,7 @@ void MCAsmStreamer::emitCodeAlignment(Align Alignment,
|
|||
emitAlignmentDirective(Alignment.value(), MAI->getTextAlignFillValue(), 1,
|
||||
MaxBytesToEmit);
|
||||
else
|
||||
emitAlignmentDirective(Alignment.value(), None, 1, MaxBytesToEmit);
|
||||
emitAlignmentDirective(Alignment.value(), std::nullopt, 1, MaxBytesToEmit);
|
||||
}
|
||||
|
||||
void MCAsmStreamer::emitValueToOffset(const MCExpr *Offset,
|
||||
|
@ -2383,7 +2381,7 @@ MCAsmStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
|
|||
Expr->print(OS, MAI);
|
||||
}
|
||||
EmitEOL();
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void MCAsmStreamer::emitAddrsig() {
|
||||
|
|
|
@ -318,9 +318,9 @@ std::pair<size_t, size_t> CodeViewContext::getLineExtent(unsigned FuncId) {
|
|||
|
||||
ArrayRef<MCCVLoc> CodeViewContext::getLinesForExtent(size_t L, size_t R) {
|
||||
if (R <= L)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
if (L >= MCCVLines.size())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return makeArrayRef(&MCCVLines[L], R - L);
|
||||
}
|
||||
|
||||
|
|
|
@ -639,7 +639,8 @@ Optional<unsigned> MCContext::getELFUniqueIDForEntsize(StringRef SectionName,
|
|||
unsigned EntrySize) {
|
||||
auto I = ELFEntrySizeMap.find(
|
||||
MCContext::ELFEntrySizeKey{SectionName, Flags, EntrySize});
|
||||
return (I != ELFEntrySizeMap.end()) ? Optional<unsigned>(I->second) : None;
|
||||
return (I != ELFEntrySizeMap.end()) ? Optional<unsigned>(I->second)
|
||||
: std::nullopt;
|
||||
}
|
||||
|
||||
MCSectionGOFF *MCContext::getGOFFSection(StringRef Section, SectionKind Kind,
|
||||
|
@ -960,7 +961,7 @@ void MCContext::setGenDwarfRootFile(StringRef InputFileName, StringRef Buffer) {
|
|||
FileName = FileName.drop_front();
|
||||
assert(!FileName.empty());
|
||||
setMCLineTableRootFile(
|
||||
/*CUID=*/0, getCompilationDir(), FileName, Cksum, None);
|
||||
/*CUID=*/0, getCompilationDir(), FileName, Cksum, std::nullopt);
|
||||
}
|
||||
|
||||
/// getDwarfFile - takes a file name and number to place in the dwarf file and
|
||||
|
|
|
@ -17,7 +17,7 @@ Optional<MCDisassembler::DecodeStatus>
|
|||
MCDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
|
||||
ArrayRef<uint8_t> Bytes, uint64_t Address,
|
||||
raw_ostream &CStream) const {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
uint64_t MCDisassembler::suggestBytesToSkip(ArrayRef<uint8_t> Bytes,
|
||||
|
|
|
@ -284,9 +284,9 @@ void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
|
|||
MCSection *Section) const {
|
||||
if (!HasSplitLineTable)
|
||||
return;
|
||||
Optional<MCDwarfLineStr> NoLineStr(None);
|
||||
Optional<MCDwarfLineStr> NoLineStr(std::nullopt);
|
||||
MCOS.switchSection(Section);
|
||||
MCOS.emitLabel(Header.Emit(&MCOS, Params, None, NoLineStr).second);
|
||||
MCOS.emitLabel(Header.Emit(&MCOS, Params, std::nullopt, NoLineStr).second);
|
||||
}
|
||||
|
||||
std::pair<MCSymbol *, MCSymbol *>
|
||||
|
@ -594,7 +594,7 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
|
|||
// If any files have embedded source, they all must.
|
||||
if (MCDwarfFiles.empty()) {
|
||||
trackMD5Usage(Checksum.has_value());
|
||||
HasSource = (Source != None);
|
||||
HasSource = (Source != std::nullopt);
|
||||
}
|
||||
if (DwarfVersion >= 5 && isRootFile(RootFile, Directory, FileName, Checksum))
|
||||
return 0;
|
||||
|
@ -622,7 +622,7 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
|
|||
inconvertibleErrorCode());
|
||||
|
||||
// If any files have embedded source, they all must.
|
||||
if (HasSource != (Source != None))
|
||||
if (HasSource != (Source != std::nullopt))
|
||||
return make_error<StringError>("inconsistent use of embedded source",
|
||||
inconvertibleErrorCode());
|
||||
|
||||
|
|
|
@ -33,11 +33,11 @@ bool MCInstrAnalysis::evaluateBranch(const MCInst & /*Inst*/, uint64_t /*Addr*/,
|
|||
Optional<uint64_t> MCInstrAnalysis::evaluateMemoryOperandAddress(
|
||||
const MCInst &Inst, const MCSubtargetInfo *STI, uint64_t Addr,
|
||||
uint64_t Size) const {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<uint64_t>
|
||||
MCInstrAnalysis::getMemoryOperandRelocationOffset(const MCInst &Inst,
|
||||
uint64_t Size) const {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
|
@ -972,47 +972,53 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
|
|||
// sections, and the individual DWARF sections are distinguished by their
|
||||
// section subtype.
|
||||
DwarfAbbrevSection = Ctx->getXCOFFSection(
|
||||
".dwabrev", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwabrev", SectionKind::getMetadata(),
|
||||
/* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwabrev", XCOFF::SSUBTYP_DWABREV);
|
||||
|
||||
DwarfInfoSection = Ctx->getXCOFFSection(
|
||||
".dwinfo", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwinfo", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwinfo", XCOFF::SSUBTYP_DWINFO);
|
||||
|
||||
DwarfLineSection = Ctx->getXCOFFSection(
|
||||
".dwline", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwline", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwline", XCOFF::SSUBTYP_DWLINE);
|
||||
|
||||
DwarfFrameSection = Ctx->getXCOFFSection(
|
||||
".dwframe", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwframe", SectionKind::getMetadata(),
|
||||
/* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwframe", XCOFF::SSUBTYP_DWFRAME);
|
||||
|
||||
DwarfPubNamesSection = Ctx->getXCOFFSection(
|
||||
".dwpbnms", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwpbnms", SectionKind::getMetadata(),
|
||||
/* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwpbnms", XCOFF::SSUBTYP_DWPBNMS);
|
||||
|
||||
DwarfPubTypesSection = Ctx->getXCOFFSection(
|
||||
".dwpbtyp", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwpbtyp", SectionKind::getMetadata(),
|
||||
/* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwpbtyp", XCOFF::SSUBTYP_DWPBTYP);
|
||||
|
||||
DwarfStrSection = Ctx->getXCOFFSection(
|
||||
".dwstr", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwstr", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwstr", XCOFF::SSUBTYP_DWSTR);
|
||||
|
||||
DwarfLocSection = Ctx->getXCOFFSection(
|
||||
".dwloc", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwloc", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwloc", XCOFF::SSUBTYP_DWLOC);
|
||||
|
||||
DwarfARangesSection = Ctx->getXCOFFSection(
|
||||
".dwarnge", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwarnge", SectionKind::getMetadata(),
|
||||
/* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwarnge", XCOFF::SSUBTYP_DWARNGE);
|
||||
|
||||
DwarfRangesSection = Ctx->getXCOFFSection(
|
||||
".dwrnges", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwrnges", SectionKind::getMetadata(),
|
||||
/* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwrnges", XCOFF::SSUBTYP_DWRNGES);
|
||||
|
||||
DwarfMacinfoSection = Ctx->getXCOFFSection(
|
||||
".dwmac", SectionKind::getMetadata(), /* CsectProperties */ None,
|
||||
".dwmac", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
|
||||
/* MultiSymbolsAllowed */ true, ".dwmac", XCOFF::SSUBTYP_DWMAC);
|
||||
}
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ static Optional<uint64_t> absoluteSymbolDiff(const MCSymbol *Hi,
|
|||
assert(Hi && Lo);
|
||||
if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment() ||
|
||||
Hi->isVariable() || Lo->isVariable())
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
return Hi->getOffset() - Lo->getOffset();
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
|
|||
std::string("symbol in offset has no data "
|
||||
"fragment"));
|
||||
DF = cast<MCDataFragment>(Fragment);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (OffsetVal.getSymB())
|
||||
|
@ -785,7 +785,7 @@ getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
|
|||
"fragment"));
|
||||
DF = cast<MCDataFragment>(Fragment);
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<std::pair<bool, std::string>>
|
||||
|
@ -814,7 +814,7 @@ MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
|
|||
return std::make_pair(false, std::string(".reloc offset is negative"));
|
||||
DF->getFixups().push_back(
|
||||
MCFixup::create(OffsetVal.getConstant(), Expr, Kind, Loc));
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
if (OffsetVal.getSymB())
|
||||
return std::make_pair(false,
|
||||
|
@ -827,19 +827,19 @@ MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
|
|||
Optional<std::pair<bool, std::string>> Error;
|
||||
Error = getOffsetAndDataFragment(Symbol, SymbolOffset, DF);
|
||||
|
||||
if (Error != None)
|
||||
if (Error != std::nullopt)
|
||||
return Error;
|
||||
|
||||
DF->getFixups().push_back(
|
||||
MCFixup::create(SymbolOffset + OffsetVal.getConstant(),
|
||||
Expr, Kind, Loc));
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
PendingFixups.emplace_back(
|
||||
&SRE.getSymbol(), DF,
|
||||
MCFixup::create(OffsetVal.getConstant(), Expr, Kind, Loc));
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
|
||||
|
|
|
@ -237,9 +237,11 @@ public:
|
|||
AssemblerDialect = i;
|
||||
}
|
||||
|
||||
void Note(SMLoc L, const Twine &Msg, SMRange Range = None) override;
|
||||
bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) override;
|
||||
bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) override;
|
||||
void Note(SMLoc L, const Twine &Msg, SMRange Range = std::nullopt) override;
|
||||
bool Warning(SMLoc L, const Twine &Msg,
|
||||
SMRange Range = std::nullopt) override;
|
||||
bool printError(SMLoc L, const Twine &Msg,
|
||||
SMRange Range = std::nullopt) override;
|
||||
|
||||
const AsmToken &Lex() override;
|
||||
|
||||
|
@ -322,7 +324,7 @@ private:
|
|||
|
||||
void printMacroInstantiations();
|
||||
void printMessage(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Msg,
|
||||
SMRange Range = None) const {
|
||||
SMRange Range = std::nullopt) const {
|
||||
ArrayRef<SMRange> Ranges(Range);
|
||||
SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges);
|
||||
}
|
||||
|
@ -949,10 +951,9 @@ bool AsmParser::enabledGenDwarfForAssembly() {
|
|||
// Use the first #line directive for this, if any. It's preprocessed, so
|
||||
// there is no checksum, and of course no source directive.
|
||||
if (!FirstCppHashFilename.empty())
|
||||
getContext().setMCLineTableRootFile(/*CUID=*/0,
|
||||
getContext().getCompilationDir(),
|
||||
FirstCppHashFilename,
|
||||
/*Cksum=*/None, /*Source=*/None);
|
||||
getContext().setMCLineTableRootFile(
|
||||
/*CUID=*/0, getContext().getCompilationDir(), FirstCppHashFilename,
|
||||
/*Cksum=*/std::nullopt, /*Source=*/std::nullopt);
|
||||
const MCDwarfFile &RootFile =
|
||||
getContext().getMCDwarfLineTable(/*CUID=*/0).getRootFile();
|
||||
getContext().setGenDwarfFileNumber(getStreamer().emitDwarfFileDirective(
|
||||
|
@ -5698,7 +5699,8 @@ bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
|
|||
raw_svector_ostream OS(Buf);
|
||||
while (Count--) {
|
||||
// Note that the AtPseudoVariable is disabled for instantiations of .rep(t).
|
||||
if (expandMacro(OS, M->Body, None, None, false, getTok().getLoc()))
|
||||
if (expandMacro(OS, M->Body, std::nullopt, std::nullopt, false,
|
||||
getTok().getLoc()))
|
||||
return true;
|
||||
}
|
||||
instantiateMacroLikeBody(M, DirectiveLoc, OS);
|
||||
|
|
|
@ -510,9 +510,11 @@ public:
|
|||
AssemblerDialect = i;
|
||||
}
|
||||
|
||||
void Note(SMLoc L, const Twine &Msg, SMRange Range = None) override;
|
||||
bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) override;
|
||||
bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) override;
|
||||
void Note(SMLoc L, const Twine &Msg, SMRange Range = std::nullopt) override;
|
||||
bool Warning(SMLoc L, const Twine &Msg,
|
||||
SMRange Range = std::nullopt) override;
|
||||
bool printError(SMLoc L, const Twine &Msg,
|
||||
SMRange Range = std::nullopt) override;
|
||||
|
||||
enum ExpandKind { ExpandMacros, DoNotExpandMacros };
|
||||
const AsmToken &Lex(ExpandKind ExpandNextToken);
|
||||
|
@ -619,7 +621,7 @@ private:
|
|||
bool expandStatement(SMLoc Loc);
|
||||
|
||||
void printMessage(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Msg,
|
||||
SMRange Range = None) const {
|
||||
SMRange Range = std::nullopt) const {
|
||||
ArrayRef<SMRange> Ranges(Range);
|
||||
SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges);
|
||||
}
|
||||
|
@ -1323,10 +1325,9 @@ bool MasmParser::enabledGenDwarfForAssembly() {
|
|||
// Use the first #line directive for this, if any. It's preprocessed, so
|
||||
// there is no checksum, and of course no source directive.
|
||||
if (!FirstCppHashFilename.empty())
|
||||
getContext().setMCLineTableRootFile(/*CUID=*/0,
|
||||
getContext().getCompilationDir(),
|
||||
FirstCppHashFilename,
|
||||
/*Cksum=*/None, /*Source=*/None);
|
||||
getContext().setMCLineTableRootFile(
|
||||
/*CUID=*/0, getContext().getCompilationDir(), FirstCppHashFilename,
|
||||
/*Cksum=*/std::nullopt, /*Source=*/std::nullopt);
|
||||
const MCDwarfFile &RootFile =
|
||||
getContext().getMCDwarfLineTable(/*CUID=*/0).getRootFile();
|
||||
getContext().setGenDwarfFileNumber(getStreamer().emitDwarfFileDirective(
|
||||
|
@ -6991,7 +6992,8 @@ bool MasmParser::parseDirectiveRepeat(SMLoc DirectiveLoc, StringRef Dir) {
|
|||
SmallString<256> Buf;
|
||||
raw_svector_ostream OS(Buf);
|
||||
while (Count--) {
|
||||
if (expandMacro(OS, M->Body, None, None, M->Locals, getTok().getLoc()))
|
||||
if (expandMacro(OS, M->Body, std::nullopt, std::nullopt, M->Locals,
|
||||
getTok().getLoc()))
|
||||
return true;
|
||||
}
|
||||
instantiateMacroLikeBody(M, DirectiveLoc, OS);
|
||||
|
@ -7024,7 +7026,8 @@ bool MasmParser::parseDirectiveWhile(SMLoc DirectiveLoc) {
|
|||
if (Condition) {
|
||||
// Instantiate the macro, then resume at this directive to recheck the
|
||||
// condition.
|
||||
if (expandMacro(OS, M->Body, None, None, M->Locals, getTok().getLoc()))
|
||||
if (expandMacro(OS, M->Body, std::nullopt, std::nullopt, M->Locals,
|
||||
getTok().getLoc()))
|
||||
return true;
|
||||
instantiateMacroLikeBody(M, DirectiveLoc, /*ExitLoc=*/DirectiveLoc, OS);
|
||||
}
|
||||
|
|
|
@ -84,12 +84,12 @@ Optional<unsigned> MCRegisterInfo::getLLVMRegNum(unsigned RegNum,
|
|||
unsigned Size = isEH ? EHDwarf2LRegsSize : Dwarf2LRegsSize;
|
||||
|
||||
if (!M)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
DwarfLLVMRegPair Key = { RegNum, 0 };
|
||||
const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key);
|
||||
if (I != M + Size && I->FromReg == RegNum)
|
||||
return I->ToReg;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
int MCRegisterInfo::getDwarfRegNumFromDwarfEHRegNum(unsigned RegNum) const {
|
||||
|
|
|
@ -342,11 +342,11 @@ std::optional<unsigned> MCSubtargetInfo::getCacheSize(unsigned Level) const {
|
|||
|
||||
std::optional<unsigned>
|
||||
MCSubtargetInfo::getCacheAssociativity(unsigned Level) const {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<unsigned> MCSubtargetInfo::getCacheLineSize(unsigned Level) const {
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
unsigned MCSubtargetInfo::getPrefetchDistance() const {
|
||||
|
|
|
@ -287,7 +287,7 @@ static Optional<int64_t> GetOptionalAbsDifference(MCStreamer &Streamer,
|
|||
// unusual constructs, like an inline asm with an alignment directive.
|
||||
int64_t value;
|
||||
if (!Diff->evaluateAsAbsolute(value, OS->getAssembler()))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ Optional<StringRef> LoadCommand::getSegmentName() const {
|
|||
case MachO::LC_SEGMENT_64:
|
||||
return extractSegmentName(MLC.segment_command_64_data.segname);
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,6 +221,6 @@ Optional<uint64_t> LoadCommand::getSegmentVMAddr() const {
|
|||
case MachO::LC_SEGMENT_64:
|
||||
return MLC.segment_command_64_data.vmaddr;
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ struct SymbolEntry {
|
|||
}
|
||||
|
||||
Optional<uint32_t> section() const {
|
||||
return n_sect == MachO::NO_SECT ? None : Optional<uint32_t>(n_sect);
|
||||
return n_sect == MachO::NO_SECT ? std::nullopt : Optional<uint32_t>(n_sect);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ void MachOReader::readIndirectSymbolTable(Object &O) const {
|
|||
for (uint32_t i = 0; i < DySymTab.nindirectsyms; ++i) {
|
||||
uint32_t Index = MachOObj.getIndirectSymbolTableEntry(DySymTab, i);
|
||||
if ((Index & AbsOrLocalMask) != 0)
|
||||
O.IndirectSymTable.Symbols.emplace_back(Index, None);
|
||||
O.IndirectSymTable.Symbols.emplace_back(Index, std::nullopt);
|
||||
else
|
||||
O.IndirectSymTable.Symbols.emplace_back(
|
||||
Index, O.SymTable.getSymbolByIndex(Index));
|
||||
|
|
|
@ -1158,7 +1158,7 @@ Expected<Optional<Archive::Child>> Archive::findSym(StringRef name) const {
|
|||
return MemberOrErr.takeError();
|
||||
}
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// Returns true if archive file contains no member file.
|
||||
|
|
|
@ -54,7 +54,7 @@ Optional<BuildIDRef> getBuildID(const ObjectFile *Obj) {
|
|||
return getBuildID(O->getELFFile());
|
||||
if (auto *O = dyn_cast<ELFObjectFile<ELF64BE>>(Obj))
|
||||
return getBuildID(O->getELFFile());
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Optional<std::string> BuildIDFetcher::fetch(BuildIDRef BuildID) const {
|
||||
|
@ -86,7 +86,7 @@ Optional<std::string> BuildIDFetcher::fetch(BuildIDRef BuildID) const {
|
|||
return std::string(Path);
|
||||
}
|
||||
}
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
} // namespace object
|
||||
|
|
|
@ -383,7 +383,7 @@ Optional<StringRef> ELFObjectFileBase::tryGetCPUName() const {
|
|||
case ELF::EM_PPC64:
|
||||
return StringRef("future");
|
||||
default:
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -686,7 +686,7 @@ ELFObjectFileBase::getPltAddresses() const {
|
|||
if (PltEntryIter != GotToPlt.end()) {
|
||||
symbol_iterator Sym = Relocation.getSymbol();
|
||||
if (Sym == symbol_end())
|
||||
Result.emplace_back(None, PltEntryIter->second);
|
||||
Result.emplace_back(std::nullopt, PltEntryIter->second);
|
||||
else
|
||||
Result.emplace_back(Sym->getRawDataRefImpl(), PltEntryIter->second);
|
||||
}
|
||||
|
|
|
@ -4889,12 +4889,12 @@ MachOObjectFile::getLinkOptHintsLoadCommand() const {
|
|||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const {
|
||||
if (!DyldInfoLoadCmd)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto DyldInfoOrErr =
|
||||
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
|
||||
if (!DyldInfoOrErr)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
|
||||
const uint8_t *Ptr =
|
||||
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.rebase_off));
|
||||
|
@ -4903,12 +4903,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const {
|
|||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const {
|
||||
if (!DyldInfoLoadCmd)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto DyldInfoOrErr =
|
||||
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
|
||||
if (!DyldInfoOrErr)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
|
||||
const uint8_t *Ptr =
|
||||
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.bind_off));
|
||||
|
@ -4917,12 +4917,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const {
|
|||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const {
|
||||
if (!DyldInfoLoadCmd)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto DyldInfoOrErr =
|
||||
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
|
||||
if (!DyldInfoOrErr)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
|
||||
const uint8_t *Ptr =
|
||||
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.weak_bind_off));
|
||||
|
@ -4931,12 +4931,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const {
|
|||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const {
|
||||
if (!DyldInfoLoadCmd)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto DyldInfoOrErr =
|
||||
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
|
||||
if (!DyldInfoOrErr)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
|
||||
const uint8_t *Ptr =
|
||||
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.lazy_bind_off));
|
||||
|
@ -4945,12 +4945,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const {
|
|||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoExportsTrie() const {
|
||||
if (!DyldInfoLoadCmd)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto DyldInfoOrErr =
|
||||
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
|
||||
if (!DyldInfoOrErr)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
|
||||
const uint8_t *Ptr =
|
||||
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.export_off));
|
||||
|
@ -4961,7 +4961,7 @@ Expected<Optional<MachO::linkedit_data_command>>
|
|||
MachOObjectFile::getChainedFixupsLoadCommand() const {
|
||||
// Load the dyld chained fixups load command.
|
||||
if (!DyldChainedFixupsLoadCmd)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
auto DyldChainedFixupsOrErr = getStructOrErr<MachO::linkedit_data_command>(
|
||||
*this, DyldChainedFixupsLoadCmd);
|
||||
if (!DyldChainedFixupsOrErr)
|
||||
|
@ -4972,7 +4972,7 @@ MachOObjectFile::getChainedFixupsLoadCommand() const {
|
|||
// If the load command is present but the data offset has been zeroed out,
|
||||
// as is the case for dylib stubs, return None (no error).
|
||||
if (!DyldChainedFixups.dataoff)
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
return DyldChainedFixups;
|
||||
}
|
||||
|
||||
|
@ -4982,7 +4982,7 @@ MachOObjectFile::getChainedFixupsHeader() const {
|
|||
if (!CFOrErr)
|
||||
return CFOrErr.takeError();
|
||||
if (!CFOrErr->has_value())
|
||||
return llvm::None;
|
||||
return std::nullopt;
|
||||
|
||||
const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr;
|
||||
|
||||
|
@ -5236,12 +5236,12 @@ MachOObjectFile::getDyldChainedFixupTargets() const {
|
|||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getDyldExportsTrie() const {
|
||||
if (!DyldExportsTrieLoadCmd)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
auto DyldExportsTrieOrError = getStructOrErr<MachO::linkedit_data_command>(
|
||||
*this, DyldExportsTrieLoadCmd);
|
||||
if (!DyldExportsTrieOrError)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
MachO::linkedit_data_command DyldExportsTrie = DyldExportsTrieOrError.get();
|
||||
const uint8_t *Ptr =
|
||||
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldExportsTrie.dataoff));
|
||||
|
@ -5265,7 +5265,7 @@ SmallVector<uint64_t> MachOObjectFile::getFunctionStarts() const {
|
|||
|
||||
ArrayRef<uint8_t> MachOObjectFile::getUuid() const {
|
||||
if (!UuidLoadCmd)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
// Returning a pointer is fine as uuid doesn't need endian swapping.
|
||||
const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid);
|
||||
return makeArrayRef(reinterpret_cast<const uint8_t *>(Ptr), 16);
|
||||
|
|
|
@ -19,7 +19,7 @@ MinidumpFile::getRawStream(minidump::StreamType Type) const {
|
|||
auto It = StreamMap.find(Type);
|
||||
if (It != StreamMap.end())
|
||||
return getRawStream(Streams[It->second]);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Expected<std::string> MinidumpFile::getString(size_t Offset) const {
|
||||
|
|
|
@ -775,7 +775,7 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders,
|
|||
|
||||
if (!S->Offset)
|
||||
S->Offset = alignToOffset(CBA, sizeof(typename ELFT::uint),
|
||||
/*Offset=*/None);
|
||||
/*Offset=*/std::nullopt);
|
||||
else
|
||||
S->Offset = alignToOffset(CBA, /*Align=*/1, S->Offset);
|
||||
|
||||
|
@ -1015,8 +1015,8 @@ void ELFState<ELFT>::initSymtabSectionHeader(Elf_Shdr &SHeader,
|
|||
|
||||
assignSectionAddress(SHeader, YAMLSec);
|
||||
|
||||
SHeader.sh_offset =
|
||||
alignToOffset(CBA, SHeader.sh_addralign, RawSec ? RawSec->Offset : None);
|
||||
SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign,
|
||||
RawSec ? RawSec->Offset : std::nullopt);
|
||||
|
||||
if (RawSec && (RawSec->Content || RawSec->Size)) {
|
||||
assert(Symbols.empty());
|
||||
|
@ -1043,7 +1043,7 @@ void ELFState<ELFT>::initStrtabSectionHeader(Elf_Shdr &SHeader, StringRef Name,
|
|||
dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec);
|
||||
|
||||
SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign,
|
||||
YAMLSec ? YAMLSec->Offset : None);
|
||||
YAMLSec ? YAMLSec->Offset : std::nullopt);
|
||||
|
||||
if (RawSec && (RawSec->Content || RawSec->Size)) {
|
||||
SHeader.sh_size = writeContent(CBA, RawSec->Content, RawSec->Size);
|
||||
|
@ -1097,7 +1097,7 @@ void ELFState<ELFT>::initDWARFSectionHeader(Elf_Shdr &SHeader, StringRef Name,
|
|||
SHeader.sh_type = YAMLSec ? YAMLSec->Type : ELF::SHT_PROGBITS;
|
||||
SHeader.sh_addralign = YAMLSec ? (uint64_t)YAMLSec->AddressAlign : 1;
|
||||
SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign,
|
||||
YAMLSec ? YAMLSec->Offset : None);
|
||||
YAMLSec ? YAMLSec->Offset : std::nullopt);
|
||||
|
||||
ELFYAML::RawContentSection *RawSec =
|
||||
dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec);
|
||||
|
|
|
@ -1202,7 +1202,7 @@ struct NormalizedOther {
|
|||
|
||||
Optional<uint8_t> denormalize(IO &) {
|
||||
if (!Other)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
uint8_t Ret = 0;
|
||||
for (StOtherPiece &Val : *Other)
|
||||
Ret |= toValue(Val);
|
||||
|
|
|
@ -128,7 +128,7 @@ void ArgList::AddAllArgsExcept(ArgStringList &Output,
|
|||
/// This is a nicer interface when you don't have a list of Ids to exclude.
|
||||
void ArgList::AddAllArgs(ArgStringList &Output,
|
||||
ArrayRef<OptSpecifier> Ids) const {
|
||||
ArrayRef<OptSpecifier> Exclude = None;
|
||||
ArrayRef<OptSpecifier> Exclude = std::nullopt;
|
||||
AddAllArgsExcept(Output, Ids, Exclude);
|
||||
}
|
||||
|
||||
|
|
|
@ -474,19 +474,19 @@ void PassBuilder::registerLoopAnalyses(LoopAnalysisManager &LAM) {
|
|||
|
||||
static std::optional<int> parseRepeatPassName(StringRef Name) {
|
||||
if (!Name.consume_front("repeat<") || !Name.consume_back(">"))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
int Count;
|
||||
if (Name.getAsInteger(0, Count) || Count <= 0)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return Count;
|
||||
}
|
||||
|
||||
static std::optional<int> parseDevirtPassName(StringRef Name) {
|
||||
if (!Name.consume_front("devirt<") || !Name.consume_back(">"))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
int Count;
|
||||
if (Name.getAsInteger(0, Count) || Count < 0)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return Count;
|
||||
}
|
||||
|
||||
|
@ -1060,7 +1060,7 @@ PassBuilder::parsePipelineText(StringRef Text) {
|
|||
do {
|
||||
// If we try to pop the outer pipeline we have unbalanced parentheses.
|
||||
if (PipelineStack.size() == 1)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
PipelineStack.pop_back();
|
||||
} while (Text.consume_front(")"));
|
||||
|
@ -1072,12 +1072,12 @@ PassBuilder::parsePipelineText(StringRef Text) {
|
|||
// Otherwise, the end of an inner pipeline always has to be followed by
|
||||
// a comma, and then we can continue.
|
||||
if (!Text.consume_front(","))
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
if (PipelineStack.size() > 1)
|
||||
// Unbalanced paretheses.
|
||||
return None;
|
||||
return std::nullopt;
|
||||
|
||||
assert(PipelineStack.back() == &ResultPipeline &&
|
||||
"Wrong pipeline at the bottom of the stack!");
|
||||
|
|
|
@ -53,7 +53,7 @@ LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, const char *Passes,
|
|||
|
||||
Module *Mod = unwrap(M);
|
||||
PassInstrumentationCallbacks PIC;
|
||||
PassBuilder PB(Machine, PassOpts->PTO, None, &PIC);
|
||||
PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC);
|
||||
|
||||
LoopAnalysisManager LAM;
|
||||
FunctionAnalysisManager FAM;
|
||||
|
|
|
@ -1877,7 +1877,7 @@ std::string DotCfgChangeReporter::genHTML(StringRef Text, StringRef DotFile,
|
|||
return "Unable to find dot executable.";
|
||||
|
||||
StringRef Args[] = {DotBinary, "-Tpdf", "-o", PDFFile, DotFile};
|
||||
int Result = sys::ExecuteAndWait(*DotExe, Args, None);
|
||||
int Result = sys::ExecuteAndWait(*DotExe, Args, std::nullopt);
|
||||
if (Result < 0)
|
||||
return "Error executing system dot.";
|
||||
|
||||
|
|
|
@ -558,7 +558,7 @@ class SegmentBuilder {
|
|||
|
||||
// Complete any remaining active regions.
|
||||
if (!ActiveRegions.empty())
|
||||
completeRegionsUntil(None, 0);
|
||||
completeRegionsUntil(std::nullopt, 0);
|
||||
}
|
||||
|
||||
/// Sort a nested sequence of regions from a single file.
|
||||
|
@ -684,7 +684,7 @@ static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {
|
|||
IsNotExpandedFile[CR.ExpandedFileID] = false;
|
||||
int I = IsNotExpandedFile.find_first();
|
||||
if (I == -1)
|
||||
return None;
|
||||
return std::nullopt;
|
||||
return I;
|
||||
}
|
||||
|
||||
|
@ -695,7 +695,7 @@ static Optional<unsigned> findMainViewFileID(StringRef SourceFile,
|
|||
Optional<unsigned> I = findMainViewFileID(Function);
|
||||
if (I && SourceFile == Function.Filenames[*I])
|
||||
return I;
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
static bool isExpansion(const CountedRegion &R, unsigned FileID) {
|
||||
|
|
|
@ -817,8 +817,8 @@ static Error readCoverageMappingData(
|
|||
// In Version4, function records are not affixed to coverage headers. Read
|
||||
// the records from their dedicated section.
|
||||
if (Version >= CovMapVersion::Version4)
|
||||
return Reader->readFunctionRecords(FuncRecBuf, FuncRecBufEnd, None, nullptr,
|
||||
nullptr);
|
||||
return Reader->readFunctionRecords(FuncRecBuf, FuncRecBufEnd, std::nullopt,
|
||||
nullptr, nullptr);
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
|
|
|
@ -1824,7 +1824,7 @@ Optional<StringRef>
|
|||
SampleProfileReaderItaniumRemapper::lookUpNameInProfile(StringRef Fname) {
|
||||
if (auto Key = Remappings->lookup(Fname))
|
||||
return NameMap.lookup(Key);
|
||||
return None;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
/// Prepare a memory buffer for the contents of \p Filename.
|
||||
|
|
|
@ -501,7 +501,7 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) {
|
|||
std::unique_ptr<Remark> Result = std::make_unique<Remark>();
|
||||
Remark &R = *Result;
|
||||
|
||||
if (StrTab == None)
|
||||
if (StrTab == std::nullopt)
|
||||
return createStringError(
|
||||
std::make_error_code(std::errc::invalid_argument),
|
||||
"Error while parsing BLOCK_REMARK: missing string table.");
|
||||
|
|
|
@ -77,8 +77,8 @@ private:
|
|||
};
|
||||
|
||||
Expected<std::unique_ptr<BitstreamRemarkParser>> createBitstreamParserFromMeta(
|
||||
StringRef Buf, Optional<ParsedStringTable> StrTab = None,
|
||||
Optional<StringRef> ExternalFilePrependPath = None);
|
||||
StringRef Buf, Optional<ParsedStringTable> StrTab = std::nullopt,
|
||||
Optional<StringRef> ExternalFilePrependPath = std::nullopt);
|
||||
|
||||
} // end namespace remarks
|
||||
} // end namespace llvm
|
||||
|
|
|
@ -245,19 +245,19 @@ void BitstreamRemarkSerializerHelper::emitMetaBlock(
|
|||
|
||||
switch (ContainerType) {
|
||||
case BitstreamRemarkContainerType::SeparateRemarksMeta:
|
||||
assert(StrTab != None && *StrTab != nullptr);
|
||||
assert(StrTab != std::nullopt && *StrTab != nullptr);
|
||||
emitMetaStrTab(**StrTab);
|
||||
assert(Filename != None);
|
||||
assert(Filename != std::nullopt);
|
||||
emitMetaExternalFile(*Filename);
|
||||
break;
|
||||
case BitstreamRemarkContainerType::SeparateRemarksFile:
|
||||
assert(RemarkVersion != None);
|
||||
assert(RemarkVersion != std::nullopt);
|
||||
emitMetaRemarkVersion(*RemarkVersion);
|
||||
break;
|
||||
case BitstreamRemarkContainerType::Standalone:
|
||||
assert(RemarkVersion != None);
|
||||
assert(RemarkVersion != std::nullopt);
|
||||
emitMetaRemarkVersion(*RemarkVersion);
|
||||
assert(StrTab != None && *StrTab != nullptr);
|
||||
assert(StrTab != std::nullopt && *StrTab != nullptr);
|
||||
emitMetaStrTab(**StrTab);
|
||||
break;
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ void BitstreamRemarkSerializerHelper::emitRemarkBlock(const Remark &Remark,
|
|||
R.clear();
|
||||
unsigned Key = StrTab.add(Arg.Key).first;
|
||||
unsigned Val = StrTab.add(Arg.Val).first;
|
||||
bool HasDebugLoc = Arg.Loc != None;
|
||||
bool HasDebugLoc = Arg.Loc != std::nullopt;
|
||||
R.push_back(HasDebugLoc ? RECORD_REMARK_ARG_WITH_DEBUGLOC
|
||||
: RECORD_REMARK_ARG_WITHOUT_DEBUGLOC);
|
||||
R.push_back(Key);
|
||||
|
@ -353,7 +353,7 @@ void BitstreamRemarkSerializer::emit(const Remark &Remark) {
|
|||
Helper.ContainerType == BitstreamRemarkContainerType::Standalone;
|
||||
BitstreamMetaSerializer MetaSerializer(
|
||||
OS, Helper,
|
||||
IsStandalone ? &*StrTab : Optional<const StringTable *>(None));
|
||||
IsStandalone ? &*StrTab : Optional<const StringTable *>(std::nullopt));
|
||||
MetaSerializer.emit();
|
||||
DidSetUp = true;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ Error RemarkLinker::link(StringRef Buffer, Optional<Format> RemarkFormat) {
|
|||
|
||||
Expected<std::unique_ptr<RemarkParser>> MaybeParser =
|
||||
createRemarkParserFromMeta(
|
||||
*RemarkFormat, Buffer, /*StrTab=*/None,
|
||||
*RemarkFormat, Buffer, /*StrTab=*/std::nullopt,
|
||||
PrependPath ? Optional<StringRef>(StringRef(*PrependPath))
|
||||
: Optional<StringRef>());
|
||||
if (!MaybeParser)
|
||||
|
|
|
@ -113,7 +113,7 @@ struct CParser {
|
|||
std::optional<std::string> Err;
|
||||
|
||||
CParser(Format ParserFormat, StringRef Buf,
|
||||
std::optional<ParsedStringTable> StrTab = None)
|
||||
std::optional<ParsedStringTable> StrTab = std::nullopt)
|
||||
: TheParser(cantFail(
|
||||
StrTab ? createRemarkParser(ParserFormat, Buf, std::move(*StrTab))
|
||||
: createRemarkParser(ParserFormat, Buf))) {}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue