[llvm] aadaafa - [llvm] Use std::nullopt instead of None (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 2 21:12:02 PST 2022
Author: Kazu Hirata
Date: 2022-12-02T21:11:44-08:00
New Revision: aadaaface2ec96ee30d92bf46faa41dd9e68b64d
URL: https://github.com/llvm/llvm-project/commit/aadaaface2ec96ee30d92bf46faa41dd9e68b64d
DIFF: https://github.com/llvm/llvm-project/commit/aadaaface2ec96ee30d92bf46faa41dd9e68b64d.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/AsmParser/LLParser.h
llvm/include/llvm/AsmParser/Parser.h
llvm/include/llvm/BinaryFormat/AMDGPUMetadataVerifier.h
llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/include/llvm/Bitstream/BitstreamWriter.h
llvm/include/llvm/DWP/DWP.h
llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h
llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h
llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/include/llvm/FuzzMutate/OpDescriptor.h
llvm/include/llvm/IRReader/IRReader.h
llvm/include/llvm/LTO/Config.h
llvm/include/llvm/MC/MCContext.h
llvm/include/llvm/MC/MCParser/MCAsmParser.h
llvm/include/llvm/MC/MCSectionXCOFF.h
llvm/include/llvm/MC/MCStreamer.h
llvm/include/llvm/MC/TargetRegistry.h
llvm/include/llvm/ObjCopy/CommonConfig.h
llvm/include/llvm/Object/ELF.h
llvm/include/llvm/Object/ELFObjectFile.h
llvm/include/llvm/Object/ObjectFile.h
llvm/include/llvm/Passes/PassBuilder.h
llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
llvm/include/llvm/ProfileData/InstrProf.h
llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
llvm/include/llvm/Remarks/HotnessThresholdParser.h
llvm/include/llvm/Remarks/RemarkLinker.h
llvm/include/llvm/Remarks/RemarkParser.h
llvm/include/llvm/Remarks/RemarkSerializer.h
llvm/include/llvm/Remarks/RemarkStreamer.h
llvm/include/llvm/Remarks/YAMLRemarkSerializer.h
llvm/include/llvm/Target/CodeGenCWrappers.h
llvm/include/llvm/Target/TargetMachine.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/AsmParser/Parser.cpp
llvm/lib/BinaryFormat/Dwarf.cpp
llvm/lib/Bitstream/Reader/BitstreamReader.cpp
llvm/lib/DWARFLinker/DWARFStreamer.cpp
llvm/lib/Debuginfod/BuildIDFetcher.cpp
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp
llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
llvm/lib/ExecutionEngine/Orc/ObjectFileInterface.cpp
llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp
llvm/lib/FileCheck/FileCheck.cpp
llvm/lib/FileCheck/FileCheckImpl.h
llvm/lib/Frontend/OpenMP/OMPContext.cpp
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
llvm/lib/FuzzMutate/IRMutator.cpp
llvm/lib/FuzzMutate/Operations.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/LTO/LTOModule.cpp
llvm/lib/LTO/ThinLTOCodeGenerator.cpp
llvm/lib/LineEditor/LineEditor.cpp
llvm/lib/MC/ELFObjectWriter.cpp
llvm/lib/MC/MCAsmBackend.cpp
llvm/lib/MC/MCAsmStreamer.cpp
llvm/lib/MC/MCCodeView.cpp
llvm/lib/MC/MCContext.cpp
llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
llvm/lib/MC/MCDwarf.cpp
llvm/lib/MC/MCInstrAnalysis.cpp
llvm/lib/MC/MCObjectFileInfo.cpp
llvm/lib/MC/MCObjectStreamer.cpp
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/lib/MC/MCRegisterInfo.cpp
llvm/lib/MC/MCSubtargetInfo.cpp
llvm/lib/MC/MCWin64EH.cpp
llvm/lib/ObjCopy/MachO/MachOObject.cpp
llvm/lib/ObjCopy/MachO/MachOObject.h
llvm/lib/ObjCopy/MachO/MachOReader.cpp
llvm/lib/Object/Archive.cpp
llvm/lib/Object/BuildID.cpp
llvm/lib/Object/ELFObjectFile.cpp
llvm/lib/Object/MachOObjectFile.cpp
llvm/lib/Object/Minidump.cpp
llvm/lib/ObjectYAML/ELFEmitter.cpp
llvm/lib/ObjectYAML/ELFYAML.cpp
llvm/lib/Option/ArgList.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassBuilderBindings.cpp
llvm/lib/Passes/StandardInstrumentations.cpp
llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
llvm/lib/ProfileData/SampleProfReader.cpp
llvm/lib/Remarks/BitstreamRemarkParser.cpp
llvm/lib/Remarks/BitstreamRemarkParser.h
llvm/lib/Remarks/BitstreamRemarkSerializer.cpp
llvm/lib/Remarks/RemarkLinker.cpp
llvm/lib/Remarks/RemarkParser.cpp
llvm/lib/Remarks/RemarkStreamer.cpp
llvm/lib/Remarks/YAMLRemarkParser.cpp
llvm/lib/Remarks/YAMLRemarkParser.h
llvm/lib/Remarks/YAMLRemarkSerializer.cpp
llvm/lib/Support/APInt.cpp
llvm/lib/Support/CrashRecoveryContext.cpp
llvm/lib/Support/DJB.cpp
llvm/lib/Support/ELFAttributes.cpp
llvm/lib/Support/FormatVariadic.cpp
llvm/lib/Support/GraphWriter.cpp
llvm/lib/Support/JSON.cpp
llvm/lib/Support/KnownBits.cpp
llvm/lib/Support/LineIterator.cpp
llvm/lib/Support/LockFileManager.cpp
llvm/lib/Support/OptimizedStructLayout.cpp
llvm/lib/Support/RISCVISAInfo.cpp
llvm/lib/Support/ScopedPrinter.cpp
llvm/lib/Support/Signals.cpp
llvm/lib/Support/SymbolRemappingReader.cpp
llvm/lib/Support/UnicodeNameToCodepoint.cpp
llvm/lib/Support/Unix/Process.inc
llvm/lib/Support/VirtualFileSystem.cpp
llvm/lib/Support/YAMLParser.cpp
llvm/lib/TableGen/Parser.cpp
llvm/lib/TableGen/Record.cpp
llvm/lib/TableGen/TGParser.cpp
llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
llvm/lib/XRay/InstrumentationMap.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/AsmParser/LLParser.h b/llvm/include/llvm/AsmParser/LLParser.h
index 321b02c70cd39..f2fba49ab7054 100644
--- a/llvm/include/llvm/AsmParser/LLParser.h
+++ b/llvm/include/llvm/AsmParser/LLParser.h
@@ -181,7 +181,7 @@ namespace llvm {
BlockAddressPFS(nullptr) {}
bool Run(
bool UpgradeDebugInfo, DataLayoutCallbackTy DataLayoutCallback =
- [](StringRef) { return None; });
+ [](StringRef) { return std::nullopt; });
bool parseStandaloneConstantValue(Constant *&C, const SlotMapping *Slots);
diff --git a/llvm/include/llvm/AsmParser/Parser.h b/llvm/include/llvm/AsmParser/Parser.h
index 336e95c2399f0..b567a3e61f527 100644
--- a/llvm/include/llvm/AsmParser/Parser.h
+++ b/llvm/include/llvm/AsmParser/Parser.h
@@ -87,7 +87,9 @@ struct ParsedModuleAndIndex {
ParsedModuleAndIndex parseAssemblyFileWithIndex(
StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
SlotMapping *Slots = nullptr,
- DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
+ DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
+ return std::nullopt;
+ });
/// Only for use in llvm-as for testing; this does not produce a valid module.
ParsedModuleAndIndex parseAssemblyFileWithIndexNoUpgradeDebugInfo(
@@ -126,7 +128,9 @@ parseSummaryIndexAssemblyString(StringRef AsmString, SMDiagnostic &Err);
std::unique_ptr<Module> parseAssembly(
MemoryBufferRef F, SMDiagnostic &Err, LLVMContext &Context,
SlotMapping *Slots = nullptr,
- DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
+ DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
+ return std::nullopt;
+ });
/// Parse LLVM Assembly including the summary index from a MemoryBuffer.
///
@@ -166,7 +170,9 @@ parseSummaryIndexAssembly(MemoryBufferRef F, SMDiagnostic &Err);
bool parseAssemblyInto(
MemoryBufferRef F, Module *M, ModuleSummaryIndex *Index, SMDiagnostic &Err,
SlotMapping *Slots = nullptr,
- DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
+ DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
+ return std::nullopt;
+ });
/// Parse a type and a constant value in the given string.
///
diff --git a/llvm/include/llvm/BinaryFormat/AMDGPUMetadataVerifier.h b/llvm/include/llvm/BinaryFormat/AMDGPUMetadataVerifier.h
index c94cafe7458b3..04afcf10c5957 100644
--- a/llvm/include/llvm/BinaryFormat/AMDGPUMetadataVerifier.h
+++ b/llvm/include/llvm/BinaryFormat/AMDGPUMetadataVerifier.h
@@ -50,7 +50,7 @@ class MetadataVerifier {
bool verifyInteger(msgpack::DocNode &Node);
bool verifyArray(msgpack::DocNode &Node,
function_ref<bool(msgpack::DocNode &)> verifyNode,
- Optional<size_t> Size = None);
+ Optional<size_t> Size = std::nullopt);
bool verifyEntry(msgpack::MapDocNode &MapNode, StringRef Key, bool Required,
function_ref<bool(msgpack::DocNode &)> verifyNode);
bool
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index bdd71724b3030..fad4bb936ee09 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -916,7 +916,7 @@ HANDLE_DW_LANG(0x0023, Fortran08, 1, 5, DWARF)
HANDLE_DW_LANG(0x0024, RenderScript, 0, 5, DWARF)
HANDLE_DW_LANG(0x0025, BLISS, 0, 5, DWARF)
// Vendor extensions:
-HANDLE_DW_LANG(0x8001, Mips_Assembler, None, 0, MIPS)
+HANDLE_DW_LANG(0x8001, Mips_Assembler, std::nullopt, 0, MIPS)
HANDLE_DW_LANG(0x8e57, GOOGLE_RenderScript, 0, 0, GOOGLE)
HANDLE_DW_LANG(0xb000, BORLAND_Delphi, 0, 0, BORLAND)
diff --git a/llvm/include/llvm/Bitstream/BitstreamWriter.h b/llvm/include/llvm/Bitstream/BitstreamWriter.h
index 1475c3272dad6..f087061856734 100644
--- a/llvm/include/llvm/Bitstream/BitstreamWriter.h
+++ b/llvm/include/llvm/Bitstream/BitstreamWriter.h
@@ -502,7 +502,8 @@ class BitstreamWriter {
/// the first entry.
template <typename Container>
void EmitRecordWithAbbrev(unsigned Abbrev, const Container &Vals) {
- EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), StringRef(), None);
+ EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), StringRef(),
+ std::nullopt);
}
/// EmitRecordWithBlob - Emit the specified record to the stream, using an
@@ -513,13 +514,13 @@ class BitstreamWriter {
template <typename Container>
void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals,
StringRef Blob) {
- EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Blob, None);
+ EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Blob, std::nullopt);
}
template <typename Container>
void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals,
const char *BlobData, unsigned BlobLen) {
return EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals),
- StringRef(BlobData, BlobLen), None);
+ StringRef(BlobData, BlobLen), std::nullopt);
}
/// EmitRecordWithArray - Just like EmitRecordWithBlob, works with records
@@ -527,13 +528,14 @@ class BitstreamWriter {
template <typename Container>
void EmitRecordWithArray(unsigned Abbrev, const Container &Vals,
StringRef Array) {
- EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Array, None);
+ EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Array, std::nullopt);
}
template <typename Container>
void EmitRecordWithArray(unsigned Abbrev, const Container &Vals,
const char *ArrayData, unsigned ArrayLen) {
return EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals),
- StringRef(ArrayData, ArrayLen), None);
+ StringRef(ArrayData, ArrayLen),
+ std::nullopt);
}
//===--------------------------------------------------------------------===//
diff --git a/llvm/include/llvm/DWP/DWP.h b/llvm/include/llvm/DWP/DWP.h
index 666b7add60193..f60f8ccfba9fe 100644
--- a/llvm/include/llvm/DWP/DWP.h
+++ b/llvm/include/llvm/DWP/DWP.h
@@ -44,7 +44,7 @@ struct InfoSectionUnitHeader {
// dwo_id field. This resides in the header only if Version >= 5.
// In earlier versions, it is read from DW_AT_GNU_dwo_id.
- Optional<uint64_t> Signature = None;
+ Optional<uint64_t> Signature = std::nullopt;
// Derived from the length of Length field.
dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32;
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h
index 09b08f0ad9a0f..6dc561b5f633f 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h
@@ -44,7 +44,7 @@ class COFFPlatform : public Platform {
JITDylib &PlatformJD, const char *OrcRuntimePath,
LoadDynamicLibrary LoadDynLibrary, bool StaticVCRuntime = false,
const char *VCRuntimePath = nullptr,
- Optional<SymbolAliasMap> RuntimeAliases = None);
+ Optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
ExecutionSession &getExecutionSession() const { return ES; }
ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; }
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
index 3804b6dda91ff..890c9673eeb1e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h
@@ -95,7 +95,7 @@ class ELFNixPlatform : public Platform {
static Expected<std::unique_ptr<ELFNixPlatform>>
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD, const char *OrcRuntimePath,
- Optional<SymbolAliasMap> RuntimeAliases = None);
+ Optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
ExecutionSession &getExecutionSession() const { return ES; }
ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; }
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
index 7aa59d792468f..7ae2d604d340b 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
@@ -58,7 +58,7 @@ class EPCDebugObjectRegistrar : public DebugObjectRegistrar {
/// loaded to find the registration functions.
Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
ExecutionSession &ES,
- Optional<ExecutorAddr> RegistrationFunctionDylib = None);
+ Optional<ExecutorAddr> RegistrationFunctionDylib = std::nullopt);
} // end namespace orc
} // end namespace llvm
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h
index bf4568305f512..648224184a7d0 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h
@@ -34,7 +34,7 @@ class EPCEHFrameRegistrar : public jitlink::EHFrameRegistrar {
/// will be loaded to find the registration functions.
static Expected<std::unique_ptr<EPCEHFrameRegistrar>>
Create(ExecutionSession &ES,
- Optional<ExecutorAddr> RegistrationFunctionsDylib = None);
+ Optional<ExecutorAddr> RegistrationFunctionsDylib = std::nullopt);
/// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl
/// object and registration/deregistration function addresses.
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
index 57ffe250a19df..cf0517b2b1ad6 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h
@@ -80,7 +80,7 @@ class MachOPlatform : public Platform {
static Expected<std::unique_ptr<MachOPlatform>>
Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer,
JITDylib &PlatformJD, const char *OrcRuntimePath,
- Optional<SymbolAliasMap> RuntimeAliases = None);
+ Optional<SymbolAliasMap> RuntimeAliases = std::nullopt);
ExecutionSession &getExecutionSession() const { return ES; }
ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; }
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
index 17bc5747c23ab..fa29aca3e1405 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h
@@ -50,7 +50,7 @@ class ImplSymbolMap {
if (Position != Maps.end())
return Position->getSecond();
else
- return None;
+ return std::nullopt;
}
std::mutex ConcurrentAccess;
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h
index e01bb50d06d6d..cb867986177dd 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h
@@ -30,7 +30,7 @@ namespace orc {
/// many main functions will expect a name argument at least, and will fail
/// if none is provided.
int runAsMain(int (*Main)(int, char *[]), ArrayRef<std::string> Args,
- Optional<StringRef> ProgramName = None);
+ Optional<StringRef> ProgramName = std::nullopt);
int runAsVoidFunction(int (*Func)(void));
int runAsIntFunction(int (*Func)(int), int Arg);
diff --git a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
index 03964af5893f0..a06b7c853dc9a 100644
--- a/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
+++ b/llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
@@ -924,7 +924,7 @@ __OMP_RTL_ATTRS(__kmpc_doacross_fini, BarrierAttrs, AttributeSet(),
__OMP_RTL_ATTRS(__kmpc_alloc_shared, AttributeSet(
EnumAttr(NoUnwind),
EnumAttr(NoSync),
- AllocSizeAttr(0, None)), ReturnPtrAttrs, ParamAttrs())
+ AllocSizeAttr(0, std::nullopt)), ReturnPtrAttrs, ParamAttrs())
__OMP_RTL_ATTRS(__kmpc_free_shared, DeviceAllocAttrs, AttributeSet(),
ParamAttrs(AttributeSet(EnumAttr(NoCapture), EnumAttr(AllocatedPointer))))
diff --git a/llvm/include/llvm/FuzzMutate/OpDescriptor.h b/llvm/include/llvm/FuzzMutate/OpDescriptor.h
index 6ea477a33adef..800586da8f2d1 100644
--- a/llvm/include/llvm/FuzzMutate/OpDescriptor.h
+++ b/llvm/include/llvm/FuzzMutate/OpDescriptor.h
@@ -105,7 +105,7 @@ static inline SourcePred anyType() {
auto Pred = [](ArrayRef<Value *>, const Value *V) {
return !V->getType()->isVoidTy();
};
- auto Make = None;
+ auto Make = std::nullopt;
return {Pred, Make};
}
@@ -113,7 +113,7 @@ static inline SourcePred anyIntType() {
auto Pred = [](ArrayRef<Value *>, const Value *V) {
return V->getType()->isIntegerTy();
};
- auto Make = None;
+ auto Make = std::nullopt;
return {Pred, Make};
}
@@ -121,7 +121,7 @@ static inline SourcePred anyFloatType() {
auto Pred = [](ArrayRef<Value *>, const Value *V) {
return V->getType()->isFloatingPointTy();
};
- auto Make = None;
+ auto Make = std::nullopt;
return {Pred, Make};
}
@@ -175,7 +175,7 @@ static inline SourcePred anyAggregateType() {
};
// TODO: For now we only find aggregates in BaseTypes. It might be better to
// manufacture them out of the base types in some cases.
- auto Find = None;
+ auto Find = std::nullopt;
return {Pred, Find};
}
@@ -186,7 +186,7 @@ static inline SourcePred anyVectorType() {
// TODO: For now we only find vectors in BaseTypes. It might be better to
// manufacture vectors out of the base types, but it's tricky to be sure
// that's actually a reasonable type.
- auto Make = None;
+ auto Make = std::nullopt;
return {Pred, Make};
}
diff --git a/llvm/include/llvm/IRReader/IRReader.h b/llvm/include/llvm/IRReader/IRReader.h
index 3f2a01fdc54a3..13f561d2e9be6 100644
--- a/llvm/include/llvm/IRReader/IRReader.h
+++ b/llvm/include/llvm/IRReader/IRReader.h
@@ -56,7 +56,9 @@ getLazyIRFileModule(StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
std::unique_ptr<Module> parseIR(
MemoryBufferRef Buffer, SMDiagnostic &Err, LLVMContext &Context,
- DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
+ DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
+ return std::nullopt;
+ });
/// If the given file holds a bitcode image, return a Module for it.
/// Otherwise, attempt to parse it as LLVM Assembly and return a Module
@@ -64,7 +66,9 @@ std::unique_ptr<Module> parseIR(
/// \param DataLayoutCallback Override datalayout in the llvm assembly.
std::unique_ptr<Module> parseIRFile(
StringRef Filename, SMDiagnostic &Err, LLVMContext &Context,
- DataLayoutCallbackTy DataLayoutCallback = [](StringRef) { return None; });
+ DataLayoutCallbackTy DataLayoutCallback = [](StringRef) {
+ return std::nullopt;
+ });
}
#endif
diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h
index f3b01782fb8ef..6c0aa74760669 100644
--- a/llvm/include/llvm/LTO/Config.h
+++ b/llvm/include/llvm/LTO/Config.h
@@ -52,7 +52,7 @@ struct Config {
/// For adding passes that run right before codegen.
std::function<void(legacy::PassManager &)> PreCodeGenPassesHook;
Optional<Reloc::Model> RelocModel = Reloc::PIC_;
- Optional<CodeModel::Model> CodeModel = None;
+ Optional<CodeModel::Model> CodeModel = std::nullopt;
CodeGenOpt::Level CGOptLevel = CodeGenOpt::Default;
CodeGenFileType CGFileType = CGFT_ObjectFile;
unsigned OptLevel = 2;
diff --git a/llvm/include/llvm/MC/MCContext.h b/llvm/include/llvm/MC/MCContext.h
index 49cf6262a35f8..415f271ed7957 100644
--- a/llvm/include/llvm/MC/MCContext.h
+++ b/llvm/include/llvm/MC/MCContext.h
@@ -672,11 +672,13 @@ class MCContext {
bool hasXCOFFSection(StringRef Section,
XCOFF::CsectProperties CsectProp) const;
- MCSectionXCOFF *getXCOFFSection(
- StringRef Section, SectionKind K,
- Optional<XCOFF::CsectProperties> CsectProp = None,
- bool MultiSymbolsAllowed = false, const char *BeginSymName = nullptr,
- Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags = None);
+ MCSectionXCOFF *
+ getXCOFFSection(StringRef Section, SectionKind K,
+ Optional<XCOFF::CsectProperties> CsectProp = std::nullopt,
+ bool MultiSymbolsAllowed = false,
+ const char *BeginSymName = nullptr,
+ Optional<XCOFF::DwarfSectionSubtypeFlags> DwarfSubtypeFlags =
+ std::nullopt);
// Create and save a copy of STI and return a reference to the copy.
MCSubtargetInfo &getSubtargetCopy(const MCSubtargetInfo &STI);
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParser.h b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
index 4a1291856a20d..394f925d17e4b 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
@@ -210,25 +210,28 @@ class MCAsmParser {
const MCInstPrinter *IP, MCAsmParserSemaCallback &SI) = 0;
/// Emit a note at the location \p L, with the message \p Msg.
- virtual void Note(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
+ virtual void Note(SMLoc L, const Twine &Msg,
+ SMRange Range = std::nullopt) = 0;
/// Emit a warning at the location \p L, with the message \p Msg.
///
/// \return The return value is true, if warnings are fatal.
- virtual bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
+ virtual bool Warning(SMLoc L, const Twine &Msg,
+ SMRange Range = std::nullopt) = 0;
/// Return an error at the location \p L, with the message \p Msg. This
/// may be modified before being emitted.
///
/// \return The return value is always true, as an idiomatic convenience to
/// clients.
- bool Error(SMLoc L, const Twine &Msg, SMRange Range = None);
+ bool Error(SMLoc L, const Twine &Msg, SMRange Range = std::nullopt);
/// Emit an error at the location \p L, with the message \p Msg.
///
/// \return The return value is always true, as an idiomatic convenience to
/// clients.
- virtual bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) = 0;
+ virtual bool printError(SMLoc L, const Twine &Msg,
+ SMRange Range = std::nullopt) = 0;
bool hasPendingError() { return !PendingErrors.empty(); }
@@ -253,7 +256,7 @@ class MCAsmParser {
const AsmToken &getTok() const;
/// Report an error at the current lexer location.
- bool TokError(const Twine &Msg, SMRange Range = None);
+ bool TokError(const Twine &Msg, SMRange Range = std::nullopt);
bool parseTokenLoc(SMLoc &Loc);
bool parseToken(AsmToken::TokenKind T, const Twine &Msg = "unexpected token");
diff --git a/llvm/include/llvm/MC/MCSectionXCOFF.h b/llvm/include/llvm/MC/MCSectionXCOFF.h
index 95332647c9bea..b6b6dbfaadf46 100644
--- a/llvm/include/llvm/MC/MCSectionXCOFF.h
+++ b/llvm/include/llvm/MC/MCSectionXCOFF.h
@@ -46,7 +46,7 @@ class MCSectionXCOFF final : public MCSection {
bool MultiSymbolsAllowed)
: MCSection(SV_XCOFF, Name, K, Begin),
CsectProp(XCOFF::CsectProperties(SMC, ST)), QualName(QualName),
- SymbolTableName(SymbolTableName), DwarfSubtypeFlags(None),
+ SymbolTableName(SymbolTableName), DwarfSubtypeFlags(std::nullopt),
MultiSymbolsAllowed(MultiSymbolsAllowed) {
assert(
(ST == XCOFF::XTY_SD || ST == XCOFF::XTY_CM || ST == XCOFF::XTY_ER) &&
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index e74cd5d64a0c3..423879ed5a9c6 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -905,11 +905,10 @@ class MCStreamer {
/// Associate a filename with a specified logical file number. This
/// implements the DWARF2 '.file 4 "foo.c"' assembler directive.
- unsigned emitDwarfFileDirective(unsigned FileNo, StringRef Directory,
- StringRef Filename,
- Optional<MD5::MD5Result> Checksum = None,
- Optional<StringRef> Source = None,
- unsigned CUID = 0) {
+ unsigned emitDwarfFileDirective(
+ unsigned FileNo, StringRef Directory, StringRef Filename,
+ Optional<MD5::MD5Result> Checksum = std::nullopt,
+ Optional<StringRef> Source = std::nullopt, unsigned CUID = 0) {
return cantFail(
tryEmitDwarfFileDirective(FileNo, Directory, Filename, Checksum,
Source, CUID));
@@ -922,8 +921,8 @@ class MCStreamer {
/// '.file 4 "dir/foo.c" md5 "..." source "..."' assembler directive.
virtual Expected<unsigned> tryEmitDwarfFileDirective(
unsigned FileNo, StringRef Directory, StringRef Filename,
- Optional<MD5::MD5Result> Checksum = None, Optional<StringRef> Source = None,
- unsigned CUID = 0);
+ Optional<MD5::MD5Result> Checksum = std::nullopt,
+ Optional<StringRef> Source = std::nullopt, unsigned CUID = 0);
/// Specify the "root" file of the compilation, using the ".file 0" extension.
virtual void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
@@ -1089,7 +1088,7 @@ class MCStreamer {
virtual Optional<std::pair<bool, std::string>>
emitRelocDirective(const MCExpr &Offset, StringRef Name, const MCExpr *Expr,
SMLoc Loc, const MCSubtargetInfo &STI) {
- return None;
+ return std::nullopt;
}
virtual void emitAddrsig() {}
diff --git a/llvm/include/llvm/MC/TargetRegistry.h b/llvm/include/llvm/MC/TargetRegistry.h
index 1a7b5d2a92c41..46f4a9a4e7cab 100644
--- a/llvm/include/llvm/MC/TargetRegistry.h
+++ b/llvm/include/llvm/MC/TargetRegistry.h
@@ -478,13 +478,12 @@ class Target {
/// feature set; it should always be provided. Generally this should be
/// either the target triple from the module, or the target triple of the
/// host if that does not exist.
- TargetMachine *createTargetMachine(StringRef TT, StringRef CPU,
- StringRef Features,
- const TargetOptions &Options,
- Optional<Reloc::Model> RM,
- Optional<CodeModel::Model> CM = None,
- CodeGenOpt::Level OL = CodeGenOpt::Default,
- bool JIT = false) const {
+ TargetMachine *
+ createTargetMachine(StringRef TT, StringRef CPU, StringRef Features,
+ const TargetOptions &Options, Optional<Reloc::Model> RM,
+ Optional<CodeModel::Model> CM = std::nullopt,
+ CodeGenOpt::Level OL = CodeGenOpt::Default,
+ bool JIT = false) const {
if (!TargetMachineCtorFn)
return nullptr;
return TargetMachineCtorFn(*this, Triple(TT), CPU, Features, Options, RM,
diff --git a/llvm/include/llvm/ObjCopy/CommonConfig.h b/llvm/include/llvm/ObjCopy/CommonConfig.h
index 4921f5281ca63..81009d0c2b5ff 100644
--- a/llvm/include/llvm/ObjCopy/CommonConfig.h
+++ b/llvm/include/llvm/ObjCopy/CommonConfig.h
@@ -118,7 +118,7 @@ class NameOrPattern {
Optional<StringRef> getName() const {
if (!R && !G)
return Name;
- return None;
+ return std::nullopt;
}
bool operator==(StringRef S) const {
return R ? R->match(S) : G ? G->match(S) : Name == S;
diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h
index 8b8a574be0907..398d9b8fc942d 100644
--- a/llvm/include/llvm/Object/ELF.h
+++ b/llvm/include/llvm/Object/ELF.h
@@ -120,7 +120,7 @@ template <class T> struct DataRegion {
}
const T *First;
- Optional<uint64_t> Size = None;
+ Optional<uint64_t> Size = std::nullopt;
const uint8_t *BufEnd = nullptr;
};
diff --git a/llvm/include/llvm/Object/ELFObjectFile.h b/llvm/include/llvm/Object/ELFObjectFile.h
index 0ea4f89efefb6..0363922eb66f1 100644
--- a/llvm/include/llvm/Object/ELFObjectFile.h
+++ b/llvm/include/llvm/Object/ELFObjectFile.h
@@ -108,7 +108,7 @@ class ELFObjectFileBase : public ObjectFile {
// `TextSectionIndex` is specified, only returns the BB address maps
// corresponding to the section with that index.
Expected<std::vector<BBAddrMap>>
- readBBAddrMap(Optional<unsigned> TextSectionIndex = None) const;
+ readBBAddrMap(Optional<unsigned> TextSectionIndex = std::nullopt) const;
};
class ELFSectionRef : public SectionRef {
diff --git a/llvm/include/llvm/Object/ObjectFile.h b/llvm/include/llvm/Object/ObjectFile.h
index 7d81bc8c1056a..4ffdddfa5eb24 100644
--- a/llvm/include/llvm/Object/ObjectFile.h
+++ b/llvm/include/llvm/Object/ObjectFile.h
@@ -337,7 +337,7 @@ class ObjectFile : public SymbolicFile {
virtual StringRef getFileFormatName() const = 0;
virtual Triple::ArchType getArch() const = 0;
virtual SubtargetFeatures getFeatures() const = 0;
- virtual Optional<StringRef> tryGetCPUName() const { return None; };
+ virtual Optional<StringRef> tryGetCPUName() const { return std::nullopt; };
virtual void setARMSubArch(Triple &TheTriple) const { }
virtual Expected<uint64_t> getStartAddress() const {
return errorCodeToError(object_error::parse_failed);
diff --git a/llvm/include/llvm/Passes/PassBuilder.h b/llvm/include/llvm/Passes/PassBuilder.h
index d7d76c30d1a6b..d7a0e7726cc30 100644
--- a/llvm/include/llvm/Passes/PassBuilder.h
+++ b/llvm/include/llvm/Passes/PassBuilder.h
@@ -116,7 +116,7 @@ class PassBuilder {
explicit PassBuilder(TargetMachine *TM = nullptr,
PipelineTuningOptions PTO = PipelineTuningOptions(),
- Optional<PGOOptions> PGOOpt = None,
+ Optional<PGOOptions> PGOOpt = std::nullopt,
PassInstrumentationCallbacks *PIC = nullptr);
/// Cross register the analysis managers through their proxies.
diff --git a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
index e35751512245d..7d82f3eb93eec 100644
--- a/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
+++ b/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
@@ -323,7 +323,7 @@ class CounterMappingContext {
public:
CounterMappingContext(ArrayRef<CounterExpression> Expressions,
- ArrayRef<uint64_t> CounterValues = None)
+ ArrayRef<uint64_t> CounterValues = std::nullopt)
: Expressions(Expressions), CounterValues(CounterValues) {}
void setCounts(ArrayRef<uint64_t> Counts) { CounterValues = Counts; }
@@ -605,7 +605,8 @@ class CoverageMapping {
/// Ignores non-instrumented object files unless all are not instrumented.
static Expected<std::unique_ptr<CoverageMapping>>
load(ArrayRef<StringRef> ObjectFilenames, StringRef ProfileFilename,
- ArrayRef<StringRef> Arches = None, StringRef CompilationDir = "");
+ ArrayRef<StringRef> Arches = std::nullopt,
+ StringRef CompilationDir = "");
/// The number of functions that couldn't have their profiles mapped.
///
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index 0f72833c7ef76..0d788a40f5339 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -868,7 +868,7 @@ struct InstrProfRecord {
ArrayRef<InstrProfValueSiteRecord>
getValueSitesForKind(uint32_t ValueKind) const {
if (!ValueData)
- return None;
+ return std::nullopt;
switch (ValueKind) {
case IPVK_IndirectCallTarget:
return ValueData->IndirectCallSites;
diff --git a/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h b/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
index 19080c0132e33..a997fba481fd0 100644
--- a/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
+++ b/llvm/include/llvm/Remarks/BitstreamRemarkSerializer.h
@@ -106,8 +106,8 @@ struct BitstreamRemarkSerializerHelper {
/// Emit the metadata for the remarks.
void emitMetaBlock(uint64_t ContainerVersion,
Optional<uint64_t> RemarkVersion,
- Optional<const StringTable *> StrTab = None,
- Optional<StringRef> Filename = None);
+ Optional<const StringTable *> StrTab = std::nullopt,
+ Optional<StringRef> Filename = std::nullopt);
/// Emit a remark block. The string table is required.
void emitRemarkBlock(const Remark &Remark, StringTable &StrTab);
@@ -148,7 +148,7 @@ struct BitstreamRemarkSerializer : public RemarkSerializer {
/// metadata serializer will change.
std::unique_ptr<MetaSerializer>
metaSerializer(raw_ostream &OS,
- Optional<StringRef> ExternalFilename = None) override;
+ Optional<StringRef> ExternalFilename = std::nullopt) override;
static bool classof(const RemarkSerializer *S) {
return S->SerializerFormat == Format::Bitstream;
@@ -172,10 +172,10 @@ struct BitstreamMetaSerializer : public MetaSerializer {
/// Create a new meta serializer based on \p ContainerType.
BitstreamMetaSerializer(raw_ostream &OS,
BitstreamRemarkContainerType ContainerType,
- Optional<const StringTable *> StrTab = None,
- Optional<StringRef> ExternalFilename = None)
- : MetaSerializer(OS), TmpHelper(None), Helper(nullptr), StrTab(StrTab),
- ExternalFilename(ExternalFilename) {
+ Optional<const StringTable *> StrTab = std::nullopt,
+ Optional<StringRef> ExternalFilename = std::nullopt)
+ : MetaSerializer(OS), TmpHelper(std::nullopt), Helper(nullptr),
+ StrTab(StrTab), ExternalFilename(ExternalFilename) {
TmpHelper.emplace(ContainerType);
Helper = &*TmpHelper;
}
@@ -183,10 +183,10 @@ struct BitstreamMetaSerializer : public MetaSerializer {
/// Create a new meta serializer based on a previously built \p Helper.
BitstreamMetaSerializer(raw_ostream &OS,
BitstreamRemarkSerializerHelper &Helper,
- Optional<const StringTable *> StrTab = None,
- Optional<StringRef> ExternalFilename = None)
- : MetaSerializer(OS), TmpHelper(None), Helper(&Helper), StrTab(StrTab),
- ExternalFilename(ExternalFilename) {}
+ Optional<const StringTable *> StrTab = std::nullopt,
+ Optional<StringRef> ExternalFilename = std::nullopt)
+ : MetaSerializer(OS), TmpHelper(std::nullopt), Helper(&Helper),
+ StrTab(StrTab), ExternalFilename(ExternalFilename) {}
void emit() override;
};
diff --git a/llvm/include/llvm/Remarks/HotnessThresholdParser.h b/llvm/include/llvm/Remarks/HotnessThresholdParser.h
index 08bbf5f70b816..14e70809092cc 100644
--- a/llvm/include/llvm/Remarks/HotnessThresholdParser.h
+++ b/llvm/include/llvm/Remarks/HotnessThresholdParser.h
@@ -30,7 +30,7 @@ namespace remarks {
// be filled later during PSI.
inline Expected<Optional<uint64_t>> parseHotnessThresholdOption(StringRef Arg) {
if (Arg == "auto")
- return None;
+ return std::nullopt;
int64_t Val;
if (Arg.getAsInteger(10, Val))
diff --git a/llvm/include/llvm/Remarks/RemarkLinker.h b/llvm/include/llvm/Remarks/RemarkLinker.h
index 79d74e39deeee..f5d8d9ba3f5b1 100644
--- a/llvm/include/llvm/Remarks/RemarkLinker.h
+++ b/llvm/include/llvm/Remarks/RemarkLinker.h
@@ -65,12 +65,12 @@ struct RemarkLinker {
/// \p Buffer.
/// \p Buffer can be either a standalone remark container or just
/// metadata. This takes care of uniquing and merging the remarks.
- Error link(StringRef Buffer, Optional<Format> RemarkFormat = None);
+ Error link(StringRef Buffer, Optional<Format> RemarkFormat = std::nullopt);
/// Link the remarks found in \p Obj by looking for the right section and
/// calling the method above.
Error link(const object::ObjectFile &Obj,
- Optional<Format> RemarkFormat = None);
+ Optional<Format> RemarkFormat = std::nullopt);
/// Serialize the linked remarks to the stream \p OS, using the format \p
/// RemarkFormat.
diff --git a/llvm/include/llvm/Remarks/RemarkParser.h b/llvm/include/llvm/Remarks/RemarkParser.h
index 61dfdbf3c17c0..f131857e1fc91 100644
--- a/llvm/include/llvm/Remarks/RemarkParser.h
+++ b/llvm/include/llvm/Remarks/RemarkParser.h
@@ -82,10 +82,10 @@ Expected<std::unique_ptr<RemarkParser>>
createRemarkParser(Format ParserFormat, StringRef Buf,
ParsedStringTable StrTab);
-Expected<std::unique_ptr<RemarkParser>>
-createRemarkParserFromMeta(Format ParserFormat, StringRef Buf,
- Optional<ParsedStringTable> StrTab = None,
- Optional<StringRef> ExternalFilePrependPath = None);
+Expected<std::unique_ptr<RemarkParser>> createRemarkParserFromMeta(
+ Format ParserFormat, StringRef Buf,
+ Optional<ParsedStringTable> StrTab = std::nullopt,
+ Optional<StringRef> ExternalFilePrependPath = std::nullopt);
} // end namespace remarks
} // end namespace llvm
diff --git a/llvm/include/llvm/Remarks/RemarkSerializer.h b/llvm/include/llvm/Remarks/RemarkSerializer.h
index b971173ad2c6e..1ca45300b4eed 100644
--- a/llvm/include/llvm/Remarks/RemarkSerializer.h
+++ b/llvm/include/llvm/Remarks/RemarkSerializer.h
@@ -60,7 +60,7 @@ struct RemarkSerializer {
/// Return the corresponding metadata serializer.
virtual std::unique_ptr<MetaSerializer>
metaSerializer(raw_ostream &OS,
- Optional<StringRef> ExternalFilename = None) = 0;
+ Optional<StringRef> ExternalFilename = std::nullopt) = 0;
};
/// This is the base class for a remark metadata serializer.
diff --git a/llvm/include/llvm/Remarks/RemarkStreamer.h b/llvm/include/llvm/Remarks/RemarkStreamer.h
index b25cb0c331a42..c86394fcbeb0c 100644
--- a/llvm/include/llvm/Remarks/RemarkStreamer.h
+++ b/llvm/include/llvm/Remarks/RemarkStreamer.h
@@ -51,11 +51,11 @@ class RemarkStreamer final {
public:
RemarkStreamer(std::unique_ptr<remarks::RemarkSerializer> RemarkSerializer,
- Optional<StringRef> Filename = None);
+ Optional<StringRef> Filename = std::nullopt);
/// Return the filename that the remark diagnostics are emitted to.
Optional<StringRef> getFilename() const {
- return Filename ? Optional<StringRef>(*Filename) : None;
+ return Filename ? Optional<StringRef>(*Filename) : std::nullopt;
}
/// Return stream that the remark diagnostics are emitted to.
raw_ostream &getStream() { return RemarkSerializer->OS; }
diff --git a/llvm/include/llvm/Remarks/YAMLRemarkSerializer.h b/llvm/include/llvm/Remarks/YAMLRemarkSerializer.h
index 4dfe1841b51d0..14e14a7ec6328 100644
--- a/llvm/include/llvm/Remarks/YAMLRemarkSerializer.h
+++ b/llvm/include/llvm/Remarks/YAMLRemarkSerializer.h
@@ -35,12 +35,12 @@ struct YAMLRemarkSerializer : public RemarkSerializer {
yaml::Output YAMLOutput;
YAMLRemarkSerializer(raw_ostream &OS, SerializerMode Mode,
- Optional<StringTable> StrTab = None);
+ Optional<StringTable> StrTab = std::nullopt);
void emit(const Remark &Remark) override;
std::unique_ptr<MetaSerializer>
metaSerializer(raw_ostream &OS,
- Optional<StringRef> ExternalFilename = None) override;
+ Optional<StringRef> ExternalFilename = std::nullopt) override;
static bool classof(const RemarkSerializer *S) {
return S->SerializerFormat == Format::YAML;
@@ -49,7 +49,7 @@ struct YAMLRemarkSerializer : public RemarkSerializer {
protected:
YAMLRemarkSerializer(Format SerializerFormat, raw_ostream &OS,
SerializerMode Mode,
- Optional<StringTable> StrTab = None);
+ Optional<StringTable> StrTab = std::nullopt);
};
struct YAMLMetaSerializer : public MetaSerializer {
@@ -83,7 +83,7 @@ struct YAMLStrTabRemarkSerializer : public YAMLRemarkSerializer {
std::unique_ptr<MetaSerializer>
metaSerializer(raw_ostream &OS,
- Optional<StringRef> ExternalFilename = None) override;
+ Optional<StringRef> ExternalFilename = std::nullopt) override;
static bool classof(const RemarkSerializer *S) {
return S->SerializerFormat == Format::YAMLStrTab;
diff --git a/llvm/include/llvm/Target/CodeGenCWrappers.h b/llvm/include/llvm/Target/CodeGenCWrappers.h
index 6f589b80c9b2b..792cef2fef3ed 100644
--- a/llvm/include/llvm/Target/CodeGenCWrappers.h
+++ b/llvm/include/llvm/Target/CodeGenCWrappers.h
@@ -29,7 +29,7 @@ inline Optional<CodeModel::Model> unwrap(LLVMCodeModel Model, bool &JIT) {
JIT = true;
[[fallthrough]];
case LLVMCodeModelDefault:
- return None;
+ return std::nullopt;
case LLVMCodeModelTiny:
return CodeModel::Tiny;
case LLVMCodeModelSmall:
diff --git a/llvm/include/llvm/Target/TargetMachine.h b/llvm/include/llvm/Target/TargetMachine.h
index e15d2b9544acc..440205d1bae4d 100644
--- a/llvm/include/llvm/Target/TargetMachine.h
+++ b/llvm/include/llvm/Target/TargetMachine.h
@@ -110,7 +110,7 @@ class TargetMachine {
unsigned O0WantsFastISel : 1;
// PGO related tunables.
- Optional<PGOOptions> PGOOption = None;
+ Optional<PGOOptions> PGOOption = std::nullopt;
public:
const TargetOptions DefaultOptions;
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 70f1ccb37ca75..0ac42a4976baa 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -783,7 +783,7 @@ bool LLParser::parseMDNodeID(MDNode *&Result) {
// Otherwise, create MDNode forward reference.
auto &FwdRef = ForwardRefMDNodes[MID];
- FwdRef = std::make_pair(MDTuple::getTemporary(Context, None), IDLoc);
+ FwdRef = std::make_pair(MDTuple::getTemporary(Context, std::nullopt), IDLoc);
Result = FwdRef.first.get();
NumberedMetadata[MID].reset(Result);
@@ -2132,7 +2132,7 @@ bool LLParser::parseOptionalFunctionMetadata(Function &F) {
/// ::= /* empty */
/// ::= 'align' 4
bool LLParser::parseOptionalAlignment(MaybeAlign &Alignment, bool AllowParens) {
- Alignment = None;
+ Alignment = std::nullopt;
if (!EatIfPresent(lltok::kw_align))
return false;
LocTy AlignLoc = Lex.getLoc();
@@ -2244,7 +2244,7 @@ static Optional<MemoryEffects::Location> keywordToLoc(lltok::Kind Tok) {
case lltok::kw_inaccessiblemem:
return MemoryEffects::InaccessibleMem;
default:
- return None;
+ return std::nullopt;
}
}
@@ -2259,7 +2259,7 @@ static Optional<ModRefInfo> keywordToModRef(lltok::Kind Tok) {
case lltok::kw_readwrite:
return ModRefInfo::ModRef;
default:
- return None;
+ return std::nullopt;
}
}
@@ -2274,7 +2274,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
Lex.Lex();
if (!EatIfPresent(lltok::lparen)) {
tokError("expected '('");
- return None;
+ return std::nullopt;
}
bool SeenLoc = false;
@@ -2284,7 +2284,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
Lex.Lex();
if (!EatIfPresent(lltok::colon)) {
tokError("expected ':' after location");
- return None;
+ return std::nullopt;
}
}
@@ -2295,7 +2295,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
"or access kind (none, read, write, readwrite)");
else
tokError("expected access kind (none, read, write, readwrite)");
- return None;
+ return std::nullopt;
}
Lex.Lex();
@@ -2305,7 +2305,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
} else {
if (SeenLoc) {
tokError("default access kind must be specified first");
- return None;
+ return std::nullopt;
}
ME = MemoryEffects(*MR);
}
@@ -2315,7 +2315,7 @@ Optional<MemoryEffects> LLParser::parseMemoryAttr() {
} while (EatIfPresent(lltok::comma));
tokError("unterminated memory attribute");
- return None;
+ return std::nullopt;
}
/// parseOptionalCommaAlign
@@ -2392,7 +2392,7 @@ bool LLParser::parseAllocSizeArguments(unsigned &BaseSizeArg,
"'allocsize' indices can't refer to the same parameter");
HowManyArg = HowMany;
} else
- HowManyArg = None;
+ HowManyArg = std::nullopt;
auto EndParen = Lex.getLoc();
if (!EatIfPresent(lltok::rparen))
diff --git a/llvm/lib/AsmParser/Parser.cpp b/llvm/lib/AsmParser/Parser.cpp
index 4458ae757c160..5df7789955dc2 100644
--- a/llvm/lib/AsmParser/Parser.cpp
+++ b/llvm/lib/AsmParser/Parser.cpp
@@ -93,7 +93,7 @@ ParsedModuleAndIndex llvm::parseAssemblyWithIndex(MemoryBufferRef F,
SlotMapping *Slots) {
return ::parseAssemblyWithIndex(F, Err, Context, Slots,
/*UpgradeDebugInfo*/ true,
- [](StringRef) { return None; });
+ [](StringRef) { return std::nullopt; });
}
static ParsedModuleAndIndex
@@ -150,7 +150,7 @@ static bool parseSummaryIndexAssemblyInto(MemoryBufferRef F,
// index, but we need to initialize it.
LLVMContext unusedContext;
return LLParser(F.getBuffer(), SM, Err, nullptr, &Index, unusedContext)
- .Run(true, [](StringRef) { return None; });
+ .Run(true, [](StringRef) { return std::nullopt; });
}
std::unique_ptr<ModuleSummaryIndex>
diff --git a/llvm/lib/BinaryFormat/Dwarf.cpp b/llvm/lib/BinaryFormat/Dwarf.cpp
index c88425711656b..f6ea91a7b5917 100644
--- a/llvm/lib/BinaryFormat/Dwarf.cpp
+++ b/llvm/lib/BinaryFormat/Dwarf.cpp
@@ -368,7 +368,7 @@ unsigned llvm::dwarf::LanguageVendor(dwarf::SourceLanguage Lang) {
Optional<unsigned> llvm::dwarf::LanguageLowerBound(dwarf::SourceLanguage Lang) {
switch (Lang) {
default:
- return None;
+ return std::nullopt;
#define HANDLE_DW_LANG(ID, NAME, LOWER_BOUND, VERSION, VENDOR) \
case DW_LANG_##NAME: \
return LOWER_BOUND;
@@ -697,7 +697,7 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
case DW_FORM_addr:
if (Params)
return Params.AddrSize;
- return None;
+ return std::nullopt;
case DW_FORM_block: // ULEB128 length L followed by L bytes.
case DW_FORM_block1: // 1 byte length L followed by L bytes.
@@ -715,12 +715,12 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
case DW_FORM_rnglistx: // ULEB128.
case DW_FORM_GNU_addr_index: // ULEB128.
case DW_FORM_GNU_str_index: // ULEB128.
- return None;
+ return std::nullopt;
case DW_FORM_ref_addr:
if (Params)
return Params.getRefAddrByteSize();
- return None;
+ return std::nullopt;
case DW_FORM_flag:
case DW_FORM_data1:
@@ -753,7 +753,7 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
case DW_FORM_strp_sup:
if (Params)
return Params.getDwarfOffsetByteSize();
- return None;
+ return std::nullopt;
case DW_FORM_data8:
case DW_FORM_ref8:
@@ -775,7 +775,7 @@ Optional<uint8_t> llvm::dwarf::getFixedFormByteSize(dwarf::Form Form,
default:
break;
}
- return None;
+ return std::nullopt;
}
bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
diff --git a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
index c297e16bdfdf7..a3e37c6dbfce5 100644
--- a/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
+++ b/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
@@ -438,7 +438,7 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
switch (Entry.Kind) {
case llvm::BitstreamEntry::SubBlock: // Handled for us already.
case llvm::BitstreamEntry::Error:
- return None;
+ return std::nullopt;
case llvm::BitstreamEntry::EndBlock:
return std::move(NewBlockInfo);
case llvm::BitstreamEntry::Record:
@@ -448,7 +448,8 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
// Read abbrev records, associate them with CurBID.
if (Entry.ID == bitc::DEFINE_ABBREV) {
- if (!CurBlockInfo) return None;
+ if (!CurBlockInfo)
+ return std::nullopt;
if (Error Err = ReadAbbrevRecord())
return std::move(Err);
@@ -469,24 +470,25 @@ BitstreamCursor::ReadBlockInfoBlock(bool ReadBlockInfoNames) {
break; // Default behavior, ignore unknown content.
case bitc::BLOCKINFO_CODE_SETBID:
if (Record.size() < 1)
- return None;
+ return std::nullopt;
CurBlockInfo = &NewBlockInfo.getOrCreateBlockInfo((unsigned)Record[0]);
break;
case bitc::BLOCKINFO_CODE_BLOCKNAME: {
if (!CurBlockInfo)
- return None;
+ return std::nullopt;
if (!ReadBlockInfoNames)
break; // Ignore name.
CurBlockInfo->Name = std::string(Record.begin(), Record.end());
break;
}
case bitc::BLOCKINFO_CODE_SETRECORDNAME: {
- if (!CurBlockInfo) return None;
- if (!ReadBlockInfoNames)
- break; // Ignore name.
- CurBlockInfo->RecordNames.emplace_back(
- (unsigned)Record[0], std::string(Record.begin() + 1, Record.end()));
- break;
+ if (!CurBlockInfo)
+ return std::nullopt;
+ if (!ReadBlockInfoNames)
+ break; // Ignore name.
+ CurBlockInfo->RecordNames.emplace_back(
+ (unsigned)Record[0], std::string(Record.begin() + 1, Record.end()));
+ break;
}
}
}
diff --git a/llvm/lib/DWARFLinker/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
index a00e51fcf135f..594d7afe3fe75 100644
--- a/llvm/lib/DWARFLinker/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
@@ -96,7 +96,7 @@ bool DwarfStreamer::init(Triple TheTriple,
// Finally create the AsmPrinter we'll use to emit the DIEs.
TM.reset(TheTarget->createTargetMachine(TripleName, "", "", TargetOptions(),
- None));
+ std::nullopt));
if (!TM)
return error("no target machine for target " + TripleName, Context), false;
diff --git a/llvm/lib/Debuginfod/BuildIDFetcher.cpp b/llvm/lib/Debuginfod/BuildIDFetcher.cpp
index 3b74877500b85..b7b1754611c31 100644
--- a/llvm/lib/Debuginfod/BuildIDFetcher.cpp
+++ b/llvm/lib/Debuginfod/BuildIDFetcher.cpp
@@ -27,5 +27,5 @@ DebuginfodFetcher::fetch(ArrayRef<uint8_t> BuildID) const {
if (PathOrErr)
return *PathOrErr;
consumeError(PathOrErr.takeError());
- return None;
+ return std::nullopt;
}
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp b/llvm/lib/Debuginfod/Debuginfod.cpp
index 990bc4e32425a..f90c59d7f78a9 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -434,7 +434,7 @@ DebuginfodCollection::getBinaryPath(BuildIDRef ID) {
std::string Path = Loc->getValue();
return Path;
}
- return None;
+ return std::nullopt;
}
Expected<Optional<std::string>>
@@ -446,7 +446,7 @@ DebuginfodCollection::getDebugBinaryPath(BuildIDRef ID) {
std::string Path = Loc->getValue();
return Path;
}
- return None;
+ return std::nullopt;
}
Expected<std::string> DebuginfodCollection::findBinaryPath(BuildIDRef ID) {
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
index a14bd4d2c3fd3..a2b71d9502259 100644
--- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
+++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp
@@ -395,7 +395,7 @@ void ExecutionEngine::runStaticConstructorsDestructors(Module &module,
// Execute the ctor/dtor function!
if (Function *F = dyn_cast<Function>(FP))
- runFunction(F, None);
+ runFunction(F, std::nullopt);
// FIXME: It is marginally lame that we just do nothing here if we see an
// entry we don't recognize. It might not be unreasonable for the verifier
diff --git a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
index 5727f7adb49c3..d4235cfa2ccf5 100644
--- a/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
+++ b/llvm/lib/ExecutionEngine/Interpreter/Interpreter.cpp
@@ -69,7 +69,7 @@ Interpreter::~Interpreter() {
void Interpreter::runAtExitHandlers () {
while (!AtExitHandlers.empty()) {
- callFunction(AtExitHandlers.back(), None);
+ callFunction(AtExitHandlers.back(), std::nullopt);
AtExitHandlers.pop_back();
run();
}
diff --git a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
index a5bbe4625b50e..782928c260842 100644
--- a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.cpp
@@ -613,7 +613,7 @@ COFFLinkGraphBuilder::exportCOMDATSymbol(COFFSymbolIndex SymIndex,
setGraphSymbol(Symbol.getSectionNumber(), PendingComdatExport->SymbolIndex,
*GSym);
DefinedSymbols[SymbolName] = GSym;
- PendingComdatExport = None;
+ PendingComdatExport = std::nullopt;
return GSym;
}
diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
index 24cc91b065c56..bd5b4d585550c 100644
--- a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp
@@ -195,7 +195,7 @@ Block &LinkGraph::splitBlock(Block &B, size_t SplitIndex,
SplitBlockCache LocalBlockSymbolsCache;
if (!Cache)
Cache = &LocalBlockSymbolsCache;
- if (*Cache == None) {
+ if (*Cache == std::nullopt) {
*Cache = SplitBlockCache::value_type();
for (auto *Sym : B.getSection().symbols())
if (&Sym->getBlock() == &B)
diff --git a/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp b/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp
index 3c355cc223f90..4c8ed81a7f1ea 100644
--- a/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/COFFVCRuntimeSupport.cpp
@@ -157,8 +157,8 @@ COFFVCRuntimeBootstrapper::getMSVCToolchainPath() {
std::string VCToolChainPath;
ToolsetLayout VSLayout;
IntrusiveRefCntPtr<vfs::FileSystem> VFS = vfs::getRealFileSystem();
- if (!findVCToolChainViaCommandLine(*VFS, None, None, None, VCToolChainPath,
- VSLayout) &&
+ if (!findVCToolChainViaCommandLine(*VFS, std::nullopt, std::nullopt,
+ std::nullopt, VCToolChainPath, VSLayout) &&
!findVCToolChainViaEnvironment(*VFS, VCToolChainPath, VSLayout) &&
!findVCToolChainViaSetupConfig(*VFS, VCToolChainPath, VSLayout) &&
!findVCToolChainViaRegistry(VCToolChainPath, VSLayout))
@@ -167,8 +167,8 @@ COFFVCRuntimeBootstrapper::getMSVCToolchainPath() {
std::string UniversalCRTSdkPath;
std::string UCRTVersion;
- if (!getUniversalCRTSdkDir(*VFS, None, None, None, UniversalCRTSdkPath,
- UCRTVersion))
+ if (!getUniversalCRTSdkDir(*VFS, std::nullopt, std::nullopt, std::nullopt,
+ UniversalCRTSdkPath, UCRTVersion))
return make_error<StringError>("Couldn't find universal sdk.",
inconvertibleErrorCode());
diff --git a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
index d2d73b0fa9981..9386a03795041 100644
--- a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
@@ -109,7 +109,7 @@ CompileOnDemandLayer::compileRequested(GlobalValueSet Requested) {
Optional<CompileOnDemandLayer::GlobalValueSet>
CompileOnDemandLayer::compileWholeModule(GlobalValueSet Requested) {
- return None;
+ return std::nullopt;
}
CompileOnDemandLayer::CompileOnDemandLayer(
@@ -287,7 +287,7 @@ void CompileOnDemandLayer::emitPartition(
// Take a 'None' partition to mean the whole module (as opposed to an empty
// partition, which means "materialize nothing"). Emit the whole module
// unmodified to the base layer.
- if (GVsToExtract == None) {
+ if (GVsToExtract == std::nullopt) {
Defs.clear();
BaseLayer.emit(std::move(R), std::move(TSM));
return;
diff --git a/llvm/lib/ExecutionEngine/Orc/ObjectFileInterface.cpp b/llvm/lib/ExecutionEngine/Orc/ObjectFileInterface.cpp
index f3f0b7db03c71..33c5d046696af 100644
--- a/llvm/lib/ExecutionEngine/Orc/ObjectFileInterface.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/ObjectFileInterface.cpp
@@ -179,7 +179,7 @@ getCOFFObjectFileSymbolInfo(ExecutionSession &ES,
if (Def->Selection != COFF::IMAGE_COMDAT_SELECT_NODUPLICATES) {
IsWeak = true;
}
- ComdatDefs[COFFSym.getSectionNumber()] = None;
+ ComdatDefs[COFFSym.getSectionNumber()] = std::nullopt;
} else {
// Skip symbols not defined in this object file.
if (*SymFlagsOrErr & object::BasicSymbolRef::SF_Undefined)
diff --git a/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp b/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp
index 80145b176c0e3..0076267f933e7 100644
--- a/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp
@@ -97,7 +97,7 @@ BlockFreqQuery::ResultTy BlockFreqQuery::operator()(Function &F) {
auto IBBs = findBBwithCalls(F);
if (IBBs.empty())
- return None;
+ return std::nullopt;
auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(F);
@@ -288,7 +288,7 @@ SpeculateQuery::ResultTy SequenceBBQuery::operator()(Function &F) {
CallerBlocks = findBBwithCalls(F);
if (CallerBlocks.empty())
- return None;
+ return std::nullopt;
if (isStraightLine(F))
SequencedBlocks = rearrangeBB(F, CallerBlocks);
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp
index 5d4cfceefb3ea..f428e3f448ac1 100644
--- a/llvm/lib/FileCheck/FileCheck.cpp
+++ b/llvm/lib/FileCheck/FileCheck.cpp
@@ -702,7 +702,7 @@ Pattern::parseCallExpr(StringRef &Expr, StringRef FuncName,
.Case("min", min)
.Case("mul", operator*)
.Case("sub", operator-)
- .Default(None);
+ .Default(std::nullopt);
if (!OptFunc)
return ErrorDiagnostic::get(
@@ -770,7 +770,7 @@ Expected<std::unique_ptr<Expression>> Pattern::parseNumericSubstitutionBlock(
FileCheckPatternContext *Context, const SourceMgr &SM) {
std::unique_ptr<ExpressionAST> ExpressionASTPointer = nullptr;
StringRef DefExpr = StringRef();
- DefinedNumericVariable = None;
+ DefinedNumericVariable = std::nullopt;
ExpressionFormat ExplicitFormat = ExpressionFormat();
unsigned Precision = 0;
@@ -2703,8 +2703,9 @@ Error FileCheckPatternContext::defineCmdlineVariables(
StringRef CmdlineDefExpr = CmdlineDef.substr(1);
Optional<NumericVariable *> DefinedNumericVariable;
Expected<std::unique_ptr<Expression>> ExpressionResult =
- Pattern::parseNumericSubstitutionBlock(
- CmdlineDefExpr, DefinedNumericVariable, false, None, this, SM);
+ Pattern::parseNumericSubstitutionBlock(CmdlineDefExpr,
+ DefinedNumericVariable, false,
+ std::nullopt, this, SM);
if (!ExpressionResult) {
Errs = joinErrors(std::move(Errs), ExpressionResult.takeError());
continue;
diff --git a/llvm/lib/FileCheck/FileCheckImpl.h b/llvm/lib/FileCheck/FileCheckImpl.h
index 29e721e088d2c..ccfcda60b1c32 100644
--- a/llvm/lib/FileCheck/FileCheckImpl.h
+++ b/llvm/lib/FileCheck/FileCheckImpl.h
@@ -282,7 +282,7 @@ class NumericVariable {
/// defined at line \p DefLineNumber or defined before input is parsed if
/// \p DefLineNumber is None.
explicit NumericVariable(StringRef Name, ExpressionFormat ImplicitFormat,
- Optional<size_t> DefLineNumber = None)
+ Optional<size_t> DefLineNumber = std::nullopt)
: Name(Name), ImplicitFormat(ImplicitFormat),
DefLineNumber(DefLineNumber) {}
@@ -306,7 +306,7 @@ class NumericVariable {
/// buffer string from which it was parsed to \p NewStrValue. See comments on
/// getStringValue for a discussion of when the latter can be None.
void setValue(ExpressionValue NewValue,
- Optional<StringRef> NewStrValue = None) {
+ Optional<StringRef> NewStrValue = std::nullopt) {
Value = NewValue;
StrValue = NewStrValue;
}
@@ -314,8 +314,8 @@ class NumericVariable {
/// Clears value of this numeric variable, regardless of whether it is
/// currently defined or not.
void clearValue() {
- Value = None;
- StrValue = None;
+ Value = std::nullopt;
+ StrValue = std::nullopt;
}
/// \returns the line number where this variable is defined, if any, or None
@@ -555,7 +555,7 @@ class ErrorDiagnostic : public ErrorInfo<ErrorDiagnostic> {
SMRange getRange() const { return Range; }
static Error get(const SourceMgr &SM, SMLoc Loc, const Twine &ErrMsg,
- SMRange Range = None) {
+ SMRange Range = std::nullopt) {
return make_error<ErrorDiagnostic>(
SM.GetMessage(Loc, SourceMgr::DK_Error, ErrMsg), Range);
}
@@ -682,7 +682,7 @@ class Pattern {
public:
Pattern(Check::FileCheckType Ty, FileCheckPatternContext *Context,
- Optional<size_t> Line = None)
+ Optional<size_t> Line = std::nullopt)
: Context(Context), CheckTy(Ty), LineNumber(Line) {}
/// \returns the location in source code.
diff --git a/llvm/lib/Frontend/OpenMP/OMPContext.cpp b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
index 0f846f7bfee5a..a04116041aad7 100644
--- a/llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -169,13 +169,13 @@ static int isVariantApplicableInContextHelper(
if (MK == MK_ANY) {
if (WasFound)
return true;
- return None;
+ return std::nullopt;
}
// In "all" or "none" mode we accept a matching or non-matching property
// respectively and move on. We are not done yet!
if ((WasFound && MK == MK_ALL) || (!WasFound && MK == MK_NONE))
- return None;
+ return std::nullopt;
// We missed a property, provide some debug output and indicate failure.
LLVM_DEBUG({
diff --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index b0c8261c9addd..faedf38f40fae 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -3194,8 +3194,8 @@ createTargetMachine(Function *F, CodeGenOpt::Level OptLevel) {
llvm::TargetOptions Options;
return std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
- Triple, CPU, Features, Options, /*RelocModel=*/None, /*CodeModel=*/None,
- OptLevel));
+ Triple, CPU, Features, Options, /*RelocModel=*/std::nullopt,
+ /*CodeModel=*/std::nullopt, OptLevel));
}
/// Heuristically determine the best-performant unroll factor for \p CLI. This
@@ -3240,12 +3240,12 @@ static int32_t computeHeuristicUnrollFactor(CanonicalLoopInfo *CLI) {
gatherUnrollingPreferences(L, SE, TTI,
/*BlockFrequencyInfo=*/nullptr,
/*ProfileSummaryInfo=*/nullptr, ORE, OptLevel,
- /*UserThreshold=*/None,
- /*UserCount=*/None,
+ /*UserThreshold=*/std::nullopt,
+ /*UserCount=*/std::nullopt,
/*UserAllowPartial=*/true,
/*UserAllowRuntime=*/true,
- /*UserUpperBound=*/None,
- /*UserFullUnrollMaxCount=*/None);
+ /*UserUpperBound=*/std::nullopt,
+ /*UserFullUnrollMaxCount=*/std::nullopt);
UP.Force = true;
diff --git a/llvm/lib/FuzzMutate/IRMutator.cpp b/llvm/lib/FuzzMutate/IRMutator.cpp
index 11d7e24108639..a3407ab408c15 100644
--- a/llvm/lib/FuzzMutate/IRMutator.cpp
+++ b/llvm/lib/FuzzMutate/IRMutator.cpp
@@ -106,7 +106,7 @@ InjectorIRStrategy::chooseOperation(Value *Src, RandomIRBuilder &IB) {
};
auto RS = makeSampler(IB.Rand, make_filter_range(Operations, OpMatchesPred));
if (RS.isEmpty())
- return None;
+ return std::nullopt;
return *RS;
}
diff --git a/llvm/lib/FuzzMutate/Operations.cpp b/llvm/lib/FuzzMutate/Operations.cpp
index 0f618b3a097ad..8c6ec1e6b93c9 100644
--- a/llvm/lib/FuzzMutate/Operations.cpp
+++ b/llvm/lib/FuzzMutate/Operations.cpp
@@ -163,7 +163,7 @@ OpDescriptor llvm::fuzzerop::splitBlockDescriptor(unsigned Weight) {
SourcePred isInt1Ty{[](ArrayRef<Value *>, const Value *V) {
return V->getType()->isIntegerTy(1);
},
- None};
+ std::nullopt};
return {Weight, {isInt1Ty}, buildSplitBlock};
}
@@ -182,7 +182,7 @@ OpDescriptor llvm::fuzzerop::gepDescriptor(unsigned Weight) {
// TODO: Try to avoid meaningless accesses.
SourcePred sizedType(
[](ArrayRef<Value *>, const Value *V) { return V->getType()->isSized(); },
- None);
+ std::nullopt);
return {Weight, {sizedPtrType(), sizedType, anyIntType()}, buildGEP};
}
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index adc4eae61860a..c100fc25650d7 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -134,7 +134,7 @@ LTOCodeGenerator::LTOCodeGenerator(LLVMContext &Context)
Context.setDiscardValueNames(LTODiscardValueNames);
Context.enableDebugTypeODRUniquing();
- Config.CodeModel = None;
+ Config.CodeModel = std::nullopt;
Config.StatsFile = LTOStatsFile;
Config.PreCodeGenPassesHook = [](legacy::PassManager &PM) {
PM.add(createObjCARCContractPass());
@@ -446,7 +446,7 @@ std::unique_ptr<TargetMachine> LTOCodeGenerator::createTargetMachine() {
assert(MArch && "MArch is not set!");
return std::unique_ptr<TargetMachine>(MArch->createTargetMachine(
TripleStr, Config.CPU, FeatureStr, Config.Options, Config.RelocModel,
- None, Config.CGOptLevel));
+ std::nullopt, Config.CGOptLevel));
}
// If a linkonce global is present in the MustPreserveSymbols, we need to make
diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp
index 5ad5e857296d2..39f0f9842ec35 100644
--- a/llvm/lib/LTO/LTOModule.cpp
+++ b/llvm/lib/LTO/LTOModule.cpp
@@ -229,8 +229,8 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options,
CPU = "cyclone";
}
- TargetMachine *target =
- march->createTargetMachine(TripleStr, CPU, FeatureStr, options, None);
+ TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr,
+ options, std::nullopt);
std::unique_ptr<LTOModule> Ret(new LTOModule(std::move(M), Buffer, target));
Ret->parseSymbols();
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 190ef3f7ef714..1bfc9a307e0f8 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -618,7 +618,7 @@ std::unique_ptr<TargetMachine> TargetMachineBuilder::create() const {
std::unique_ptr<TargetMachine> TM(
TheTarget->createTargetMachine(TheTriple.str(), MCpu, FeatureStr, Options,
- RelocModel, None, CGOptLevel));
+ RelocModel, std::nullopt, CGOptLevel));
assert(TM && "Cannot create target machine");
return TM;
diff --git a/llvm/lib/LineEditor/LineEditor.cpp b/llvm/lib/LineEditor/LineEditor.cpp
index b29a0b0bb7417..120435c2644e9 100644
--- a/llvm/lib/LineEditor/LineEditor.cpp
+++ b/llvm/lib/LineEditor/LineEditor.cpp
@@ -255,7 +255,7 @@ Optional<std::string> LineEditor::readLine() const {
// Either of these may mean end-of-file.
if (!Line || LineLen == 0)
- return None;
+ return std::nullopt;
// Strip any newlines off the end of the string.
while (LineLen > 0 &&
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index 4cbe01ce1b0ec..fa0b2f3d304f0 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -1056,7 +1056,7 @@ void ELFWriter::writeSectionHeader(
// Null section first.
uint64_t FirstSectionSize =
(NumSections + 1) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0;
- WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, None, 0);
+ WriteSecHdrEntry(0, 0, 0, 0, 0, FirstSectionSize, 0, 0, std::nullopt, 0);
for (const MCSectionELF *Section : SectionTable) {
uint32_t GroupSymbolIndex;
diff --git a/llvm/lib/MC/MCAsmBackend.cpp b/llvm/lib/MC/MCAsmBackend.cpp
index da83190699ab7..d4d5662980ee5 100644
--- a/llvm/lib/MC/MCAsmBackend.cpp
+++ b/llvm/lib/MC/MCAsmBackend.cpp
@@ -75,7 +75,7 @@ MCAsmBackend::createDwoObjectWriter(raw_pwrite_stream &OS,
}
Optional<MCFixupKind> MCAsmBackend::getFixupKind(StringRef Name) const {
- return None;
+ return std::nullopt;
}
const MCFixupKindInfo &MCAsmBackend::getFixupKindInfo(MCFixupKind Kind) const {
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index effa5221afc3a..59c1d9427880e 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -266,12 +266,10 @@ class MCAsmStreamer final : public MCStreamer {
void emitFileDirective(StringRef Filename) override;
void emitFileDirective(StringRef Filename, StringRef CompilerVerion,
StringRef TimeStamp, StringRef Description) override;
- Expected<unsigned> tryEmitDwarfFileDirective(unsigned FileNo,
- StringRef Directory,
- StringRef Filename,
- Optional<MD5::MD5Result> Checksum = None,
- Optional<StringRef> Source = None,
- unsigned CUID = 0) override;
+ Expected<unsigned> tryEmitDwarfFileDirective(
+ unsigned FileNo, StringRef Directory, StringRef Filename,
+ Optional<MD5::MD5Result> Checksum = std::nullopt,
+ Optional<StringRef> Source = std::nullopt, unsigned CUID = 0) override;
void emitDwarfFile0Directive(StringRef Directory, StringRef Filename,
Optional<MD5::MD5Result> Checksum,
Optional<StringRef> Source,
@@ -1499,7 +1497,7 @@ void MCAsmStreamer::emitCodeAlignment(Align Alignment,
emitAlignmentDirective(Alignment.value(), MAI->getTextAlignFillValue(), 1,
MaxBytesToEmit);
else
- emitAlignmentDirective(Alignment.value(), None, 1, MaxBytesToEmit);
+ emitAlignmentDirective(Alignment.value(), std::nullopt, 1, MaxBytesToEmit);
}
void MCAsmStreamer::emitValueToOffset(const MCExpr *Offset,
@@ -2383,7 +2381,7 @@ MCAsmStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
Expr->print(OS, MAI);
}
EmitEOL();
- return None;
+ return std::nullopt;
}
void MCAsmStreamer::emitAddrsig() {
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 99d7e96e5872d..04e6a66c9a720 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -318,9 +318,9 @@ std::pair<size_t, size_t> CodeViewContext::getLineExtent(unsigned FuncId) {
ArrayRef<MCCVLoc> CodeViewContext::getLinesForExtent(size_t L, size_t R) {
if (R <= L)
- return None;
+ return std::nullopt;
if (L >= MCCVLines.size())
- return None;
+ return std::nullopt;
return makeArrayRef(&MCCVLines[L], R - L);
}
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index 205e272d3ace7..e504a6b0ed1b6 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -639,7 +639,8 @@ Optional<unsigned> MCContext::getELFUniqueIDForEntsize(StringRef SectionName,
unsigned EntrySize) {
auto I = ELFEntrySizeMap.find(
MCContext::ELFEntrySizeKey{SectionName, Flags, EntrySize});
- return (I != ELFEntrySizeMap.end()) ? Optional<unsigned>(I->second) : None;
+ return (I != ELFEntrySizeMap.end()) ? Optional<unsigned>(I->second)
+ : std::nullopt;
}
MCSectionGOFF *MCContext::getGOFFSection(StringRef Section, SectionKind Kind,
@@ -960,7 +961,7 @@ void MCContext::setGenDwarfRootFile(StringRef InputFileName, StringRef Buffer) {
FileName = FileName.drop_front();
assert(!FileName.empty());
setMCLineTableRootFile(
- /*CUID=*/0, getCompilationDir(), FileName, Cksum, None);
+ /*CUID=*/0, getCompilationDir(), FileName, Cksum, std::nullopt);
}
/// getDwarfFile - takes a file name and number to place in the dwarf file and
diff --git a/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp b/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
index 3ee43398ff65f..2db45a91e0878 100644
--- a/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
+++ b/llvm/lib/MC/MCDisassembler/MCDisassembler.cpp
@@ -17,7 +17,7 @@ Optional<MCDisassembler::DecodeStatus>
MCDisassembler::onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size,
ArrayRef<uint8_t> Bytes, uint64_t Address,
raw_ostream &CStream) const {
- return None;
+ return std::nullopt;
}
uint64_t MCDisassembler::suggestBytesToSkip(ArrayRef<uint8_t> Bytes,
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index b761a96e1da9e..136c40db825a8 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -284,9 +284,9 @@ void MCDwarfDwoLineTable::Emit(MCStreamer &MCOS, MCDwarfLineTableParams Params,
MCSection *Section) const {
if (!HasSplitLineTable)
return;
- Optional<MCDwarfLineStr> NoLineStr(None);
+ Optional<MCDwarfLineStr> NoLineStr(std::nullopt);
MCOS.switchSection(Section);
- MCOS.emitLabel(Header.Emit(&MCOS, Params, None, NoLineStr).second);
+ MCOS.emitLabel(Header.Emit(&MCOS, Params, std::nullopt, NoLineStr).second);
}
std::pair<MCSymbol *, MCSymbol *>
@@ -594,7 +594,7 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
// If any files have embedded source, they all must.
if (MCDwarfFiles.empty()) {
trackMD5Usage(Checksum.has_value());
- HasSource = (Source != None);
+ HasSource = (Source != std::nullopt);
}
if (DwarfVersion >= 5 && isRootFile(RootFile, Directory, FileName, Checksum))
return 0;
@@ -622,7 +622,7 @@ MCDwarfLineTableHeader::tryGetFile(StringRef &Directory,
inconvertibleErrorCode());
// If any files have embedded source, they all must.
- if (HasSource != (Source != None))
+ if (HasSource != (Source != std::nullopt))
return make_error<StringError>("inconsistent use of embedded source",
inconvertibleErrorCode());
diff --git a/llvm/lib/MC/MCInstrAnalysis.cpp b/llvm/lib/MC/MCInstrAnalysis.cpp
index 85434b15bb5eb..36133f687b837 100644
--- a/llvm/lib/MC/MCInstrAnalysis.cpp
+++ b/llvm/lib/MC/MCInstrAnalysis.cpp
@@ -33,11 +33,11 @@ bool MCInstrAnalysis::evaluateBranch(const MCInst & /*Inst*/, uint64_t /*Addr*/,
Optional<uint64_t> MCInstrAnalysis::evaluateMemoryOperandAddress(
const MCInst &Inst, const MCSubtargetInfo *STI, uint64_t Addr,
uint64_t Size) const {
- return None;
+ return std::nullopt;
}
Optional<uint64_t>
MCInstrAnalysis::getMemoryOperandRelocationOffset(const MCInst &Inst,
uint64_t Size) const {
- return None;
+ return std::nullopt;
}
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index 00213efb36c5e..e773e10444269 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -972,47 +972,53 @@ void MCObjectFileInfo::initXCOFFMCObjectFileInfo(const Triple &T) {
// sections, and the individual DWARF sections are distinguished by their
// section subtype.
DwarfAbbrevSection = Ctx->getXCOFFSection(
- ".dwabrev", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwabrev", SectionKind::getMetadata(),
+ /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwabrev", XCOFF::SSUBTYP_DWABREV);
DwarfInfoSection = Ctx->getXCOFFSection(
- ".dwinfo", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwinfo", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwinfo", XCOFF::SSUBTYP_DWINFO);
DwarfLineSection = Ctx->getXCOFFSection(
- ".dwline", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwline", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwline", XCOFF::SSUBTYP_DWLINE);
DwarfFrameSection = Ctx->getXCOFFSection(
- ".dwframe", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwframe", SectionKind::getMetadata(),
+ /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwframe", XCOFF::SSUBTYP_DWFRAME);
DwarfPubNamesSection = Ctx->getXCOFFSection(
- ".dwpbnms", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwpbnms", SectionKind::getMetadata(),
+ /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwpbnms", XCOFF::SSUBTYP_DWPBNMS);
DwarfPubTypesSection = Ctx->getXCOFFSection(
- ".dwpbtyp", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwpbtyp", SectionKind::getMetadata(),
+ /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwpbtyp", XCOFF::SSUBTYP_DWPBTYP);
DwarfStrSection = Ctx->getXCOFFSection(
- ".dwstr", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwstr", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwstr", XCOFF::SSUBTYP_DWSTR);
DwarfLocSection = Ctx->getXCOFFSection(
- ".dwloc", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwloc", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwloc", XCOFF::SSUBTYP_DWLOC);
DwarfARangesSection = Ctx->getXCOFFSection(
- ".dwarnge", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwarnge", SectionKind::getMetadata(),
+ /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwarnge", XCOFF::SSUBTYP_DWARNGE);
DwarfRangesSection = Ctx->getXCOFFSection(
- ".dwrnges", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwrnges", SectionKind::getMetadata(),
+ /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwrnges", XCOFF::SSUBTYP_DWRNGES);
DwarfMacinfoSection = Ctx->getXCOFFSection(
- ".dwmac", SectionKind::getMetadata(), /* CsectProperties */ None,
+ ".dwmac", SectionKind::getMetadata(), /* CsectProperties */ std::nullopt,
/* MultiSymbolsAllowed */ true, ".dwmac", XCOFF::SSUBTYP_DWMAC);
}
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index a6c3ecf0e466b..d5e8f8a5b6800 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -154,7 +154,7 @@ static Optional<uint64_t> absoluteSymbolDiff(const MCSymbol *Hi,
assert(Hi && Lo);
if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment() ||
Hi->isVariable() || Lo->isVariable())
- return None;
+ return std::nullopt;
return Hi->getOffset() - Lo->getOffset();
}
@@ -746,7 +746,7 @@ getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
std::string("symbol in offset has no data "
"fragment"));
DF = cast<MCDataFragment>(Fragment);
- return None;
+ return std::nullopt;
}
if (OffsetVal.getSymB())
@@ -785,7 +785,7 @@ getOffsetAndDataFragment(const MCSymbol &Symbol, uint32_t &RelocOffset,
"fragment"));
DF = cast<MCDataFragment>(Fragment);
}
- return None;
+ return std::nullopt;
}
Optional<std::pair<bool, std::string>>
@@ -814,7 +814,7 @@ MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
return std::make_pair(false, std::string(".reloc offset is negative"));
DF->getFixups().push_back(
MCFixup::create(OffsetVal.getConstant(), Expr, Kind, Loc));
- return None;
+ return std::nullopt;
}
if (OffsetVal.getSymB())
return std::make_pair(false,
@@ -827,19 +827,19 @@ MCObjectStreamer::emitRelocDirective(const MCExpr &Offset, StringRef Name,
Optional<std::pair<bool, std::string>> Error;
Error = getOffsetAndDataFragment(Symbol, SymbolOffset, DF);
- if (Error != None)
+ if (Error != std::nullopt)
return Error;
DF->getFixups().push_back(
MCFixup::create(SymbolOffset + OffsetVal.getConstant(),
Expr, Kind, Loc));
- return None;
+ return std::nullopt;
}
PendingFixups.emplace_back(
&SRE.getSymbol(), DF,
MCFixup::create(OffsetVal.getConstant(), Expr, Kind, Loc));
- return None;
+ return std::nullopt;
}
void MCObjectStreamer::emitFill(const MCExpr &NumBytes, uint64_t FillValue,
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index b85f76096bf8e..343ac3b594599 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -237,9 +237,11 @@ class AsmParser : public MCAsmParser {
AssemblerDialect = i;
}
- void Note(SMLoc L, const Twine &Msg, SMRange Range = None) override;
- bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) override;
- bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) override;
+ void Note(SMLoc L, const Twine &Msg, SMRange Range = std::nullopt) override;
+ bool Warning(SMLoc L, const Twine &Msg,
+ SMRange Range = std::nullopt) override;
+ bool printError(SMLoc L, const Twine &Msg,
+ SMRange Range = std::nullopt) override;
const AsmToken &Lex() override;
@@ -322,7 +324,7 @@ class AsmParser : public MCAsmParser {
void printMacroInstantiations();
void printMessage(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Msg,
- SMRange Range = None) const {
+ SMRange Range = std::nullopt) const {
ArrayRef<SMRange> Ranges(Range);
SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges);
}
@@ -949,10 +951,9 @@ bool AsmParser::enabledGenDwarfForAssembly() {
// Use the first #line directive for this, if any. It's preprocessed, so
// there is no checksum, and of course no source directive.
if (!FirstCppHashFilename.empty())
- getContext().setMCLineTableRootFile(/*CUID=*/0,
- getContext().getCompilationDir(),
- FirstCppHashFilename,
- /*Cksum=*/None, /*Source=*/None);
+ getContext().setMCLineTableRootFile(
+ /*CUID=*/0, getContext().getCompilationDir(), FirstCppHashFilename,
+ /*Cksum=*/std::nullopt, /*Source=*/std::nullopt);
const MCDwarfFile &RootFile =
getContext().getMCDwarfLineTable(/*CUID=*/0).getRootFile();
getContext().setGenDwarfFileNumber(getStreamer().emitDwarfFileDirective(
@@ -5698,7 +5699,8 @@ bool AsmParser::parseDirectiveRept(SMLoc DirectiveLoc, StringRef Dir) {
raw_svector_ostream OS(Buf);
while (Count--) {
// Note that the AtPseudoVariable is disabled for instantiations of .rep(t).
- if (expandMacro(OS, M->Body, None, None, false, getTok().getLoc()))
+ if (expandMacro(OS, M->Body, std::nullopt, std::nullopt, false,
+ getTok().getLoc()))
return true;
}
instantiateMacroLikeBody(M, DirectiveLoc, OS);
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index 01e862b0b1d20..e7d2dd098cc8b 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -510,9 +510,11 @@ class MasmParser : public MCAsmParser {
AssemblerDialect = i;
}
- void Note(SMLoc L, const Twine &Msg, SMRange Range = None) override;
- bool Warning(SMLoc L, const Twine &Msg, SMRange Range = None) override;
- bool printError(SMLoc L, const Twine &Msg, SMRange Range = None) override;
+ void Note(SMLoc L, const Twine &Msg, SMRange Range = std::nullopt) override;
+ bool Warning(SMLoc L, const Twine &Msg,
+ SMRange Range = std::nullopt) override;
+ bool printError(SMLoc L, const Twine &Msg,
+ SMRange Range = std::nullopt) override;
enum ExpandKind { ExpandMacros, DoNotExpandMacros };
const AsmToken &Lex(ExpandKind ExpandNextToken);
@@ -619,7 +621,7 @@ class MasmParser : public MCAsmParser {
bool expandStatement(SMLoc Loc);
void printMessage(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Msg,
- SMRange Range = None) const {
+ SMRange Range = std::nullopt) const {
ArrayRef<SMRange> Ranges(Range);
SrcMgr.PrintMessage(Loc, Kind, Msg, Ranges);
}
@@ -1323,10 +1325,9 @@ bool MasmParser::enabledGenDwarfForAssembly() {
// Use the first #line directive for this, if any. It's preprocessed, so
// there is no checksum, and of course no source directive.
if (!FirstCppHashFilename.empty())
- getContext().setMCLineTableRootFile(/*CUID=*/0,
- getContext().getCompilationDir(),
- FirstCppHashFilename,
- /*Cksum=*/None, /*Source=*/None);
+ getContext().setMCLineTableRootFile(
+ /*CUID=*/0, getContext().getCompilationDir(), FirstCppHashFilename,
+ /*Cksum=*/std::nullopt, /*Source=*/std::nullopt);
const MCDwarfFile &RootFile =
getContext().getMCDwarfLineTable(/*CUID=*/0).getRootFile();
getContext().setGenDwarfFileNumber(getStreamer().emitDwarfFileDirective(
@@ -6991,7 +6992,8 @@ bool MasmParser::parseDirectiveRepeat(SMLoc DirectiveLoc, StringRef Dir) {
SmallString<256> Buf;
raw_svector_ostream OS(Buf);
while (Count--) {
- if (expandMacro(OS, M->Body, None, None, M->Locals, getTok().getLoc()))
+ if (expandMacro(OS, M->Body, std::nullopt, std::nullopt, M->Locals,
+ getTok().getLoc()))
return true;
}
instantiateMacroLikeBody(M, DirectiveLoc, OS);
@@ -7024,7 +7026,8 @@ bool MasmParser::parseDirectiveWhile(SMLoc DirectiveLoc) {
if (Condition) {
// Instantiate the macro, then resume at this directive to recheck the
// condition.
- if (expandMacro(OS, M->Body, None, None, M->Locals, getTok().getLoc()))
+ if (expandMacro(OS, M->Body, std::nullopt, std::nullopt, M->Locals,
+ getTok().getLoc()))
return true;
instantiateMacroLikeBody(M, DirectiveLoc, /*ExitLoc=*/DirectiveLoc, OS);
}
diff --git a/llvm/lib/MC/MCRegisterInfo.cpp b/llvm/lib/MC/MCRegisterInfo.cpp
index d6c4fe10fc980..91b568f0142ce 100644
--- a/llvm/lib/MC/MCRegisterInfo.cpp
+++ b/llvm/lib/MC/MCRegisterInfo.cpp
@@ -84,12 +84,12 @@ Optional<unsigned> MCRegisterInfo::getLLVMRegNum(unsigned RegNum,
unsigned Size = isEH ? EHDwarf2LRegsSize : Dwarf2LRegsSize;
if (!M)
- return None;
+ return std::nullopt;
DwarfLLVMRegPair Key = { RegNum, 0 };
const DwarfLLVMRegPair *I = std::lower_bound(M, M+Size, Key);
if (I != M + Size && I->FromReg == RegNum)
return I->ToReg;
- return None;
+ return std::nullopt;
}
int MCRegisterInfo::getDwarfRegNumFromDwarfEHRegNum(unsigned RegNum) const {
diff --git a/llvm/lib/MC/MCSubtargetInfo.cpp b/llvm/lib/MC/MCSubtargetInfo.cpp
index 686274a84836b..03539e38ab138 100644
--- a/llvm/lib/MC/MCSubtargetInfo.cpp
+++ b/llvm/lib/MC/MCSubtargetInfo.cpp
@@ -342,11 +342,11 @@ std::optional<unsigned> MCSubtargetInfo::getCacheSize(unsigned Level) const {
std::optional<unsigned>
MCSubtargetInfo::getCacheAssociativity(unsigned Level) const {
- return None;
+ return std::nullopt;
}
Optional<unsigned> MCSubtargetInfo::getCacheLineSize(unsigned Level) const {
- return None;
+ return std::nullopt;
}
unsigned MCSubtargetInfo::getPrefetchDistance() const {
diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp
index 5102d48b3a5d5..d37800a9d704f 100644
--- a/llvm/lib/MC/MCWin64EH.cpp
+++ b/llvm/lib/MC/MCWin64EH.cpp
@@ -287,7 +287,7 @@ static Optional<int64_t> GetOptionalAbsDifference(MCStreamer &Streamer,
// unusual constructs, like an inline asm with an alignment directive.
int64_t value;
if (!Diff->evaluateAsAbsolute(value, OS->getAssembler()))
- return None;
+ return std::nullopt;
return value;
}
diff --git a/llvm/lib/ObjCopy/MachO/MachOObject.cpp b/llvm/lib/ObjCopy/MachO/MachOObject.cpp
index 699d25182257b..b5ad74f6257b9 100644
--- a/llvm/lib/ObjCopy/MachO/MachOObject.cpp
+++ b/llvm/lib/ObjCopy/MachO/MachOObject.cpp
@@ -209,7 +209,7 @@ Optional<StringRef> LoadCommand::getSegmentName() const {
case MachO::LC_SEGMENT_64:
return extractSegmentName(MLC.segment_command_64_data.segname);
default:
- return None;
+ return std::nullopt;
}
}
@@ -221,6 +221,6 @@ Optional<uint64_t> LoadCommand::getSegmentVMAddr() const {
case MachO::LC_SEGMENT_64:
return MLC.segment_command_64_data.vmaddr;
default:
- return None;
+ return std::nullopt;
}
}
diff --git a/llvm/lib/ObjCopy/MachO/MachOObject.h b/llvm/lib/ObjCopy/MachO/MachOObject.h
index 9f356d6279c16..83ff5b26e6e0c 100644
--- a/llvm/lib/ObjCopy/MachO/MachOObject.h
+++ b/llvm/lib/ObjCopy/MachO/MachOObject.h
@@ -125,7 +125,7 @@ struct SymbolEntry {
}
Optional<uint32_t> section() const {
- return n_sect == MachO::NO_SECT ? None : Optional<uint32_t>(n_sect);
+ return n_sect == MachO::NO_SECT ? std::nullopt : Optional<uint32_t>(n_sect);
}
};
diff --git a/llvm/lib/ObjCopy/MachO/MachOReader.cpp b/llvm/lib/ObjCopy/MachO/MachOReader.cpp
index e0fdd1ce4cfa2..e3c6f4bd14e1c 100644
--- a/llvm/lib/ObjCopy/MachO/MachOReader.cpp
+++ b/llvm/lib/ObjCopy/MachO/MachOReader.cpp
@@ -333,7 +333,7 @@ void MachOReader::readIndirectSymbolTable(Object &O) const {
for (uint32_t i = 0; i < DySymTab.nindirectsyms; ++i) {
uint32_t Index = MachOObj.getIndirectSymbolTableEntry(DySymTab, i);
if ((Index & AbsOrLocalMask) != 0)
- O.IndirectSymTable.Symbols.emplace_back(Index, None);
+ O.IndirectSymTable.Symbols.emplace_back(Index, std::nullopt);
else
O.IndirectSymTable.Symbols.emplace_back(
Index, O.SymTable.getSymbolByIndex(Index));
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 64683507a3e53..f22bcf9362fa0 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -1158,7 +1158,7 @@ Expected<Optional<Archive::Child>> Archive::findSym(StringRef name) const {
return MemberOrErr.takeError();
}
}
- return None;
+ return std::nullopt;
}
// Returns true if archive file contains no member file.
diff --git a/llvm/lib/Object/BuildID.cpp b/llvm/lib/Object/BuildID.cpp
index 68b6f439db4a1..2b7d3c0e5dc75 100644
--- a/llvm/lib/Object/BuildID.cpp
+++ b/llvm/lib/Object/BuildID.cpp
@@ -54,7 +54,7 @@ Optional<BuildIDRef> getBuildID(const ObjectFile *Obj) {
return getBuildID(O->getELFFile());
if (auto *O = dyn_cast<ELFObjectFile<ELF64BE>>(Obj))
return getBuildID(O->getELFFile());
- return None;
+ return std::nullopt;
}
Optional<std::string> BuildIDFetcher::fetch(BuildIDRef BuildID) const {
@@ -86,7 +86,7 @@ Optional<std::string> BuildIDFetcher::fetch(BuildIDRef BuildID) const {
return std::string(Path);
}
}
- return None;
+ return std::nullopt;
}
} // namespace object
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 31f009086612b..ef236b84c59d3 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -383,7 +383,7 @@ Optional<StringRef> ELFObjectFileBase::tryGetCPUName() const {
case ELF::EM_PPC64:
return StringRef("future");
default:
- return None;
+ return std::nullopt;
}
}
@@ -686,7 +686,7 @@ ELFObjectFileBase::getPltAddresses() const {
if (PltEntryIter != GotToPlt.end()) {
symbol_iterator Sym = Relocation.getSymbol();
if (Sym == symbol_end())
- Result.emplace_back(None, PltEntryIter->second);
+ Result.emplace_back(std::nullopt, PltEntryIter->second);
else
Result.emplace_back(Sym->getRawDataRefImpl(), PltEntryIter->second);
}
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index f3ca2e9bc5027..e6ff7cb2a9bb4 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -4889,12 +4889,12 @@ MachOObjectFile::getLinkOptHintsLoadCommand() const {
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const {
if (!DyldInfoLoadCmd)
- return None;
+ return std::nullopt;
auto DyldInfoOrErr =
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
if (!DyldInfoOrErr)
- return None;
+ return std::nullopt;
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
const uint8_t *Ptr =
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.rebase_off));
@@ -4903,12 +4903,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const {
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const {
if (!DyldInfoLoadCmd)
- return None;
+ return std::nullopt;
auto DyldInfoOrErr =
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
if (!DyldInfoOrErr)
- return None;
+ return std::nullopt;
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
const uint8_t *Ptr =
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.bind_off));
@@ -4917,12 +4917,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const {
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const {
if (!DyldInfoLoadCmd)
- return None;
+ return std::nullopt;
auto DyldInfoOrErr =
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
if (!DyldInfoOrErr)
- return None;
+ return std::nullopt;
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
const uint8_t *Ptr =
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.weak_bind_off));
@@ -4931,12 +4931,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const {
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const {
if (!DyldInfoLoadCmd)
- return None;
+ return std::nullopt;
auto DyldInfoOrErr =
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
if (!DyldInfoOrErr)
- return None;
+ return std::nullopt;
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
const uint8_t *Ptr =
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.lazy_bind_off));
@@ -4945,12 +4945,12 @@ ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const {
ArrayRef<uint8_t> MachOObjectFile::getDyldInfoExportsTrie() const {
if (!DyldInfoLoadCmd)
- return None;
+ return std::nullopt;
auto DyldInfoOrErr =
getStructOrErr<MachO::dyld_info_command>(*this, DyldInfoLoadCmd);
if (!DyldInfoOrErr)
- return None;
+ return std::nullopt;
MachO::dyld_info_command DyldInfo = DyldInfoOrErr.get();
const uint8_t *Ptr =
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldInfo.export_off));
@@ -4961,7 +4961,7 @@ Expected<Optional<MachO::linkedit_data_command>>
MachOObjectFile::getChainedFixupsLoadCommand() const {
// Load the dyld chained fixups load command.
if (!DyldChainedFixupsLoadCmd)
- return llvm::None;
+ return std::nullopt;
auto DyldChainedFixupsOrErr = getStructOrErr<MachO::linkedit_data_command>(
*this, DyldChainedFixupsLoadCmd);
if (!DyldChainedFixupsOrErr)
@@ -4972,7 +4972,7 @@ MachOObjectFile::getChainedFixupsLoadCommand() const {
// If the load command is present but the data offset has been zeroed out,
// as is the case for dylib stubs, return None (no error).
if (!DyldChainedFixups.dataoff)
- return llvm::None;
+ return std::nullopt;
return DyldChainedFixups;
}
@@ -4982,7 +4982,7 @@ MachOObjectFile::getChainedFixupsHeader() const {
if (!CFOrErr)
return CFOrErr.takeError();
if (!CFOrErr->has_value())
- return llvm::None;
+ return std::nullopt;
const MachO::linkedit_data_command &DyldChainedFixups = **CFOrErr;
@@ -5236,12 +5236,12 @@ MachOObjectFile::getDyldChainedFixupTargets() const {
ArrayRef<uint8_t> MachOObjectFile::getDyldExportsTrie() const {
if (!DyldExportsTrieLoadCmd)
- return None;
+ return std::nullopt;
auto DyldExportsTrieOrError = getStructOrErr<MachO::linkedit_data_command>(
*this, DyldExportsTrieLoadCmd);
if (!DyldExportsTrieOrError)
- return None;
+ return std::nullopt;
MachO::linkedit_data_command DyldExportsTrie = DyldExportsTrieOrError.get();
const uint8_t *Ptr =
reinterpret_cast<const uint8_t *>(getPtr(*this, DyldExportsTrie.dataoff));
@@ -5265,7 +5265,7 @@ SmallVector<uint64_t> MachOObjectFile::getFunctionStarts() const {
ArrayRef<uint8_t> MachOObjectFile::getUuid() const {
if (!UuidLoadCmd)
- return None;
+ return std::nullopt;
// Returning a pointer is fine as uuid doesn't need endian swapping.
const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid);
return makeArrayRef(reinterpret_cast<const uint8_t *>(Ptr), 16);
diff --git a/llvm/lib/Object/Minidump.cpp b/llvm/lib/Object/Minidump.cpp
index 3e932fe7be28b..a1316b0433fc2 100644
--- a/llvm/lib/Object/Minidump.cpp
+++ b/llvm/lib/Object/Minidump.cpp
@@ -19,7 +19,7 @@ MinidumpFile::getRawStream(minidump::StreamType Type) const {
auto It = StreamMap.find(Type);
if (It != StreamMap.end())
return getRawStream(Streams[It->second]);
- return None;
+ return std::nullopt;
}
Expected<std::string> MinidumpFile::getString(size_t Offset) const {
diff --git a/llvm/lib/ObjectYAML/ELFEmitter.cpp b/llvm/lib/ObjectYAML/ELFEmitter.cpp
index f5611ed1197bd..88d430f893125 100644
--- a/llvm/lib/ObjectYAML/ELFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/ELFEmitter.cpp
@@ -775,7 +775,7 @@ void ELFState<ELFT>::initSectionHeaders(std::vector<Elf_Shdr> &SHeaders,
if (!S->Offset)
S->Offset = alignToOffset(CBA, sizeof(typename ELFT::uint),
- /*Offset=*/None);
+ /*Offset=*/std::nullopt);
else
S->Offset = alignToOffset(CBA, /*Align=*/1, S->Offset);
@@ -1015,8 +1015,8 @@ void ELFState<ELFT>::initSymtabSectionHeader(Elf_Shdr &SHeader,
assignSectionAddress(SHeader, YAMLSec);
- SHeader.sh_offset =
- alignToOffset(CBA, SHeader.sh_addralign, RawSec ? RawSec->Offset : None);
+ SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign,
+ RawSec ? RawSec->Offset : std::nullopt);
if (RawSec && (RawSec->Content || RawSec->Size)) {
assert(Symbols.empty());
@@ -1043,7 +1043,7 @@ void ELFState<ELFT>::initStrtabSectionHeader(Elf_Shdr &SHeader, StringRef Name,
dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec);
SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign,
- YAMLSec ? YAMLSec->Offset : None);
+ YAMLSec ? YAMLSec->Offset : std::nullopt);
if (RawSec && (RawSec->Content || RawSec->Size)) {
SHeader.sh_size = writeContent(CBA, RawSec->Content, RawSec->Size);
@@ -1097,7 +1097,7 @@ void ELFState<ELFT>::initDWARFSectionHeader(Elf_Shdr &SHeader, StringRef Name,
SHeader.sh_type = YAMLSec ? YAMLSec->Type : ELF::SHT_PROGBITS;
SHeader.sh_addralign = YAMLSec ? (uint64_t)YAMLSec->AddressAlign : 1;
SHeader.sh_offset = alignToOffset(CBA, SHeader.sh_addralign,
- YAMLSec ? YAMLSec->Offset : None);
+ YAMLSec ? YAMLSec->Offset : std::nullopt);
ELFYAML::RawContentSection *RawSec =
dyn_cast_or_null<ELFYAML::RawContentSection>(YAMLSec);
diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index b94377a4e24a4..504a6837a1a17 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1202,7 +1202,7 @@ struct NormalizedOther {
Optional<uint8_t> denormalize(IO &) {
if (!Other)
- return None;
+ return std::nullopt;
uint8_t Ret = 0;
for (StOtherPiece &Val : *Other)
Ret |= toValue(Val);
diff --git a/llvm/lib/Option/ArgList.cpp b/llvm/lib/Option/ArgList.cpp
index 558a8df6d5506..96a3f44ca1ad8 100644
--- a/llvm/lib/Option/ArgList.cpp
+++ b/llvm/lib/Option/ArgList.cpp
@@ -128,7 +128,7 @@ void ArgList::AddAllArgsExcept(ArgStringList &Output,
/// This is a nicer interface when you don't have a list of Ids to exclude.
void ArgList::AddAllArgs(ArgStringList &Output,
ArrayRef<OptSpecifier> Ids) const {
- ArrayRef<OptSpecifier> Exclude = None;
+ ArrayRef<OptSpecifier> Exclude = std::nullopt;
AddAllArgsExcept(Output, Ids, Exclude);
}
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 6bac467cdd91d..7522302b2fe29 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -474,19 +474,19 @@ void PassBuilder::registerLoopAnalyses(LoopAnalysisManager &LAM) {
static std::optional<int> parseRepeatPassName(StringRef Name) {
if (!Name.consume_front("repeat<") || !Name.consume_back(">"))
- return None;
+ return std::nullopt;
int Count;
if (Name.getAsInteger(0, Count) || Count <= 0)
- return None;
+ return std::nullopt;
return Count;
}
static std::optional<int> parseDevirtPassName(StringRef Name) {
if (!Name.consume_front("devirt<") || !Name.consume_back(">"))
- return None;
+ return std::nullopt;
int Count;
if (Name.getAsInteger(0, Count) || Count < 0)
- return None;
+ return std::nullopt;
return Count;
}
@@ -1060,7 +1060,7 @@ PassBuilder::parsePipelineText(StringRef Text) {
do {
// If we try to pop the outer pipeline we have unbalanced parentheses.
if (PipelineStack.size() == 1)
- return None;
+ return std::nullopt;
PipelineStack.pop_back();
} while (Text.consume_front(")"));
@@ -1072,12 +1072,12 @@ PassBuilder::parsePipelineText(StringRef Text) {
// Otherwise, the end of an inner pipeline always has to be followed by
// a comma, and then we can continue.
if (!Text.consume_front(","))
- return None;
+ return std::nullopt;
}
if (PipelineStack.size() > 1)
// Unbalanced paretheses.
- return None;
+ return std::nullopt;
assert(PipelineStack.back() == &ResultPipeline &&
"Wrong pipeline at the bottom of the stack!");
diff --git a/llvm/lib/Passes/PassBuilderBindings.cpp b/llvm/lib/Passes/PassBuilderBindings.cpp
index 54108a6eee6eb..a87c0e6dc0a37 100644
--- a/llvm/lib/Passes/PassBuilderBindings.cpp
+++ b/llvm/lib/Passes/PassBuilderBindings.cpp
@@ -53,7 +53,7 @@ LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, const char *Passes,
Module *Mod = unwrap(M);
PassInstrumentationCallbacks PIC;
- PassBuilder PB(Machine, PassOpts->PTO, None, &PIC);
+ PassBuilder PB(Machine, PassOpts->PTO, std::nullopt, &PIC);
LoopAnalysisManager LAM;
FunctionAnalysisManager FAM;
diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index 7dd07656b6c72..1d58a8515118b 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -1877,7 +1877,7 @@ std::string DotCfgChangeReporter::genHTML(StringRef Text, StringRef DotFile,
return "Unable to find dot executable.";
StringRef Args[] = {DotBinary, "-Tpdf", "-o", PDFFile, DotFile};
- int Result = sys::ExecuteAndWait(*DotExe, Args, None);
+ int Result = sys::ExecuteAndWait(*DotExe, Args, std::nullopt);
if (Result < 0)
return "Error executing system dot.";
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 712dfc07ac264..51a2503c080f3 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -558,7 +558,7 @@ class SegmentBuilder {
// Complete any remaining active regions.
if (!ActiveRegions.empty())
- completeRegionsUntil(None, 0);
+ completeRegionsUntil(std::nullopt, 0);
}
/// Sort a nested sequence of regions from a single file.
@@ -684,7 +684,7 @@ static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {
IsNotExpandedFile[CR.ExpandedFileID] = false;
int I = IsNotExpandedFile.find_first();
if (I == -1)
- return None;
+ return std::nullopt;
return I;
}
@@ -695,7 +695,7 @@ static Optional<unsigned> findMainViewFileID(StringRef SourceFile,
Optional<unsigned> I = findMainViewFileID(Function);
if (I && SourceFile == Function.Filenames[*I])
return I;
- return None;
+ return std::nullopt;
}
static bool isExpansion(const CountedRegion &R, unsigned FileID) {
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
index 4478d8d646d63..9d63b5e4acfb3 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMappingReader.cpp
@@ -817,8 +817,8 @@ static Error readCoverageMappingData(
// In Version4, function records are not affixed to coverage headers. Read
// the records from their dedicated section.
if (Version >= CovMapVersion::Version4)
- return Reader->readFunctionRecords(FuncRecBuf, FuncRecBufEnd, None, nullptr,
- nullptr);
+ return Reader->readFunctionRecords(FuncRecBuf, FuncRecBufEnd, std::nullopt,
+ nullptr, nullptr);
return Error::success();
}
diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp
index 6cd6723778319..5d8f321b1a24e 100644
--- a/llvm/lib/ProfileData/SampleProfReader.cpp
+++ b/llvm/lib/ProfileData/SampleProfReader.cpp
@@ -1824,7 +1824,7 @@ Optional<StringRef>
SampleProfileReaderItaniumRemapper::lookUpNameInProfile(StringRef Fname) {
if (auto Key = Remappings->lookup(Fname))
return NameMap.lookup(Key);
- return None;
+ return std::nullopt;
}
/// Prepare a memory buffer for the contents of \p Filename.
diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.cpp b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
index d74fff4ca7c5f..08b8386a30efb 100644
--- a/llvm/lib/Remarks/BitstreamRemarkParser.cpp
+++ b/llvm/lib/Remarks/BitstreamRemarkParser.cpp
@@ -501,7 +501,7 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) {
std::unique_ptr<Remark> Result = std::make_unique<Remark>();
Remark &R = *Result;
- if (StrTab == None)
+ if (StrTab == std::nullopt)
return createStringError(
std::make_error_code(std::errc::invalid_argument),
"Error while parsing BLOCK_REMARK: missing string table.");
diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.h b/llvm/lib/Remarks/BitstreamRemarkParser.h
index 988bc30da6e10..78f18a68c1ec4 100644
--- a/llvm/lib/Remarks/BitstreamRemarkParser.h
+++ b/llvm/lib/Remarks/BitstreamRemarkParser.h
@@ -77,8 +77,8 @@ struct BitstreamRemarkParser : public RemarkParser {
};
Expected<std::unique_ptr<BitstreamRemarkParser>> createBitstreamParserFromMeta(
- StringRef Buf, Optional<ParsedStringTable> StrTab = None,
- Optional<StringRef> ExternalFilePrependPath = None);
+ StringRef Buf, Optional<ParsedStringTable> StrTab = std::nullopt,
+ Optional<StringRef> ExternalFilePrependPath = std::nullopt);
} // end namespace remarks
} // end namespace llvm
diff --git a/llvm/lib/Remarks/BitstreamRemarkSerializer.cpp b/llvm/lib/Remarks/BitstreamRemarkSerializer.cpp
index 5a77a25b15690..91aaef11dffe3 100644
--- a/llvm/lib/Remarks/BitstreamRemarkSerializer.cpp
+++ b/llvm/lib/Remarks/BitstreamRemarkSerializer.cpp
@@ -245,19 +245,19 @@ void BitstreamRemarkSerializerHelper::emitMetaBlock(
switch (ContainerType) {
case BitstreamRemarkContainerType::SeparateRemarksMeta:
- assert(StrTab != None && *StrTab != nullptr);
+ assert(StrTab != std::nullopt && *StrTab != nullptr);
emitMetaStrTab(**StrTab);
- assert(Filename != None);
+ assert(Filename != std::nullopt);
emitMetaExternalFile(*Filename);
break;
case BitstreamRemarkContainerType::SeparateRemarksFile:
- assert(RemarkVersion != None);
+ assert(RemarkVersion != std::nullopt);
emitMetaRemarkVersion(*RemarkVersion);
break;
case BitstreamRemarkContainerType::Standalone:
- assert(RemarkVersion != None);
+ assert(RemarkVersion != std::nullopt);
emitMetaRemarkVersion(*RemarkVersion);
- assert(StrTab != None && *StrTab != nullptr);
+ assert(StrTab != std::nullopt && *StrTab != nullptr);
emitMetaStrTab(**StrTab);
break;
}
@@ -297,7 +297,7 @@ void BitstreamRemarkSerializerHelper::emitRemarkBlock(const Remark &Remark,
R.clear();
unsigned Key = StrTab.add(Arg.Key).first;
unsigned Val = StrTab.add(Arg.Val).first;
- bool HasDebugLoc = Arg.Loc != None;
+ bool HasDebugLoc = Arg.Loc != std::nullopt;
R.push_back(HasDebugLoc ? RECORD_REMARK_ARG_WITH_DEBUGLOC
: RECORD_REMARK_ARG_WITHOUT_DEBUGLOC);
R.push_back(Key);
@@ -353,7 +353,7 @@ void BitstreamRemarkSerializer::emit(const Remark &Remark) {
Helper.ContainerType == BitstreamRemarkContainerType::Standalone;
BitstreamMetaSerializer MetaSerializer(
OS, Helper,
- IsStandalone ? &*StrTab : Optional<const StringTable *>(None));
+ IsStandalone ? &*StrTab : Optional<const StringTable *>(std::nullopt));
MetaSerializer.emit();
DidSetUp = true;
}
diff --git a/llvm/lib/Remarks/RemarkLinker.cpp b/llvm/lib/Remarks/RemarkLinker.cpp
index 60794718a5375..d21bcb1569d1c 100644
--- a/llvm/lib/Remarks/RemarkLinker.cpp
+++ b/llvm/lib/Remarks/RemarkLinker.cpp
@@ -78,7 +78,7 @@ Error RemarkLinker::link(StringRef Buffer, Optional<Format> RemarkFormat) {
Expected<std::unique_ptr<RemarkParser>> MaybeParser =
createRemarkParserFromMeta(
- *RemarkFormat, Buffer, /*StrTab=*/None,
+ *RemarkFormat, Buffer, /*StrTab=*/std::nullopt,
PrependPath ? Optional<StringRef>(StringRef(*PrependPath))
: Optional<StringRef>());
if (!MaybeParser)
diff --git a/llvm/lib/Remarks/RemarkParser.cpp b/llvm/lib/Remarks/RemarkParser.cpp
index 2577693d30986..67ec0b092825e 100644
--- a/llvm/lib/Remarks/RemarkParser.cpp
+++ b/llvm/lib/Remarks/RemarkParser.cpp
@@ -113,7 +113,7 @@ struct CParser {
std::optional<std::string> Err;
CParser(Format ParserFormat, StringRef Buf,
- std::optional<ParsedStringTable> StrTab = None)
+ std::optional<ParsedStringTable> StrTab = std::nullopt)
: TheParser(cantFail(
StrTab ? createRemarkParser(ParserFormat, Buf, std::move(*StrTab))
: createRemarkParser(ParserFormat, Buf))) {}
diff --git a/llvm/lib/Remarks/RemarkStreamer.cpp b/llvm/lib/Remarks/RemarkStreamer.cpp
index 543b00723659e..8ad2ce6948a40 100644
--- a/llvm/lib/Remarks/RemarkStreamer.cpp
+++ b/llvm/lib/Remarks/RemarkStreamer.cpp
@@ -27,7 +27,8 @@ RemarkStreamer::RemarkStreamer(
std::unique_ptr<remarks::RemarkSerializer> RemarkSerializer,
Optional<StringRef> FilenameIn)
: RemarkSerializer(std::move(RemarkSerializer)),
- Filename(FilenameIn ? Optional<std::string>(FilenameIn->str()) : None) {}
+ Filename(FilenameIn ? Optional<std::string>(FilenameIn->str())
+ : std::nullopt) {}
Error RemarkStreamer::setFilter(StringRef Filter) {
Regex R = Regex(Filter);
diff --git a/llvm/lib/Remarks/YAMLRemarkParser.cpp b/llvm/lib/Remarks/YAMLRemarkParser.cpp
index 6f879d3450c7d..6372e541104c5 100644
--- a/llvm/lib/Remarks/YAMLRemarkParser.cpp
+++ b/llvm/lib/Remarks/YAMLRemarkParser.cpp
@@ -168,7 +168,7 @@ remarks::createYAMLParserFromMeta(StringRef Buf,
}
YAMLRemarkParser::YAMLRemarkParser(StringRef Buf)
- : YAMLRemarkParser(Buf, None) {}
+ : YAMLRemarkParser(Buf, std::nullopt) {}
YAMLRemarkParser::YAMLRemarkParser(StringRef Buf,
Optional<ParsedStringTable> StrTab)
diff --git a/llvm/lib/Remarks/YAMLRemarkParser.h b/llvm/lib/Remarks/YAMLRemarkParser.h
index 88b3003010d3c..44425e85f1a9d 100644
--- a/llvm/lib/Remarks/YAMLRemarkParser.h
+++ b/llvm/lib/Remarks/YAMLRemarkParser.h
@@ -107,10 +107,9 @@ struct YAMLStrTabRemarkParser : public YAMLRemarkParser {
Expected<StringRef> parseStr(yaml::KeyValueNode &Node) override;
};
-Expected<std::unique_ptr<YAMLRemarkParser>>
-createYAMLParserFromMeta(StringRef Buf,
- Optional<ParsedStringTable> StrTab = None,
- Optional<StringRef> ExternalFilePrependPath = None);
+Expected<std::unique_ptr<YAMLRemarkParser>> createYAMLParserFromMeta(
+ StringRef Buf, Optional<ParsedStringTable> StrTab = std::nullopt,
+ Optional<StringRef> ExternalFilePrependPath = std::nullopt);
} // end namespace remarks
} // end namespace llvm
diff --git a/llvm/lib/Remarks/YAMLRemarkSerializer.cpp b/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
index a9390d88e79e4..513c7efeb4421 100644
--- a/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
+++ b/llvm/lib/Remarks/YAMLRemarkSerializer.cpp
@@ -187,7 +187,7 @@ void YAMLStrTabRemarkSerializer::emit(const Remark &Remark) {
// metadata first and set DidEmitMeta to avoid emitting it again.
if (Mode == SerializerMode::Standalone && !DidEmitMeta) {
std::unique_ptr<MetaSerializer> MetaSerializer =
- metaSerializer(OS, /*ExternalFilename=*/None);
+ metaSerializer(OS, /*ExternalFilename=*/std::nullopt);
MetaSerializer->emit();
DidEmitMeta = true;
}
@@ -243,7 +243,7 @@ static void emitExternalFile(raw_ostream &OS, StringRef Filename) {
void YAMLMetaSerializer::emit() {
emitMagic(OS);
emitVersion(OS);
- emitStrTab(OS, None);
+ emitStrTab(OS, std::nullopt);
if (ExternalFilename)
emitExternalFile(OS, *ExternalFilename);
}
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 399b96c68da3a..ba2b2c1e2b34a 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -2952,7 +2952,7 @@ llvm::APIntOps::SolveQuadraticEquationWrap(APInt A, APInt B, APInt C,
// between them, so they would both be contained between X and X+1.
if (!SignChange) {
LLVM_DEBUG(dbgs() << __func__ << ": no valid solution\n");
- return None;
+ return std::nullopt;
}
X += 1;
@@ -2964,7 +2964,7 @@ Optional<unsigned>
llvm::APIntOps::GetMostSignificantDifferentBit(const APInt &A, const APInt &B) {
assert(A.getBitWidth() == B.getBitWidth() && "Must have the same bitwidth");
if (A == B)
- return llvm::None;
+ return std::nullopt;
return A.getBitWidth() - ((A ^ B).countLeadingZeros() + 1);
}
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index b2caaeec21245..7fe09eb95892e 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -518,7 +518,7 @@ bool CrashRecoveryContext::RunSafelyOnThread(function_ref<void()> Fn,
bool UseBackgroundPriority = hasThreadBackgroundPriority();
RunSafelyOnThreadInfo Info = { Fn, this, UseBackgroundPriority, false };
llvm::thread Thread(RequestedStackSize == 0
- ? llvm::None
+ ? std::nullopt
: llvm::Optional<unsigned>(RequestedStackSize),
RunSafelyOnThread_Dispatch, &Info);
Thread.join();
diff --git a/llvm/lib/Support/DJB.cpp b/llvm/lib/Support/DJB.cpp
index f06af7dfde444..2701d5da2fb23 100644
--- a/llvm/lib/Support/DJB.cpp
+++ b/llvm/lib/Support/DJB.cpp
@@ -65,7 +65,7 @@ static Optional<uint32_t> fastCaseFoldingDjbHash(StringRef Buffer, uint32_t H) {
}
if (AllASCII)
return H;
- return None;
+ return std::nullopt;
}
uint32_t llvm::caseFoldingDjbHash(StringRef Buffer, uint32_t H) {
diff --git a/llvm/lib/Support/ELFAttributes.cpp b/llvm/lib/Support/ELFAttributes.cpp
index 87e8c6f5cd351..f2a1732fc3761 100644
--- a/llvm/lib/Support/ELFAttributes.cpp
+++ b/llvm/lib/Support/ELFAttributes.cpp
@@ -29,6 +29,6 @@ std::optional<unsigned> ELFAttrs::attrTypeFromString(StringRef tag,
return item.tagName.drop_front(hasTagPrefix ? 0 : 4) == tag;
});
if (tagNameIt == tagNameMap.end())
- return None;
+ return std::nullopt;
return tagNameIt->attr;
}
diff --git a/llvm/lib/Support/FormatVariadic.cpp b/llvm/lib/Support/FormatVariadic.cpp
index 19e5f9d631788..169cea445e937 100644
--- a/llvm/lib/Support/FormatVariadic.cpp
+++ b/llvm/lib/Support/FormatVariadic.cpp
@@ -20,7 +20,7 @@ static std::optional<AlignStyle> translateLocChar(char C) {
case '+':
return AlignStyle::Right;
default:
- return None;
+ return std::nullopt;
}
LLVM_BUILTIN_UNREACHABLE;
}
diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp
index c28d4a001fc72..57559ad0830df 100644
--- a/llvm/lib/Support/GraphWriter.cpp
+++ b/llvm/lib/Support/GraphWriter.cpp
@@ -136,14 +136,14 @@ static bool ExecGraphViewer(StringRef ExecPath, std::vector<StringRef> &args,
StringRef Filename, bool wait,
std::string &ErrMsg) {
if (wait) {
- if (sys::ExecuteAndWait(ExecPath, args, None, {}, 0, 0, &ErrMsg)) {
+ if (sys::ExecuteAndWait(ExecPath, args, std::nullopt, {}, 0, 0, &ErrMsg)) {
errs() << "Error: " << ErrMsg << "\n";
return true;
}
sys::fs::remove(Filename);
errs() << " done. \n";
} else {
- sys::ExecuteNoWait(ExecPath, args, None, {}, 0, &ErrMsg);
+ sys::ExecuteNoWait(ExecPath, args, std::nullopt, {}, 0, &ErrMsg);
errs() << "Remember to erase graph file: " << Filename << "\n";
}
return false;
diff --git a/llvm/lib/Support/JSON.cpp b/llvm/lib/Support/JSON.cpp
index 6cd0097e4aa4f..22219ac384218 100644
--- a/llvm/lib/Support/JSON.cpp
+++ b/llvm/lib/Support/JSON.cpp
@@ -40,27 +40,27 @@ const Value *Object::get(StringRef K) const {
llvm::Optional<std::nullptr_t> Object::getNull(StringRef K) const {
if (auto *V = get(K))
return V->getAsNull();
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<bool> Object::getBoolean(StringRef K) const {
if (auto *V = get(K))
return V->getAsBoolean();
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<double> Object::getNumber(StringRef K) const {
if (auto *V = get(K))
return V->getAsNumber();
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<int64_t> Object::getInteger(StringRef K) const {
if (auto *V = get(K))
return V->getAsInteger();
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<llvm::StringRef> Object::getString(StringRef K) const {
if (auto *V = get(K))
return V->getAsString();
- return llvm::None;
+ return std::nullopt;
}
const json::Object *Object::getObject(StringRef K) const {
if (auto *V = get(K))
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index 9f34405e54fc5..c62a1a35d1881 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -335,13 +335,13 @@ Optional<bool> KnownBits::eq(const KnownBits &LHS, const KnownBits &RHS) {
return Optional<bool>(LHS.getConstant() == RHS.getConstant());
if (LHS.One.intersects(RHS.Zero) || RHS.One.intersects(LHS.Zero))
return Optional<bool>(false);
- return None;
+ return std::nullopt;
}
Optional<bool> KnownBits::ne(const KnownBits &LHS, const KnownBits &RHS) {
if (Optional<bool> KnownEQ = eq(LHS, RHS))
return Optional<bool>(!*KnownEQ);
- return None;
+ return std::nullopt;
}
Optional<bool> KnownBits::ugt(const KnownBits &LHS, const KnownBits &RHS) {
@@ -351,13 +351,13 @@ Optional<bool> KnownBits::ugt(const KnownBits &LHS, const KnownBits &RHS) {
// LHS >u RHS -> true if umin(LHS) > umax(RHS)
if (LHS.getMinValue().ugt(RHS.getMaxValue()))
return Optional<bool>(true);
- return None;
+ return std::nullopt;
}
Optional<bool> KnownBits::uge(const KnownBits &LHS, const KnownBits &RHS) {
if (Optional<bool> IsUGT = ugt(RHS, LHS))
return Optional<bool>(!*IsUGT);
- return None;
+ return std::nullopt;
}
Optional<bool> KnownBits::ult(const KnownBits &LHS, const KnownBits &RHS) {
@@ -375,13 +375,13 @@ Optional<bool> KnownBits::sgt(const KnownBits &LHS, const KnownBits &RHS) {
// LHS >s RHS -> true if smin(LHS) > smax(RHS)
if (LHS.getSignedMinValue().sgt(RHS.getSignedMaxValue()))
return Optional<bool>(true);
- return None;
+ return std::nullopt;
}
Optional<bool> KnownBits::sge(const KnownBits &LHS, const KnownBits &RHS) {
if (Optional<bool> KnownSGT = sgt(RHS, LHS))
return Optional<bool>(!*KnownSGT);
- return None;
+ return std::nullopt;
}
Optional<bool> KnownBits::slt(const KnownBits &LHS, const KnownBits &RHS) {
diff --git a/llvm/lib/Support/LineIterator.cpp b/llvm/lib/Support/LineIterator.cpp
index 0a53002572fea..caf88d7dfd4af 100644
--- a/llvm/lib/Support/LineIterator.cpp
+++ b/llvm/lib/Support/LineIterator.cpp
@@ -83,7 +83,7 @@ void line_iterator::advance() {
if (*Pos == '\0') {
// We've hit the end of the buffer, reset ourselves to the end state.
- Buffer = None;
+ Buffer = std::nullopt;
CurrentLine = StringRef();
return;
}
diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp
index 5fd52999adb5a..6e934ba10b319 100644
--- a/llvm/lib/Support/LockFileManager.cpp
+++ b/llvm/lib/Support/LockFileManager.cpp
@@ -60,7 +60,7 @@ LockFileManager::readLockFile(StringRef LockFileName) {
MemoryBuffer::getFile(LockFileName);
if (!MBOrErr) {
sys::fs::remove(LockFileName);
- return None;
+ return std::nullopt;
}
MemoryBuffer &MB = *MBOrErr.get();
@@ -77,7 +77,7 @@ LockFileManager::readLockFile(StringRef LockFileName) {
// Delete the lock file. It's invalid anyway.
sys::fs::remove(LockFileName);
- return None;
+ return std::nullopt;
}
static std::error_code getHostID(SmallVectorImpl<char> &HostID) {
diff --git a/llvm/lib/Support/OptimizedStructLayout.cpp b/llvm/lib/Support/OptimizedStructLayout.cpp
index 19a93ed6776d2..6e9eacb0a5cac 100644
--- a/llvm/lib/Support/OptimizedStructLayout.cpp
+++ b/llvm/lib/Support/OptimizedStructLayout.cpp
@@ -436,7 +436,7 @@ llvm::performOptimizedStructLayout(MutableArrayRef<Field> Fields) {
// Phase 2: repeatedly add the best flexible-offset field until
// they're all gone.
while (!FlexibleFieldsByAlignment.empty()) {
- bool Success = tryAddBestField(None);
+ bool Success = tryAddBestField(std::nullopt);
assert(Success && "didn't find a field with no fixed limit?");
(void) Success;
}
diff --git a/llvm/lib/Support/RISCVISAInfo.cpp b/llvm/lib/Support/RISCVISAInfo.cpp
index ff9525bd948fd..2be381df1d0df 100644
--- a/llvm/lib/Support/RISCVISAInfo.cpp
+++ b/llvm/lib/Support/RISCVISAInfo.cpp
@@ -168,7 +168,7 @@ findDefaultVersion(StringRef ExtName) {
}
return ExtensionInfoIterator->Version;
}
- return None;
+ return std::nullopt;
}
void RISCVISAInfo::addExtension(StringRef ExtName, unsigned MajorVersion,
@@ -209,7 +209,7 @@ isExperimentalExtension(StringRef Ext) {
auto ExtIterator =
llvm::find_if(SupportedExperimentalExtensions, FindByName(Ext));
if (ExtIterator == std::end(SupportedExperimentalExtensions))
- return None;
+ return std::nullopt;
return ExtIterator->Version;
}
diff --git a/llvm/lib/Support/ScopedPrinter.cpp b/llvm/lib/Support/ScopedPrinter.cpp
index ef6dd5fdf1d6c..a17e397c0aa58 100644
--- a/llvm/lib/Support/ScopedPrinter.cpp
+++ b/llvm/lib/Support/ScopedPrinter.cpp
@@ -31,7 +31,8 @@ void ScopedPrinter::printBinaryImpl(StringRef Label, StringRef Str,
startLine() << Label << ":";
if (!Str.empty())
OS << " " << Str;
- OS << " (" << format_bytes(Data, None, Data.size(), 1, 0, true) << ")\n";
+ OS << " (" << format_bytes(Data, std::nullopt, Data.size(), 1, 0, true)
+ << ")\n";
}
}
diff --git a/llvm/lib/Support/Signals.cpp b/llvm/lib/Support/Signals.cpp
index 5773dfcc773e9..c681266f03b75 100644
--- a/llvm/lib/Support/Signals.cpp
+++ b/llvm/lib/Support/Signals.cpp
@@ -203,7 +203,7 @@ static bool printSymbolizedStackTrace(StringRef Argv0, void **StackTrace,
#endif
"--demangle"};
int RunResult =
- sys::ExecuteAndWait(LLVMSymbolizerPath, Args, None, Redirects);
+ sys::ExecuteAndWait(LLVMSymbolizerPath, Args, std::nullopt, Redirects);
if (RunResult != 0)
return false;
diff --git a/llvm/lib/Support/SymbolRemappingReader.cpp b/llvm/lib/Support/SymbolRemappingReader.cpp
index 90997ab0a6cea..3cae57770c37c 100644
--- a/llvm/lib/Support/SymbolRemappingReader.cpp
+++ b/llvm/lib/Support/SymbolRemappingReader.cpp
@@ -52,7 +52,7 @@ Error SymbolRemappingReader::read(MemoryBuffer &B) {
.Case("name", FK::Name)
.Case("type", FK::Type)
.Case("encoding", FK::Encoding)
- .Default(None);
+ .Default(std::nullopt);
if (!FragmentKind)
return ReportError("Invalid kind, expected 'name', 'type', or 'encoding',"
" found '" + Parts[0] + "'");
diff --git a/llvm/lib/Support/UnicodeNameToCodepoint.cpp b/llvm/lib/Support/UnicodeNameToCodepoint.cpp
index cc1463db35d71..5fb61250705c0 100644
--- a/llvm/lib/Support/UnicodeNameToCodepoint.cpp
+++ b/llvm/lib/Support/UnicodeNameToCodepoint.cpp
@@ -294,7 +294,7 @@ nameToHangulCodePoint(StringRef Name, bool Strict, BufferType &Buffer) {
bool DoesStartWith = startsWith(Name, "HANGUL SYLLABLE ", Strict, Consummed,
NameStart, NeedleStart);
if (!DoesStartWith)
- return None;
+ return std::nullopt;
Name = Name.substr(Consummed);
int L = -1, V = -1, T = -1;
Name = Name.substr(findSyllable(Name, Strict, NameStart, L, 0));
@@ -314,7 +314,7 @@ nameToHangulCodePoint(StringRef Name, bool Strict, BufferType &Buffer) {
std::uint32_t(T);
}
// Otherwise, it's an illegal syllable name.
- return None;
+ return std::nullopt;
}
struct GeneratedNamesData {
@@ -367,13 +367,13 @@ nameToGeneratedCodePoint(StringRef Name, bool Strict, BufferType &Buffer) {
}
return V;
}
- return None;
+ return std::nullopt;
}
static llvm::Optional<char32_t> nameToCodepoint(StringRef Name, bool Strict,
BufferType &Buffer) {
if (Name.empty())
- return None;
+ return std::nullopt;
llvm::Optional<char32_t> Res = nameToHangulCodePoint(Name, Strict, Buffer);
if (!Res)
@@ -397,7 +397,7 @@ static llvm::Optional<char32_t> nameToCodepoint(StringRef Name, bool Strict,
}
return Value;
}
- return None;
+ return std::nullopt;
}
llvm::Optional<char32_t> nameToCodepointStrict(StringRef Name) {
@@ -412,7 +412,7 @@ nameToCodepointLooseMatching(StringRef Name) {
BufferType Buffer;
auto Opt = nameToCodepoint(Name, false, Buffer);
if (!Opt)
- return None;
+ return std::nullopt;
return LooseMatchingResult{*Opt, Buffer};
}
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index f19352e1b04ee..cbb8ff71f78c5 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -177,7 +177,7 @@ Optional<std::string> Process::GetEnv(StringRef Name) {
std::string NameStr = Name.str();
const char *Val = ::getenv(NameStr.c_str());
if (!Val)
- return None;
+ return std::nullopt;
return std::string(Val);
}
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index 3c4ce947b8724..ace58270ef949 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -1013,8 +1013,8 @@ bool InMemoryFileSystem::addHardLink(const Twine &NewLink,
// before. Resolved ToPath must be a File.
if (!TargetNode || NewLinkNode || !isa<detail::InMemoryFile>(*TargetNode))
return false;
- return addFile(NewLink, 0, nullptr, None, None, None, None,
- [&](detail::NewInMemoryNodeInfo NNI) {
+ return addFile(NewLink, 0, nullptr, std::nullopt, std::nullopt, std::nullopt,
+ std::nullopt, [&](detail::NewInMemoryNodeInfo NNI) {
return std::make_unique<detail::InMemoryHardLink>(
NNI.Path.str(),
*cast<detail::InMemoryFile>(*TargetNode));
@@ -1610,7 +1610,7 @@ class llvm::vfs::RedirectingFileSystemParser {
SmallString<12> Storage;
StringRef Value;
if (!parseScalarString(N, Value, Storage))
- return None;
+ return std::nullopt;
if (Value.equals_insensitive("fallthrough")) {
return RedirectingFileSystem::RedirectKind::Fallthrough;
@@ -1619,7 +1619,7 @@ class llvm::vfs::RedirectingFileSystemParser {
} else if (Value.equals_insensitive("redirect-only")) {
return RedirectingFileSystem::RedirectKind::RedirectOnly;
}
- return None;
+ return std::nullopt;
}
struct KeyStatus {
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp
index e9619f578b8b7..5046074ebf2eb 100644
--- a/llvm/lib/Support/YAMLParser.cpp
+++ b/llvm/lib/Support/YAMLParser.cpp
@@ -259,8 +259,9 @@ class Scanner {
Token getNext();
void printError(SMLoc Loc, SourceMgr::DiagKind Kind, const Twine &Message,
- ArrayRef<SMRange> Ranges = None) {
- SM.PrintMessage(Loc, Kind, Message, Ranges, /* FixIts= */ None, ShowColors);
+ ArrayRef<SMRange> Ranges = std::nullopt) {
+ SM.PrintMessage(Loc, Kind, Message, Ranges, /* FixIts= */ std::nullopt,
+ ShowColors);
}
void setError(const Twine &Message, StringRef::iterator Position) {
@@ -771,7 +772,7 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'N':
return false;
default:
- return None;
+ return std::nullopt;
}
case 2:
switch (S.front()) {
@@ -782,7 +783,7 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'o':
if (S[1] == 'n') //[Oo]n
return true;
- return None;
+ return std::nullopt;
case 'N':
if (S[1] == 'O') // NO
return false;
@@ -790,9 +791,9 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'n':
if (S[1] == 'o') //[Nn]o
return false;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
case 3:
switch (S.front()) {
@@ -803,7 +804,7 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'o':
if (S.drop_front() == "ff") //[Oo]ff
return false;
- return None;
+ return std::nullopt;
case 'Y':
if (S.drop_front() == "ES") // YES
return true;
@@ -811,9 +812,9 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'y':
if (S.drop_front() == "es") //[Yy]es
return true;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
case 4:
switch (S.front()) {
@@ -824,9 +825,9 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 't':
if (S.drop_front() == "rue") //[Tt]rue
return true;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
case 5:
switch (S.front()) {
@@ -837,12 +838,12 @@ llvm::Optional<bool> yaml::parseBool(StringRef S) {
case 'f':
if (S.drop_front() == "alse") //[Ff]alse
return false;
- return None;
+ return std::nullopt;
default:
- return None;
+ return std::nullopt;
}
default:
- return None;
+ return std::nullopt;
}
}
diff --git a/llvm/lib/TableGen/Parser.cpp b/llvm/lib/TableGen/Parser.cpp
index fd98a538a65ee..73a3362924129 100644
--- a/llvm/lib/TableGen/Parser.cpp
+++ b/llvm/lib/TableGen/Parser.cpp
@@ -28,7 +28,7 @@ bool llvm::TableGenParseFile(SourceMgr &InputSrcMgr, RecordKeeper &Records) {
auto *MainFileBuffer = SrcMgr.getMemoryBuffer(SrcMgr.getMainFileID());
Records.saveInputFilename(MainFileBuffer->getBufferIdentifier().str());
- TGParser Parser(SrcMgr, /*Macros=*/None, Records,
+ TGParser Parser(SrcMgr, /*Macros=*/std::nullopt, Records,
/*NoWarnOnUnusedTemplateArgs=*/false,
/*TrackReferenceLocs=*/true);
bool ParseResult = Parser.ParseFile();
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 381d93d43e2e3..f19eb23ba0854 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -2648,9 +2648,9 @@ llvm::Optional<StringRef>
Record::getValueAsOptionalString(StringRef FieldName) const {
const RecordVal *R = getValue(FieldName);
if (!R || !R->getValue())
- return llvm::None;
+ return std::nullopt;
if (isa<UnsetInit>(R->getValue()))
- return llvm::None;
+ return std::nullopt;
if (StringInit *SI = dyn_cast<StringInit>(R->getValue()))
return SI->getValue();
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 094a73a7de2b2..459bf1a8f758f 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -2823,7 +2823,7 @@ Init *TGParser::ParseDeclaration(Record *CurRec,
SMLoc ValLoc = Lex.getLoc();
Init *Val = ParseValue(CurRec, Type);
if (!Val ||
- SetValue(CurRec, ValLoc, DeclName, None, Val,
+ SetValue(CurRec, ValLoc, DeclName, std::nullopt, Val,
/*AllowSelfAssignment=*/false, /*OverrideDefLoc=*/false)) {
// Return the name, even if an error is thrown. This is so that we can
// continue to make some progress, even without the value having been
diff --git a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
index de1634ebed3ca..122fbdedd74e7 100644
--- a/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
+++ b/llvm/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp
@@ -101,7 +101,7 @@ Optional<std::string> getPrefix(StringRef Argv0) {
// aarch64-w64-mingw32-llvm-dlltool-10.exe -> aarch64-w64-mingw32
ProgName = ProgName.rtrim("0123456789.-");
if (!ProgName.consume_back_insensitive("dlltool"))
- return None;
+ return std::nullopt;
ProgName.consume_back_insensitive("llvm-");
ProgName.consume_back_insensitive("-");
return ProgName.str();
diff --git a/llvm/lib/XRay/InstrumentationMap.cpp b/llvm/lib/XRay/InstrumentationMap.cpp
index a68ca198e5573..0b7a192de44ba 100644
--- a/llvm/lib/XRay/InstrumentationMap.cpp
+++ b/llvm/lib/XRay/InstrumentationMap.cpp
@@ -38,14 +38,14 @@ Optional<int32_t> InstrumentationMap::getFunctionId(uint64_t Addr) const {
auto I = FunctionIds.find(Addr);
if (I != FunctionIds.end())
return I->second;
- return None;
+ return std::nullopt;
}
Optional<uint64_t> InstrumentationMap::getFunctionAddr(int32_t FuncId) const {
auto I = FunctionAddresses.find(FuncId);
if (I != FunctionAddresses.end())
return I->second;
- return None;
+ return std::nullopt;
}
using RelocMap = DenseMap<uint64_t, uint64_t>;
More information about the llvm-commits
mailing list