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