[Lldb-commits] [lldb] 343523d - [lldb] Use std::nullopt instead of None (NFC)
Kazu Hirata via lldb-commits
lldb-commits at lists.llvm.org
Sun Dec 4 16:51:36 PST 2022
Author: Kazu Hirata
Date: 2022-12-04T16:51:25-08:00
New Revision: 343523d040d1ede65a35d8a6d514b0f7c198a3f2
URL: https://github.com/llvm/llvm-project/commit/343523d040d1ede65a35d8a6d514b0f7c198a3f2
DIFF: https://github.com/llvm/llvm-project/commit/343523d040d1ede65a35d8a6d514b0f7c198a3f2.diff
LOG: [lldb] 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:
lldb/include/lldb/Breakpoint/BreakpointResolver.h
lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
lldb/include/lldb/Core/DataFileCache.h
lldb/include/lldb/Core/Debugger.h
lldb/include/lldb/Core/SourceLocationSpec.h
lldb/include/lldb/Host/File.h
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/include/lldb/Target/LanguageRuntime.h
lldb/include/lldb/Target/Platform.h
lldb/include/lldb/Target/Target.h
lldb/include/lldb/Target/TraceDumper.h
lldb/include/lldb/Utility/Event.h
lldb/include/lldb/Utility/Predicate.h
lldb/include/lldb/Utility/Timeout.h
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/API/SBCommunication.cpp
lldb/source/API/SBExpressionOptions.cpp
lldb/source/API/SBListener.cpp
lldb/source/API/SBPlatform.cpp
lldb/source/API/SBThread.cpp
lldb/source/Breakpoint/BreakpointID.cpp
lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
lldb/source/Commands/CommandObjectExpression.cpp
lldb/source/Commands/CommandObjectMultiword.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Core/Debugger.cpp
lldb/source/Core/DumpDataExtractor.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Core/Module.cpp
lldb/source/Core/SourceLocationSpec.cpp
lldb/source/Core/ThreadedCommunication.cpp
lldb/source/Expression/IRExecutionUnit.cpp
lldb/source/Host/common/Editline.cpp
lldb/source/Host/common/File.cpp
lldb/source/Host/common/HostInfoBase.cpp
lldb/source/Host/common/NativeProcessProtocol.cpp
lldb/source/Host/common/Terminal.cpp
lldb/source/Host/linux/Host.cpp
lldb/source/Host/linux/HostInfoLinux.cpp
lldb/source/Host/posix/HostInfoPosix.cpp
lldb/source/Interpreter/CommandHistory.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Interpreter/ScriptInterpreter.cpp
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
lldb/source/Plugins/Process/Linux/Perf.cpp
lldb/source/Plugins/Process/Linux/Perf.h
lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
lldb/source/Plugins/Process/Utility/AuxVector.cpp
lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompileUnit.cpp
lldb/source/Symbol/CompilerType.cpp
lldb/source/Symbol/DWARFCallFrameInfo.cpp
lldb/source/Symbol/Function.cpp
lldb/source/Symbol/PostfixExpression.cpp
lldb/source/Symbol/SymbolFileOnDemand.cpp
lldb/source/Symbol/TypeSystem.cpp
lldb/source/Symbol/UnwindPlan.cpp
lldb/source/Symbol/UnwindTable.cpp
lldb/source/Target/MemoryTagMap.cpp
lldb/source/Target/PathMappingList.cpp
lldb/source/Target/Platform.cpp
lldb/source/Target/Process.cpp
lldb/source/Target/ProcessTrace.cpp
lldb/source/Target/RemoteAwarePlatform.cpp
lldb/source/Target/Statistics.cpp
lldb/source/Target/Target.cpp
lldb/source/Target/Trace.cpp
lldb/source/Target/TraceDumper.cpp
lldb/source/Utility/FileSpec.cpp
lldb/source/Utility/StringExtractorGDBRemote.cpp
lldb/source/Utility/UriParser.cpp
lldb/source/Utility/UserIDResolver.cpp
lldb/tools/lldb-server/lldb-platform.cpp
lldb/tools/lldb-vscode/JSONUtils.h
lldb/tools/lldb-vscode/ProgressEvent.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/lldb/include/lldb/Breakpoint/BreakpointResolver.h
index 7aa43b9f45df5..0e99346f15112 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolver.h
@@ -205,7 +205,7 @@ class BreakpointResolver : public Searcher {
void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list,
bool skip_prologue, llvm::StringRef log_ident,
uint32_t line = 0,
- llvm::Optional<uint16_t> column = llvm::None);
+ llvm::Optional<uint16_t> column = std::nullopt);
void SetSCMatchesByLine(SearchFilter &, SymbolContextList &, bool,
const char *) = delete;
diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
index bc1fdff92b8db..b3ccba5461223 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h
@@ -24,7 +24,7 @@ class BreakpointResolverFileLine : public BreakpointResolver {
BreakpointResolverFileLine(
const lldb::BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue,
const SourceLocationSpec &location_spec,
- llvm::Optional<llvm::StringRef> removed_prefix_opt = llvm::None);
+ llvm::Optional<llvm::StringRef> removed_prefix_opt = std::nullopt);
static BreakpointResolver *
CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
diff --git a/lldb/include/lldb/Core/DataFileCache.h b/lldb/include/lldb/Core/DataFileCache.h
index b6cc3cd8f1cc3..b6c7123ccb7a9 100644
--- a/lldb/include/lldb/Core/DataFileCache.h
+++ b/lldb/include/lldb/Core/DataFileCache.h
@@ -107,13 +107,13 @@ class DataFileCache {
/// it is out of date.
struct CacheSignature {
/// UUID of object file or module.
- llvm::Optional<UUID> m_uuid = llvm::None;
+ llvm::Optional<UUID> m_uuid = std::nullopt;
/// Modification time of file on disk.
- llvm::Optional<std::time_t> m_mod_time = llvm::None;
+ llvm::Optional<std::time_t> m_mod_time = std::nullopt;
/// If this describes a .o file with a BSD archive, the BSD archive's
/// modification time will be in m_mod_time, and the .o file's modification
/// time will be in this m_obj_mod_time.
- llvm::Optional<std::time_t> m_obj_mod_time = llvm::None;
+ llvm::Optional<std::time_t> m_obj_mod_time = std::nullopt;
CacheSignature() = default;
@@ -124,9 +124,9 @@ struct CacheSignature {
CacheSignature(lldb_private::ObjectFile *objfile);
void Clear() {
- m_uuid = llvm::None;
- m_mod_time = llvm::None;
- m_obj_mod_time = llvm::None;
+ m_uuid = std::nullopt;
+ m_mod_time = std::nullopt;
+ m_obj_mod_time = std::nullopt;
}
/// Return true only if the CacheSignature is valid.
diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h
index c1394c1d0ebdb..2f630763cc71a 100644
--- a/lldb/include/lldb/Core/Debugger.h
+++ b/lldb/include/lldb/Core/Debugger.h
@@ -402,7 +402,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
/// ensure the given warning is only broadcast once.
static void
ReportWarning(std::string message,
- llvm::Optional<lldb::user_id_t> debugger_id = llvm::None,
+ llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
std::once_flag *once = nullptr);
/// Report error events.
@@ -424,7 +424,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
/// ensure the given error is only broadcast once.
static void
ReportError(std::string message,
- llvm::Optional<lldb::user_id_t> debugger_id = llvm::None,
+ llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
std::once_flag *once = nullptr);
/// Report info events.
@@ -444,7 +444,7 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
/// ensure the given info is only logged once.
static void
ReportInfo(std::string message,
- llvm::Optional<lldb::user_id_t> debugger_id = llvm::None,
+ llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
std::once_flag *once = nullptr);
static void ReportSymbolChange(const ModuleSpec &module_spec);
diff --git a/lldb/include/lldb/Core/SourceLocationSpec.h b/lldb/include/lldb/Core/SourceLocationSpec.h
index 808931186dba5..3b58b2818d22f 100644
--- a/lldb/include/lldb/Core/SourceLocationSpec.h
+++ b/lldb/include/lldb/Core/SourceLocationSpec.h
@@ -47,7 +47,7 @@ class SourceLocationSpec {
/// Whether to look for an exact match.
///
explicit SourceLocationSpec(FileSpec file_spec, uint32_t line,
- llvm::Optional<uint16_t> column = llvm::None,
+ llvm::Optional<uint16_t> column = std::nullopt,
bool check_inlines = false,
bool exact_match = false);
diff --git a/lldb/include/lldb/Host/File.h b/lldb/include/lldb/Host/File.h
index 85e8185ebc966..6d4d7dd8904a7 100644
--- a/lldb/include/lldb/Host/File.h
+++ b/lldb/include/lldb/Host/File.h
@@ -437,10 +437,10 @@ class NativeFile : public File {
class SerialPort : public NativeFile {
public:
struct Options {
- llvm::Optional<unsigned int> BaudRate = llvm::None;
- llvm::Optional<Terminal::Parity> Parity = llvm::None;
- llvm::Optional<Terminal::ParityCheck> ParityCheck = llvm::None;
- llvm::Optional<unsigned int> StopBits = llvm::None;
+ llvm::Optional<unsigned int> BaudRate = std::nullopt;
+ llvm::Optional<Terminal::Parity> Parity = std::nullopt;
+ llvm::Optional<Terminal::ParityCheck> ParityCheck = std::nullopt;
+ llvm::Optional<unsigned int> StopBits = std::nullopt;
};
// Obtain Options corresponding to the passed URL query string
diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index a72800b5409ca..82f46469df61f 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -627,7 +627,7 @@ class CommandInterpreter : public Broadcaster,
/// \return \b true if the session transcript was successfully written to
/// disk, \b false otherwise.
bool SaveTranscript(CommandReturnObject &result,
- llvm::Optional<std::string> output_file = llvm::None);
+ llvm::Optional<std::string> output_file = std::nullopt);
FileSpec GetCurrentSourceDir();
diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h
index fc058eb50a5e5..03f5aef7d5d6c 100644
--- a/lldb/include/lldb/Interpreter/CommandObject.h
+++ b/lldb/include/lldb/Interpreter/CommandObject.h
@@ -279,7 +279,7 @@ class CommandObject : public std::enable_shared_from_this<CommandObject> {
/// If the string is empty, the command won't be allow repeating.
virtual llvm::Optional<std::string>
GetRepeatCommand(Args ¤t_command_args, uint32_t index) {
- return llvm::None;
+ return std::nullopt;
}
bool HasOverrideCallback() const {
diff --git a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
index 2795c2f487dff..dfa22570f2c7e 100644
--- a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
+++ b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h
@@ -63,7 +63,7 @@ class ScriptedProcessInterface : virtual public ScriptedInterface {
virtual bool IsAlive() { return true; }
virtual llvm::Optional<std::string> GetScriptedThreadPluginName() {
- return llvm::None;
+ return std::nullopt;
}
virtual StructuredData::DictionarySP GetMetadata() { return {}; }
@@ -86,11 +86,11 @@ class ScriptedThreadInterface : virtual public ScriptedInterface {
virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; }
- virtual llvm::Optional<std::string> GetName() { return llvm::None; }
+ virtual llvm::Optional<std::string> GetName() { return std::nullopt; }
virtual lldb::StateType GetState() { return lldb::eStateInvalid; }
- virtual llvm::Optional<std::string> GetQueue() { return llvm::None; }
+ virtual llvm::Optional<std::string> GetQueue() { return std::nullopt; }
virtual StructuredData::DictionarySP GetStopReason() { return {}; }
@@ -99,7 +99,7 @@ class ScriptedThreadInterface : virtual public ScriptedInterface {
virtual StructuredData::DictionarySP GetRegisterInfo() { return {}; }
virtual llvm::Optional<std::string> GetRegisterContext() {
- return llvm::None;
+ return std::nullopt;
}
virtual StructuredData::ArraySP GetExtendedInfo() { return {}; }
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index c9e727faba664..69682d121f2fd 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -572,7 +572,7 @@ class TypeSystemMap {
/// \return The found type system or an error.
llvm::Expected<lldb::TypeSystemSP> GetTypeSystemForLanguage(
lldb::LanguageType language,
- llvm::Optional<CreateCallback> create_callback = llvm::None);
+ llvm::Optional<CreateCallback> create_callback = std::nullopt);
};
} // namespace lldb_private
diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h
index 0cdb02a449017..502a7e359939c 100644
--- a/lldb/include/lldb/Target/LanguageRuntime.h
+++ b/lldb/include/lldb/Target/LanguageRuntime.h
@@ -151,7 +151,7 @@ class LanguageRuntime : public Runtime, public PluginInterface {
virtual bool IsAllowedRuntimeValue(ConstString name) { return false; }
virtual llvm::Optional<CompilerType> GetRuntimeType(CompilerType base_type) {
- return llvm::None;
+ return std::nullopt;
}
void ModulesDidLoad(const ModuleList &module_list) override {}
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index 5f8cd467847de..ba105ffda0389 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -232,11 +232,11 @@ class Platform : public PluginInterface {
virtual bool GetRemoteOSVersion() { return false; }
virtual llvm::Optional<std::string> GetRemoteOSBuildString() {
- return llvm::None;
+ return std::nullopt;
}
virtual llvm::Optional<std::string> GetRemoteOSKernelDescription() {
- return llvm::None;
+ return std::nullopt;
}
// Remote Platform subclasses need to override this function
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index b2f72cd644a87..9e016a970cfa6 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -455,7 +455,7 @@ class EvaluateExpressionOptions {
lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
Timeout<std::micro> m_timeout = default_timeout;
- Timeout<std::micro> m_one_thread_timeout = llvm::None;
+ Timeout<std::micro> m_one_thread_timeout = std::nullopt;
lldb::ExpressionCancelCallback m_cancel_callback = nullptr;
void *m_cancel_callback_baton = nullptr;
// If m_pound_line_file is not empty and m_pound_line_line is non-zero, use
diff --git a/lldb/include/lldb/Target/TraceDumper.h b/lldb/include/lldb/Target/TraceDumper.h
index 59f887878888d..bc79705c6dd09 100644
--- a/lldb/include/lldb/Target/TraceDumper.h
+++ b/lldb/include/lldb/Target/TraceDumper.h
@@ -39,10 +39,10 @@ struct TraceDumperOptions {
/// For each instruction, print the instruction kind.
bool show_control_flow_kind = false;
/// Optional custom id to start traversing from.
- llvm::Optional<uint64_t> id = llvm::None;
+ llvm::Optional<uint64_t> id = std::nullopt;
/// Optional number of instructions to skip from the starting position
/// of the cursor.
- llvm::Optional<size_t> skip = llvm::None;
+ llvm::Optional<size_t> skip = std::nullopt;
};
/// Class used to dump the instructions of a \a TraceCursor using its current
diff --git a/lldb/include/lldb/Utility/Event.h b/lldb/include/lldb/Utility/Event.h
index f533fc5c47fa5..8d2d94fe3fdbc 100644
--- a/lldb/include/lldb/Utility/Event.h
+++ b/lldb/include/lldb/Utility/Event.h
@@ -112,7 +112,7 @@ class EventDataReceipt : public EventData {
ConstString GetFlavor() const override { return GetFlavorString(); }
- bool WaitForEventReceived(const Timeout<std::micro> &timeout = llvm::None) {
+ bool WaitForEventReceived(const Timeout<std::micro> &timeout = std::nullopt) {
return m_predicate.WaitForValueEqualTo(true, timeout);
}
diff --git a/lldb/include/lldb/Utility/Predicate.h b/lldb/include/lldb/Utility/Predicate.h
index e5d80acb11bca..3496aff8ee95c 100644
--- a/lldb/include/lldb/Utility/Predicate.h
+++ b/lldb/include/lldb/Utility/Predicate.h
@@ -127,7 +127,7 @@ template <class T> class Predicate {
}
if (m_condition.wait_for(lock, *timeout, RealCond))
return m_value;
- return llvm::None;
+ return std::nullopt;
}
/// Wait for \a m_value to be equal to \a value.
///
@@ -152,9 +152,9 @@ template <class T> class Predicate {
/// true if the \a m_value is equal to \a value, false otherwise (timeout
/// occurred).
bool WaitForValueEqualTo(T value,
- const Timeout<std::micro> &timeout = llvm::None) {
+ const Timeout<std::micro> &timeout = std::nullopt) {
return WaitFor([&value](T current) { return value == current; }, timeout) !=
- llvm::None;
+ std::nullopt;
}
/// Wait for \a m_value to not be equal to \a value.
@@ -180,7 +180,7 @@ template <class T> class Predicate {
/// m_value if m_value != value, None otherwise (timeout occurred).
llvm::Optional<T>
WaitForValueNotEqualTo(T value,
- const Timeout<std::micro> &timeout = llvm::None) {
+ const Timeout<std::micro> &timeout = std::nullopt) {
return WaitFor([&value](T current) { return value != current; }, timeout);
}
diff --git a/lldb/include/lldb/Utility/Timeout.h b/lldb/include/lldb/Utility/Timeout.h
index f656138eb44b3..a873c4776f63a 100644
--- a/lldb/include/lldb/Utility/Timeout.h
+++ b/lldb/include/lldb/Utility/Timeout.h
@@ -41,7 +41,7 @@ class Timeout : public llvm::Optional<std::chrono::duration<int64_t, Ratio>> {
template <typename Ratio2,
typename = typename EnableIf<int64_t, Ratio2>::type>
Timeout(const Timeout<Ratio2> &other)
- : Base(other ? Base(Dur<Ratio>(*other)) : llvm::None) {}
+ : Base(other ? Base(Dur<Ratio>(*other)) : std::nullopt) {}
template <typename Rep2, typename Ratio2,
typename = typename EnableIf<Rep2, Ratio2>::type>
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index aa46f1085dc9f..8457b78e1599c 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -45,7 +45,7 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
m_backend(backend) {
m_auto_repeat_command =
auto_repeat_command == nullptr
- ? llvm::None
+ ? std::nullopt
: llvm::Optional<std::string>(auto_repeat_command);
// We don't know whether any given command coming from this interface takes
// arguments or not so here we're just disabling the basic args check.
@@ -62,7 +62,7 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
llvm::Optional<std::string> GetRepeatCommand(Args ¤t_command_args,
uint32_t index) override {
if (!m_auto_repeat_command)
- return llvm::None;
+ return std::nullopt;
else
return m_auto_repeat_command;
}
diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp
index b9c8b498a38e3..f93898718be6c 100644
--- a/lldb/source/API/SBCommunication.cpp
+++ b/lldb/source/API/SBCommunication.cpp
@@ -107,7 +107,7 @@ size_t SBCommunication::Read(void *dst, size_t dst_len, uint32_t timeout_usec,
size_t bytes_read = 0;
Timeout<std::micro> timeout = timeout_usec == UINT32_MAX
- ? Timeout<std::micro>(llvm::None)
+ ? Timeout<std::micro>(std::nullopt)
: std::chrono::microseconds(timeout_usec);
if (m_opaque)
bytes_read = m_opaque->Read(dst, dst_len, timeout, status, nullptr);
diff --git a/lldb/source/API/SBExpressionOptions.cpp b/lldb/source/API/SBExpressionOptions.cpp
index 191e38fe5cfc4..d07acbc0aa2db 100644
--- a/lldb/source/API/SBExpressionOptions.cpp
+++ b/lldb/source/API/SBExpressionOptions.cpp
@@ -94,7 +94,7 @@ uint32_t SBExpressionOptions::GetTimeoutInMicroSeconds() const {
void SBExpressionOptions::SetTimeoutInMicroSeconds(uint32_t timeout) {
LLDB_INSTRUMENT_VA(this, timeout);
- m_opaque_up->SetTimeout(timeout == 0 ? Timeout<std::micro>(llvm::None)
+ m_opaque_up->SetTimeout(timeout == 0 ? Timeout<std::micro>(std::nullopt)
: std::chrono::microseconds(timeout));
}
@@ -110,7 +110,7 @@ void SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds(uint32_t timeout) {
LLDB_INSTRUMENT_VA(this, timeout);
m_opaque_up->SetOneThreadTimeout(timeout == 0
- ? Timeout<std::micro>(llvm::None)
+ ? Timeout<std::micro>(std::nullopt)
: std::chrono::microseconds(timeout));
}
diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp
index a7008dc5224e0..a4c847bec8577 100644
--- a/lldb/source/API/SBListener.cpp
+++ b/lldb/source/API/SBListener.cpp
@@ -132,7 +132,7 @@ bool SBListener::WaitForEvent(uint32_t timeout_secs, SBEvent &event) {
bool success = false;
if (m_opaque_sp) {
- Timeout<std::micro> timeout(llvm::None);
+ Timeout<std::micro> timeout(std::nullopt);
if (timeout_secs != UINT32_MAX) {
assert(timeout_secs != 0); // Take this out after all calls with timeout
// set to zero have been removed....
@@ -156,7 +156,7 @@ bool SBListener::WaitForEventForBroadcaster(uint32_t num_seconds,
LLDB_INSTRUMENT_VA(this, num_seconds, broadcaster, event);
if (m_opaque_sp && broadcaster.IsValid()) {
- Timeout<std::micro> timeout(llvm::None);
+ Timeout<std::micro> timeout(std::nullopt);
if (num_seconds != UINT32_MAX)
timeout = std::chrono::seconds(num_seconds);
EventSP event_sp;
@@ -176,7 +176,7 @@ bool SBListener::WaitForEventForBroadcasterWithType(
LLDB_INSTRUMENT_VA(this, num_seconds, broadcaster, event_type_mask, event);
if (m_opaque_sp && broadcaster.IsValid()) {
- Timeout<std::micro> timeout(llvm::None);
+ Timeout<std::micro> timeout(std::nullopt);
if (num_seconds != UINT32_MAX)
timeout = std::chrono::seconds(num_seconds);
EventSP event_sp;
diff --git a/lldb/source/API/SBPlatform.cpp b/lldb/source/API/SBPlatform.cpp
index 2a8e963c15a7c..807d0085c7bcb 100644
--- a/lldb/source/API/SBPlatform.cpp
+++ b/lldb/source/API/SBPlatform.cpp
@@ -69,7 +69,7 @@ struct PlatformShellCommand {
std::string m_output;
int m_status = 0;
int m_signo = 0;
- Timeout<std::ratio<1>> m_timeout = llvm::None;
+ Timeout<std::ratio<1>> m_timeout = std::nullopt;
};
// SBPlatformConnectOptions
SBPlatformConnectOptions::SBPlatformConnectOptions(const char *url)
@@ -261,7 +261,7 @@ void SBPlatformShellCommand::SetTimeoutSeconds(uint32_t sec) {
LLDB_INSTRUMENT_VA(this, sec);
if (sec == UINT32_MAX)
- m_opaque_ptr->m_timeout = llvm::None;
+ m_opaque_ptr->m_timeout = std::nullopt;
else
m_opaque_ptr->m_timeout = std::chrono::seconds(sec);
}
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index a08cb741814bc..616f047f68883 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -837,7 +837,7 @@ SBError SBThread::StepOverUntil(lldb::SBFrame &sb_frame,
const bool stop_other_threads = false;
// TODO: Handle SourceLocationSpec column information
SourceLocationSpec location_spec(
- step_file_spec, line, /*column=*/llvm::None, /*check_inlines=*/true,
+ step_file_spec, line, /*column=*/std::nullopt, /*check_inlines=*/true,
/*exact_match=*/false);
SymbolContextList sc_list;
diff --git a/lldb/source/Breakpoint/BreakpointID.cpp b/lldb/source/Breakpoint/BreakpointID.cpp
index 245cf7913335d..048f09aa6b6e3 100644
--- a/lldb/source/Breakpoint/BreakpointID.cpp
+++ b/lldb/source/Breakpoint/BreakpointID.cpp
@@ -68,21 +68,21 @@ BreakpointID::ParseCanonicalReference(llvm::StringRef input) {
break_id_t loc_id = LLDB_INVALID_BREAK_ID;
if (input.empty())
- return llvm::None;
+ return std::nullopt;
// If it doesn't start with an integer, it's not valid.
if (input.consumeInteger(0, bp_id))
- return llvm::None;
+ return std::nullopt;
// period is optional, but if it exists, it must be followed by a number.
if (input.consume_front(".")) {
if (input.consumeInteger(0, loc_id))
- return llvm::None;
+ return std::nullopt;
}
// And at the end, the entire string must have been consumed.
if (!input.empty())
- return llvm::None;
+ return std::nullopt;
return BreakpointID(bp_id, loc_id);
}
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
index 9e1fbcb70dc19..59335951ecf84 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp
@@ -210,7 +210,7 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
return a;
}
}
- return llvm::None;
+ return std::nullopt;
};
FileSpec request_file = m_location_spec.GetFileSpec();
diff --git a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
index 4a11d82ecc6e9..cb3ee5fb74277 100644
--- a/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverFileRegex.cpp
@@ -109,7 +109,7 @@ Searcher::CallbackReturn BreakpointResolverFileRegex::SearchCallback(
SymbolContextList sc_list;
// TODO: Handle SourceLocationSpec column information
SourceLocationSpec location_spec(cu_file_spec, line_matches[i],
- /*column=*/llvm::None,
+ /*column=*/std::nullopt,
/*check_inlines=*/false, m_exact_match);
cu->ResolveSymbolContext(location_spec, eSymbolContextEverything, sc_list);
// Find all the function names:
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index be306f20881d2..b01e39f4ce3c8 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -374,7 +374,7 @@ CommandObjectExpression::GetEvalOptions(const Target &target) {
if (m_command_options.timeout > 0)
options.SetTimeout(std::chrono::microseconds(m_command_options.timeout));
else
- options.SetTimeout(llvm::None);
+ options.SetTimeout(std::nullopt);
return options;
}
@@ -540,7 +540,7 @@ GetExprOptions(ExecutionContext &ctx,
if (command_options.timeout > 0)
expr_options.SetTimeout(std::chrono::microseconds(command_options.timeout));
else
- expr_options.SetTimeout(llvm::None);
+ expr_options.SetTimeout(std::nullopt);
return expr_options;
}
diff --git a/lldb/source/Commands/CommandObjectMultiword.cpp b/lldb/source/Commands/CommandObjectMultiword.cpp
index e4fdb7365e72b..8a815e46ffd2f 100644
--- a/lldb/source/Commands/CommandObjectMultiword.cpp
+++ b/lldb/source/Commands/CommandObjectMultiword.cpp
@@ -295,11 +295,11 @@ CommandObjectMultiword::GetRepeatCommand(Args ¤t_command_args,
uint32_t index) {
index++;
if (current_command_args.GetArgumentCount() <= index)
- return llvm::None;
+ return std::nullopt;
CommandObject *sub_command_object =
GetSubcommandObject(current_command_args[index].ref());
if (sub_command_object == nullptr)
- return llvm::None;
+ return std::nullopt;
return sub_command_object->GetRepeatCommand(current_command_args, index);
}
@@ -426,7 +426,7 @@ CommandObjectProxy::GetRepeatCommand(Args ¤t_command_args,
CommandObject *proxy_command = GetProxyCommandObject();
if (proxy_command)
return proxy_command->GetRepeatCommand(current_command_args, index);
- return llvm::None;
+ return std::nullopt;
}
llvm::StringRef CommandObjectProxy::GetUnsupportedError() {
diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp
index 5e817635bbe6b..47ae5968748c9 100644
--- a/lldb/source/Commands/CommandObjectThread.cpp
+++ b/lldb/source/Commands/CommandObjectThread.cpp
@@ -147,21 +147,21 @@ class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
if (arg_string.equals("-c") || count_opt.startswith(arg_string)) {
idx++;
if (idx == num_entries)
- return llvm::None;
+ return std::nullopt;
count_idx = idx;
if (copy_args[idx].ref().getAsInteger(0, count_val))
- return llvm::None;
+ return std::nullopt;
} else if (arg_string.equals("-s") || start_opt.startswith(arg_string)) {
idx++;
if (idx == num_entries)
- return llvm::None;
+ return std::nullopt;
start_idx = idx;
if (copy_args[idx].ref().getAsInteger(0, start_val))
- return llvm::None;
+ return std::nullopt;
}
}
if (count_idx == 0)
- return llvm::None;
+ return std::nullopt;
std::string new_start_val = llvm::formatv("{0}", start_val + count_val);
if (start_idx == 0) {
@@ -172,7 +172,7 @@ class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads {
}
std::string repeat_command;
if (!copy_args.GetQuotedCommandString(repeat_command))
- return llvm::None;
+ return std::nullopt;
return repeat_command;
}
@@ -2149,7 +2149,7 @@ class CommandObjectTraceDumpFunctionCalls : public CommandObjectParsed {
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_dumper_options = {};
- m_output_file = llvm::None;
+ m_output_file = std::nullopt;
}
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
@@ -2321,7 +2321,7 @@ class CommandObjectTraceDumpInstructions : public CommandObjectParsed {
void OptionParsingStarting(ExecutionContext *execution_context) override {
m_count = kDefaultCount;
m_continue = false;
- m_output_file = llvm::None;
+ m_output_file = std::nullopt;
m_dumper_options = {};
}
diff --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index f87a171daca67..29f780092978c 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -1083,7 +1083,7 @@ class CommandObjectWatchpointSetExpression : public CommandObjectRaw {
options.SetUnwindOnError(true);
options.SetKeepInMemory(false);
options.SetTryAllThreads(true);
- options.SetTimeout(llvm::None);
+ options.SetTimeout(std::nullopt);
ExpressionResults expr_result =
target->EvaluateExpression(expr, frame, valobj_sp, options);
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index 8afd215a1a91c..b3d3f7e6a9ffe 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -1732,7 +1732,7 @@ lldb::thread_result_t Debugger::DefaultEventHandler() {
bool done = false;
while (!done) {
EventSP event_sp;
- if (listener_sp->GetEvent(event_sp, llvm::None)) {
+ if (listener_sp->GetEvent(event_sp, std::nullopt)) {
if (event_sp) {
Broadcaster *broadcaster = event_sp->GetBroadcaster();
if (broadcaster) {
@@ -1827,7 +1827,7 @@ bool Debugger::StartEventHandlerThread() {
// event, we just need to wait an infinite amount of time for it (nullptr
// timeout as the first parameter)
lldb::EventSP event_sp;
- listener_sp->GetEvent(event_sp, llvm::None);
+ listener_sp->GetEvent(event_sp, std::nullopt);
}
return m_event_handler_thread.IsJoinable();
}
diff --git a/lldb/source/Core/DumpDataExtractor.cpp b/lldb/source/Core/DumpDataExtractor.cpp
index ec98d6266241e..85b0dd2d943a6 100644
--- a/lldb/source/Core/DumpDataExtractor.cpp
+++ b/lldb/source/Core/DumpDataExtractor.cpp
@@ -54,7 +54,7 @@ static llvm::Optional<llvm::APInt> GetAPInt(const DataExtractor &data,
lldb::offset_t *offset_ptr,
lldb::offset_t byte_size) {
if (byte_size == 0)
- return llvm::None;
+ return std::nullopt;
llvm::SmallVector<uint64_t, 2> uint64_array;
lldb::offset_t bytes_left = byte_size;
@@ -92,7 +92,7 @@ static llvm::Optional<llvm::APInt> GetAPInt(const DataExtractor &data,
*offset_ptr += byte_size;
return llvm::APInt(byte_size * 8, llvm::ArrayRef<uint64_t>(uint64_array));
}
- return llvm::None;
+ return std::nullopt;
}
static lldb::offset_t DumpAPInt(Stream *s, const DataExtractor &data,
@@ -244,21 +244,21 @@ GetMemoryTags(lldb::addr_t addr, size_t length,
assert(addr != LLDB_INVALID_ADDRESS);
if (!exe_scope)
- return llvm::None;
+ return std::nullopt;
TargetSP target_sp = exe_scope->CalculateTarget();
if (!target_sp)
- return llvm::None;
+ return std::nullopt;
ProcessSP process_sp = target_sp->CalculateProcess();
if (!process_sp)
- return llvm::None;
+ return std::nullopt;
llvm::Expected<const MemoryTagManager *> tag_manager_or_err =
process_sp->GetMemoryTagManager();
if (!tag_manager_or_err) {
llvm::consumeError(tag_manager_or_err.takeError());
- return llvm::None;
+ return std::nullopt;
}
MemoryRegionInfos memory_regions;
@@ -272,10 +272,10 @@ GetMemoryTags(lldb::addr_t addr, size_t length,
// for an error.
if (!tagged_ranges_or_err) {
llvm::consumeError(tagged_ranges_or_err.takeError());
- return llvm::None;
+ return std::nullopt;
}
if (tagged_ranges_or_err->empty())
- return llvm::None;
+ return std::nullopt;
MemoryTagMap memory_tag_map(*tag_manager_or_err);
for (const MemoryTagManager::TagRange &range : *tagged_ranges_or_err) {
@@ -289,7 +289,7 @@ GetMemoryTags(lldb::addr_t addr, size_t length,
}
if (memory_tag_map.Empty())
- return llvm::None;
+ return std::nullopt;
return memory_tag_map;
}
diff --git a/lldb/source/Core/IOHandler.cpp b/lldb/source/Core/IOHandler.cpp
index 9d8c6aadcc996..597c423b01a7c 100644
--- a/lldb/source/Core/IOHandler.cpp
+++ b/lldb/source/Core/IOHandler.cpp
@@ -330,7 +330,7 @@ void IOHandlerEditline::TerminalSizeChanged() {
static Optional<std::string> SplitLine(std::string &line_buffer) {
size_t pos = line_buffer.find('\n');
if (pos == std::string::npos)
- return None;
+ return std::nullopt;
std::string line =
std::string(StringRef(line_buffer.c_str(), pos).rtrim("\n\r"));
line_buffer = line_buffer.substr(pos + 1);
@@ -341,7 +341,7 @@ static Optional<std::string> SplitLine(std::string &line_buffer) {
// it as a line anyway.
static Optional<std::string> SplitLineEOF(std::string &line_buffer) {
if (llvm::all_of(line_buffer, llvm::isSpace))
- return None;
+ return std::nullopt;
std::string line = std::move(line_buffer);
line_buffer.clear();
return line;
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 63b79b3b71d88..4060e04e96632 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -596,7 +596,7 @@ uint32_t Module::ResolveSymbolContextsForFileSpec(
if (SymbolFile *symbols = GetSymbolFile()) {
// TODO: Handle SourceLocationSpec column information
- SourceLocationSpec location_spec(file_spec, line, /*column=*/llvm::None,
+ SourceLocationSpec location_spec(file_spec, line, /*column=*/std::nullopt,
check_inlines, /*exact_match=*/false);
symbols->ResolveSymbolContext(location_spec, resolve_scope, sc_list);
@@ -937,7 +937,7 @@ void Module::FindAddressesForLine(const lldb::TargetSP target_sp,
SearchFilterByModule filter(target_sp, m_file);
// TODO: Handle SourceLocationSpec column information
- SourceLocationSpec location_spec(file, line, /*column=*/llvm::None,
+ SourceLocationSpec location_spec(file, line, /*column=*/std::nullopt,
/*check_inlines=*/true,
/*exact_match=*/false);
AddressResolverFileLine resolver(location_spec);
diff --git a/lldb/source/Core/SourceLocationSpec.cpp b/lldb/source/Core/SourceLocationSpec.cpp
index c83d2d89370d5..b132d98c50277 100644
--- a/lldb/source/Core/SourceLocationSpec.cpp
+++ b/lldb/source/Core/SourceLocationSpec.cpp
@@ -69,13 +69,13 @@ std::string SourceLocationSpec::GetString() const {
llvm::Optional<uint32_t> SourceLocationSpec::GetLine() const {
uint32_t line = m_declaration.GetLine();
if (line == 0 || line == LLDB_INVALID_LINE_NUMBER)
- return llvm::None;
+ return std::nullopt;
return line;
}
llvm::Optional<uint16_t> SourceLocationSpec::GetColumn() const {
uint16_t column = m_declaration.GetColumn();
if (column == LLDB_INVALID_COLUMN_NUMBER)
- return llvm::None;
+ return std::nullopt;
return column;
}
diff --git a/lldb/source/Core/ThreadedCommunication.cpp b/lldb/source/Core/ThreadedCommunication.cpp
index bc4c6e0214ef2..0ce97586f09f9 100644
--- a/lldb/source/Core/ThreadedCommunication.cpp
+++ b/lldb/source/Core/ThreadedCommunication.cpp
@@ -362,7 +362,7 @@ void ThreadedCommunication::SynchronizeWithReadThread() {
// Wait for the synchronization event.
EventSP event_sp;
- listener_sp->GetEvent(event_sp, llvm::None);
+ listener_sp->GetEvent(event_sp, std::nullopt);
}
void ThreadedCommunication::SetConnection(
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 6b710084faf74..16114db6089d3 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -704,7 +704,7 @@ class LoadAddressResolver {
llvm::Optional<lldb::addr_t> Resolve(SymbolContextList &sc_list) {
if (sc_list.IsEmpty())
- return llvm::None;
+ return std::nullopt;
lldb::addr_t load_address = LLDB_INVALID_ADDRESS;
@@ -758,7 +758,7 @@ class LoadAddressResolver {
if (m_symbol_was_missing_weak)
return 0;
- return llvm::None;
+ return std::nullopt;
}
lldb::addr_t GetBestInternalLoadAddress() const {
diff --git a/lldb/source/Host/common/Editline.cpp b/lldb/source/Host/common/Editline.cpp
index c46e69d9be7ff..608c5253d4662 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -582,12 +582,12 @@ int Editline::GetCharacter(EditLineGetCharType *c) {
// interrupted.
m_output_mutex.unlock();
int read_count =
- m_input_connection.Read(&ch, 1, llvm::None, status, nullptr);
+ m_input_connection.Read(&ch, 1, std::nullopt, status, nullptr);
m_output_mutex.lock();
if (m_editor_status == EditorStatus::Interrupted) {
while (read_count > 0 && status == lldb::eConnectionStatusSuccess)
read_count =
- m_input_connection.Read(&ch, 1, llvm::None, status, nullptr);
+ m_input_connection.Read(&ch, 1, std::nullopt, status, nullptr);
lldbassert(status == lldb::eConnectionStatusInterrupted);
return 0;
}
diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp
index ce5283a613755..5c69373db22c8 100644
--- a/lldb/source/Host/common/File.cpp
+++ b/lldb/source/Host/common/File.cpp
@@ -783,7 +783,7 @@ SerialPort::OptionsFromURL(llvm::StringRef urlqs) {
.Case("odd", Terminal::Parity::Odd)
.Case("mark", Terminal::Parity::Mark)
.Case("space", Terminal::Parity::Space)
- .Default(llvm::None);
+ .Default(std::nullopt);
if (!serial_options.Parity)
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
@@ -798,7 +798,7 @@ SerialPort::OptionsFromURL(llvm::StringRef urlqs) {
// "mark" mode is not currently supported as it requires special
// input processing
// .Case("mark", Terminal::ParityCheck::Mark)
- .Default(llvm::None);
+ .Default(std::nullopt);
if (!serial_options.ParityCheck)
return llvm::createStringError(
llvm::inconvertibleErrorCode(),
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index 9a7b77c19de1d..18fb3814c891a 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -113,7 +113,7 @@ HostInfoBase::ParseArchitectureKind(llvm::StringRef kind) {
.Case(LLDB_ARCH_DEFAULT, eArchKindDefault)
.Case(LLDB_ARCH_DEFAULT_32BIT, eArchKind32)
.Case(LLDB_ARCH_DEFAULT_64BIT, eArchKind64)
- .Default(llvm::None);
+ .Default(std::nullopt);
}
FileSpec HostInfoBase::GetShlibDir() {
diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp
index 21f382da2f229..ef8475a8732aa 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -70,7 +70,7 @@ llvm::Optional<WaitStatus> NativeProcessProtocol::GetExitStatus() {
if (m_state == lldb::eStateExited)
return m_exit_status;
- return llvm::None;
+ return std::nullopt;
}
bool NativeProcessProtocol::SetExitStatus(WaitStatus status,
@@ -136,7 +136,7 @@ NativeProcessProtocol::GetHardwareDebugSupportInfo() const {
const_cast<NativeProcessProtocol *>(this)->GetThreadAtIndex(0));
if (!thread) {
LLDB_LOG(log, "failed to find a thread to grab a NativeRegisterContext!");
- return llvm::None;
+ return std::nullopt;
}
NativeRegisterContext ®_ctx = thread->GetRegisterContext();
@@ -245,7 +245,7 @@ Status NativeProcessProtocol::SetHardwareBreakpoint(lldb::addr_t addr,
// Exit here if target does not have required hardware breakpoint capability.
auto hw_debug_cap = GetHardwareDebugSupportInfo();
- if (hw_debug_cap == llvm::None || hw_debug_cap->first == 0 ||
+ if (hw_debug_cap == std::nullopt || hw_debug_cap->first == 0 ||
hw_debug_cap->first <= m_hw_breakpoints_map.size())
return Status("Target does not have required no of hardware breakpoints");
diff --git a/lldb/source/Host/common/Terminal.cpp b/lldb/source/Host/common/Terminal.cpp
index 5da5ee8f14683..5a6fca95987bf 100644
--- a/lldb/source/Host/common/Terminal.cpp
+++ b/lldb/source/Host/common/Terminal.cpp
@@ -264,7 +264,7 @@ static llvm::Optional<speed_t> baudRateToConst(unsigned int baud_rate) {
return B4000000;
#endif
default:
- return llvm::None;
+ return std::nullopt;
}
}
#endif
diff --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index 2196b8ed5a3f1..2f8b9c94e4190 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -324,6 +324,6 @@ llvm::Optional<lldb::pid_t> lldb_private::getPIDForTID(lldb::pid_t tid) {
if (!GetStatusInfo(tid, process_info, state, tracerpid, tgid) ||
tgid == LLDB_INVALID_PROCESS_ID)
- return llvm::None;
+ return std::nullopt;
return tgid;
}
diff --git a/lldb/source/Host/linux/HostInfoLinux.cpp b/lldb/source/Host/linux/HostInfoLinux.cpp
index 837b103a64b07..e7a136c7c4d5d 100644
--- a/lldb/source/Host/linux/HostInfoLinux.cpp
+++ b/lldb/source/Host/linux/HostInfoLinux.cpp
@@ -71,7 +71,7 @@ llvm::Optional<std::string> HostInfoLinux::GetOSBuildString() {
::memset(&un, 0, sizeof(utsname));
if (uname(&un) < 0)
- return llvm::None;
+ return std::nullopt;
return std::string(un.release);
}
diff --git a/lldb/source/Host/posix/HostInfoPosix.cpp b/lldb/source/Host/posix/HostInfoPosix.cpp
index 8718e90b3241c..e11463041669f 100644
--- a/lldb/source/Host/posix/HostInfoPosix.cpp
+++ b/lldb/source/Host/posix/HostInfoPosix.cpp
@@ -41,7 +41,7 @@ bool HostInfoPosix::GetHostname(std::string &s) {
llvm::Optional<std::string> HostInfoPosix::GetOSKernelDescription() {
struct utsname un;
if (uname(&un) < 0)
- return llvm::None;
+ return std::nullopt;
return std::string(un.version);
}
@@ -85,13 +85,13 @@ static llvm::Optional<PasswdEntry> GetPassword(id_t uid) {
return PasswdEntry{user_info_ptr->pw_name, user_info_ptr->pw_shell};
}
#endif
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<std::string> PosixUserIDResolver::DoGetUserName(id_t uid) {
if (llvm::Optional<PasswdEntry> password = GetPassword(uid))
return password->username;
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<std::string> PosixUserIDResolver::DoGetGroupName(id_t gid) {
@@ -113,7 +113,7 @@ llvm::Optional<std::string> PosixUserIDResolver::DoGetGroupName(id_t gid) {
return std::string(group_info_ptr->gr_name);
}
#endif
- return llvm::None;
+ return std::nullopt;
}
static llvm::ManagedStatic<PosixUserIDResolver> g_user_id_resolver;
diff --git a/lldb/source/Interpreter/CommandHistory.cpp b/lldb/source/Interpreter/CommandHistory.cpp
index 8f399840b8023..425939fb20924 100644
--- a/lldb/source/Interpreter/CommandHistory.cpp
+++ b/lldb/source/Interpreter/CommandHistory.cpp
@@ -27,14 +27,14 @@ llvm::Optional<llvm::StringRef>
CommandHistory::FindString(llvm::StringRef input_str) const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (input_str.size() < 2)
- return llvm::None;
+ return std::nullopt;
if (input_str[0] != g_repeat_char)
- return llvm::None;
+ return std::nullopt;
if (input_str[1] == g_repeat_char) {
if (m_history.empty())
- return llvm::None;
+ return std::nullopt;
return llvm::StringRef(m_history.back());
}
@@ -43,15 +43,15 @@ CommandHistory::FindString(llvm::StringRef input_str) const {
size_t idx = 0;
if (input_str.front() == '-') {
if (input_str.drop_front(1).getAsInteger(0, idx))
- return llvm::None;
+ return std::nullopt;
if (idx >= m_history.size())
- return llvm::None;
+ return std::nullopt;
idx = m_history.size() - idx;
} else {
if (input_str.getAsInteger(0, idx))
- return llvm::None;
+ return std::nullopt;
if (idx >= m_history.size())
- return llvm::None;
+ return std::nullopt;
}
return llvm::StringRef(m_history[idx]);
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index ac7bd4bf1fca8..180ff9cb9ed5c 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -1764,7 +1764,7 @@ Status CommandInterpreter::PreprocessCommand(std::string &command) {
options.SetIgnoreBreakpoints(true);
options.SetKeepInMemory(false);
options.SetTryAllThreads(true);
- options.SetTimeout(llvm::None);
+ options.SetTimeout(std::nullopt);
ExpressionResults expr_result =
target.EvaluateExpression(expr_str.c_str(), exe_ctx.GetFramePtr(),
@@ -2113,14 +2113,14 @@ void CommandInterpreter::HandleCompletion(CompletionRequest &request) {
llvm::Optional<std::string>
CommandInterpreter::GetAutoSuggestionForCommand(llvm::StringRef line) {
if (line.empty())
- return llvm::None;
+ return std::nullopt;
const size_t s = m_command_history.GetSize();
for (int i = s - 1; i >= 0; --i) {
llvm::StringRef entry = m_command_history.GetStringAtIndex(i);
if (entry.consume_front(line))
return entry.str();
}
- return llvm::None;
+ return std::nullopt;
}
void CommandInterpreter::UpdatePrompt(llvm::StringRef new_prompt) {
@@ -3192,7 +3192,7 @@ bool CommandInterpreter::IOHandlerInterrupt(IOHandler &io_handler) {
bool CommandInterpreter::SaveTranscript(
CommandReturnObject &result, llvm::Optional<std::string> output_file) {
- if (output_file == llvm::None || output_file->empty()) {
+ if (output_file == std::nullopt || output_file->empty()) {
std::string now = llvm::to_string(std::chrono::system_clock::now());
std::replace(now.begin(), now.end(), ' ', '_');
const std::string file_name = "lldb_session_" + now + ".log";
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp
index bc8a542afc879..0820755545622 100644
--- a/lldb/source/Interpreter/ScriptInterpreter.cpp
+++ b/lldb/source/Interpreter/ScriptInterpreter.cpp
@@ -91,7 +91,7 @@ llvm::Optional<MemoryRegionInfo>
ScriptInterpreter::GetOpaqueTypeFromSBMemoryRegionInfo(
const lldb::SBMemoryRegionInfo &mem_region) const {
if (!mem_region.m_opaque_up)
- return llvm::None;
+ return std::nullopt;
return *mem_region.m_opaque_up.get();
}
diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
index b4cdfec25113f..b49738623f48f 100644
--- a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -266,7 +266,7 @@ InstructionLengthDecode(const uint8_t *inst_bytes, int bytes_len,
// in `src/pt_ild.c`
while (!prefix_done) {
if (op_idx >= bytes_len)
- return llvm::None;
+ return std::nullopt;
ret.primary_opcode = inst_bytes[op_idx];
switch (ret.primary_opcode) {
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
index 84ce21f5ddd1e..2386946161dc8 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -921,9 +921,9 @@ class CodeComplete : public CodeCompleteConsumer {
// We also filter some internal lldb identifiers here. The user
// shouldn't see these.
if (llvm::StringRef(ToInsert).startswith("$__lldb_"))
- return llvm::None;
+ return std::nullopt;
if (ToInsert.empty())
- return llvm::None;
+ return std::nullopt;
// Merge the suggested Token into the existing command line to comply
// with the kind of result the lldb API expects.
std::string CompletionSuggestion =
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
index 93a33edfae956..5f7bb1262f8cf 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
@@ -74,14 +74,14 @@ ClangPersistentVariables::GetCompilerTypeFromPersistentDecl(
PersistentDecl p = m_persistent_decls.lookup(type_name.GetCString());
if (p.m_decl == nullptr)
- return llvm::None;
+ return std::nullopt;
if (clang::TypeDecl *tdecl = llvm::dyn_cast<clang::TypeDecl>(p.m_decl)) {
opaque_compiler_type_t t = static_cast<opaque_compiler_type_t>(
const_cast<clang::Type *>(tdecl->getTypeForDecl()));
return CompilerType(p.m_context, t);
}
- return llvm::None;
+ return std::nullopt;
}
void ClangPersistentVariables::RegisterPersistentDecl(ConstString name,
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
index 245f307d40075..65ad74862467a 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp
@@ -50,10 +50,10 @@ getTargetIncludePaths(const llvm::Triple &triple) {
static llvm::Optional<llvm::StringRef>
guessIncludePath(llvm::StringRef path_to_file, llvm::StringRef pattern) {
if (pattern.empty())
- return llvm::None;
+ return std::nullopt;
size_t pos = path_to_file.find(pattern);
if (pos == llvm::StringRef::npos)
- return llvm::None;
+ return std::nullopt;
return path_to_file.substr(0, pos + pattern.size());
}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
index 9453cdc3a4512..199cef5592bf1 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
@@ -186,21 +186,21 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
// If we don't have a template to instiantiate, then there is nothing to do.
auto td = dyn_cast<ClassTemplateSpecializationDecl>(d);
if (!td)
- return llvm::None;
+ return std::nullopt;
// We only care about templates in the std namespace.
if (!td->getDeclContext()->isStdNamespace())
- return llvm::None;
+ return std::nullopt;
// We have a list of supported template names.
if (!m_supported_templates.contains(td->getName()))
- return llvm::None;
+ return std::nullopt;
// Early check if we even support instantiating this template. We do this
// before we import anything into the target AST.
auto &foreign_args = td->getTemplateInstantiationArgs();
if (!templateArgsAreSupported(foreign_args.asArray()))
- return llvm::None;
+ return std::nullopt;
// Find the local DeclContext that corresponds to the DeclContext of our
// decl we want to import.
@@ -211,7 +211,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
"Got error while searching equal local DeclContext for decl "
"'{1}':\n{0}",
td->getName());
- return llvm::None;
+ return std::nullopt;
}
// Look up the template in our local context.
@@ -224,7 +224,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
break;
}
if (!new_class_template)
- return llvm::None;
+ return std::nullopt;
// Import the foreign template arguments.
llvm::SmallVector<TemplateArgument, 4> imported_args;
@@ -236,7 +236,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
llvm::Expected<QualType> type = m_importer->Import(arg.getAsType());
if (!type) {
LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}");
- return llvm::None;
+ return std::nullopt;
}
imported_args.push_back(TemplateArgument(*type));
break;
@@ -247,7 +247,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
m_importer->Import(arg.getIntegralType());
if (!type) {
LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}");
- return llvm::None;
+ return std::nullopt;
}
imported_args.push_back(
TemplateArgument(d->getASTContext(), integral, *type));
diff --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
index 7c29bce147715..862c8f57b7ab4 100644
--- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
+++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp
@@ -39,7 +39,7 @@ static llvm::Optional<std::tuple<Ts...>> zipOpt(llvm::Optional<Ts> &&...ts) {
return llvm::Optional<std::tuple<Ts...>>(
std::make_tuple(std::move(*ts)...));
else
- return llvm::None;
+ return std::nullopt;
}
// The funct3 is the type of compare in B<CMP> instructions.
@@ -134,7 +134,7 @@ llvm::Optional<uint64_t> Rs::Read(EmulateInstructionRISCV &emulator) {
RegisterValue value;
return emulator.ReadRegister(eRegisterKindLLDB, lldbReg, value)
? llvm::Optional<uint64_t>(value.GetAsUInt64())
- : llvm::None;
+ : std::nullopt;
}
llvm::Optional<int32_t> Rs::ReadI32(EmulateInstructionRISCV &emulator) {
@@ -157,7 +157,7 @@ llvm::Optional<llvm::APFloat> Rs::ReadAPFloat(EmulateInstructionRISCV &emulator,
uint32_t lldbReg = FPREncodingToLLDB(rs);
RegisterValue value;
if (!emulator.ReadRegister(eRegisterKindLLDB, lldbReg, value))
- return llvm::None;
+ return std::nullopt;
uint64_t bits = value.GetAsUInt64();
llvm::APInt api(64, bits, false);
return llvm::APFloat(isDouble ? llvm::APFloat(api.bitsToDouble())
@@ -251,9 +251,9 @@ static std::enable_if_t<is_amo_add<I> || is_amo_bit_op<I> || is_amo_swap<I> ||
AtomicAddr(EmulateInstructionRISCV &emulator, I inst, unsigned int align) {
return inst.rs1.Read(emulator)
.transform([&](uint64_t rs1) {
- return rs1 % align == 0 ? llvm::Optional<uint64_t>(rs1) : llvm::None;
+ return rs1 % align == 0 ? llvm::Optional<uint64_t>(rs1) : std::nullopt;
})
- .value_or(llvm::None);
+ .value_or(std::nullopt);
}
template <typename I, typename T>
@@ -575,7 +575,7 @@ llvm::Optional<DecodeResult> EmulateInstructionRISCV::Decode(uint32_t inst) {
}
LLDB_LOGF(log, "EmulateInstructionRISCV::%s: inst(0x%x) was unsupported",
__FUNCTION__, inst);
- return llvm::None;
+ return std::nullopt;
}
class Executor {
@@ -1467,7 +1467,7 @@ llvm::Optional<DecodeResult>
EmulateInstructionRISCV::ReadInstructionAt(lldb::addr_t addr) {
return ReadMem<uint32_t>(addr)
.transform([&](uint32_t inst) { return Decode(inst); })
- .value_or(llvm::None);
+ .value_or(std::nullopt);
}
bool EmulateInstructionRISCV::ReadInstruction() {
@@ -1490,7 +1490,7 @@ llvm::Optional<lldb::addr_t> EmulateInstructionRISCV::ReadPC() {
bool success = false;
auto addr = ReadRegisterUnsigned(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC,
LLDB_INVALID_ADDRESS, &success);
- return success ? llvm::Optional<lldb::addr_t>(addr) : llvm::None;
+ return success ? llvm::Optional<lldb::addr_t>(addr) : std::nullopt;
}
bool EmulateInstructionRISCV::WritePC(lldb::addr_t pc) {
diff --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
index 70d8652f40cff..419e1d7c5e4f4 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
@@ -23,7 +23,7 @@ namespace tok = clang::tok;
Optional<ParsedFunction> CPlusPlusNameParser::ParseAsFunctionDefinition() {
m_next_token_index = 0;
- Optional<ParsedFunction> result(None);
+ Optional<ParsedFunction> result(std::nullopt);
// Try to parse the name as function without a return type specified e.g.
// main(int, char*[])
@@ -44,7 +44,7 @@ Optional<ParsedFunction> CPlusPlusNameParser::ParseAsFunctionDefinition() {
// e.g. int main(int, char*[])
result = ParseFunctionImpl(true);
if (HasMoreTokens())
- return None;
+ return std::nullopt;
return result;
}
@@ -52,9 +52,9 @@ Optional<ParsedName> CPlusPlusNameParser::ParseAsFullName() {
m_next_token_index = 0;
Optional<ParsedNameRanges> name_ranges = ParseFullNameImpl();
if (!name_ranges)
- return None;
+ return std::nullopt;
if (HasMoreTokens())
- return None;
+ return std::nullopt;
ParsedName result;
result.basename = GetTextForRange(name_ranges.value().basename_range);
result.context = GetTextForRange(name_ranges.value().context_range);
@@ -111,7 +111,7 @@ CPlusPlusNameParser::ParseFunctionImpl(bool expect_return_type) {
size_t return_start = GetCurrentPosition();
// Consume return type if it's expected.
if (!ConsumeToken(tok::kw_auto) && !ConsumeTypename())
- return None;
+ return std::nullopt;
size_t return_end = GetCurrentPosition();
result.return_type = GetTextForRange(Range(return_start, return_end));
@@ -119,12 +119,12 @@ CPlusPlusNameParser::ParseFunctionImpl(bool expect_return_type) {
auto maybe_name = ParseFullNameImpl();
if (!maybe_name) {
- return None;
+ return std::nullopt;
}
size_t argument_start = GetCurrentPosition();
if (!ConsumeArguments()) {
- return None;
+ return std::nullopt;
}
size_t qualifiers_start = GetCurrentPosition();
@@ -155,7 +155,7 @@ CPlusPlusNameParser::ParseFuncPtr(bool expect_return_type) {
if (expect_return_type) {
// Consume return type.
if (!ConsumeTypename())
- return None;
+ return std::nullopt;
}
// Step 2:
@@ -165,9 +165,9 @@ CPlusPlusNameParser::ParseFuncPtr(bool expect_return_type) {
// Leaves us with:
// (*func(long))(int))(float)
if (!ConsumeToken(tok::l_paren))
- return None;
+ return std::nullopt;
if (!ConsumePtrsAndRefs())
- return None;
+ return std::nullopt;
// Step 3:
//
@@ -214,7 +214,7 @@ CPlusPlusNameParser::ParseFuncPtr(bool expect_return_type) {
return maybe_inner_function_ptr_name;
}
- return None;
+ return std::nullopt;
}
bool CPlusPlusNameParser::ConsumeArguments() {
@@ -721,7 +721,7 @@ CPlusPlusNameParser::ParseFullNameImpl() {
start_position.Remove();
return result;
} else {
- return None;
+ return std::nullopt;
}
}
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
index e2c3c17a946d8..fcc68c87ace4c 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp
@@ -423,18 +423,18 @@ ObjCLanguageRuntime::GetRuntimeType(CompilerType base_type) {
else if (TypeSystemClang::IsObjCObjectOrInterfaceType(base_type))
class_type = base_type;
else
- return llvm::None;
+ return std::nullopt;
if (!class_type)
- return llvm::None;
+ return std::nullopt;
ConstString class_name(class_type.GetTypeName());
if (!class_name)
- return llvm::None;
+ return std::nullopt;
TypeSP complete_objc_class_type_sp = LookupInCompleteClassCache(class_name);
if (!complete_objc_class_type_sp)
- return llvm::None;
+ return std::nullopt;
CompilerType complete_class(
complete_objc_class_type_sp->GetFullCompilerType());
@@ -445,5 +445,5 @@ ObjCLanguageRuntime::GetRuntimeType(CompilerType base_type) {
return complete_class;
}
- return llvm::None;
+ return std::nullopt;
}
diff --git a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
index 22f3e41aaac40..30a0ed58cbe9e 100644
--- a/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
+++ b/lldb/source/Plugins/ObjectContainer/Mach-O-Fileset/ObjectContainerMachOFileset.cpp
@@ -135,7 +135,7 @@ static llvm::Optional<mach_header> ParseMachOHeader(DataExtractor &data) {
static bool
ParseFileset(DataExtractor &data, mach_header header,
std::vector<ObjectContainerMachOFileset::Entry> &entries,
- llvm::Optional<lldb::addr_t> load_addr = llvm::None) {
+ llvm::Optional<lldb::addr_t> load_addr = std::nullopt) {
lldb::offset_t offset = MachHeaderSizeFromMagic(header.magic);
lldb::offset_t slide = 0;
for (uint32_t i = 0; i < header.ncmds; ++i) {
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
index 0c1b36514d266..e747c1537a05a 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp
@@ -147,7 +147,7 @@ llvm::Optional<Record::Kind> Record::classify(llvm::StringRef Line) {
case Token::Win:
return Record::StackWin;
default:
- return llvm::None;
+ return std::nullopt;
}
case Token::Inline:
return Record::Inline;
@@ -164,7 +164,7 @@ llvm::Optional<Record::Kind> Record::classify(llvm::StringRef Line) {
case Token::Init:
case Token::Win:
// These should never appear at the start of a valid record.
- return llvm::None;
+ return std::nullopt;
}
llvm_unreachable("Fully covered switch above!");
}
@@ -172,21 +172,21 @@ llvm::Optional<Record::Kind> Record::classify(llvm::StringRef Line) {
llvm::Optional<ModuleRecord> ModuleRecord::parse(llvm::StringRef Line) {
// MODULE Linux x86_64 E5894855C35DCCCCCCCCCCCCCCCCCCCC0 a.out
if (consume<Token>(Line) != Token::Module)
- return llvm::None;
+ return std::nullopt;
llvm::Triple::OSType OS = consume<llvm::Triple::OSType>(Line);
if (OS == llvm::Triple::UnknownOS)
- return llvm::None;
+ return std::nullopt;
llvm::Triple::ArchType Arch = consume<llvm::Triple::ArchType>(Line);
if (Arch == llvm::Triple::UnknownArch)
- return llvm::None;
+ return std::nullopt;
llvm::StringRef Str;
std::tie(Str, Line) = getToken(Line);
UUID ID = parseModuleId(OS, Str);
if (!ID)
- return llvm::None;
+ return std::nullopt;
return ModuleRecord(OS, Arch, std::move(ID));
}
@@ -201,10 +201,10 @@ llvm::raw_ostream &breakpad::operator<<(llvm::raw_ostream &OS,
llvm::Optional<InfoRecord> InfoRecord::parse(llvm::StringRef Line) {
// INFO CODE_ID 554889E55DC3CCCCCCCCCCCCCCCCCCCC [a.exe]
if (consume<Token>(Line) != Token::Info)
- return llvm::None;
+ return std::nullopt;
if (consume<Token>(Line) != Token::CodeID)
- return llvm::None;
+ return std::nullopt;
llvm::StringRef Str;
std::tie(Str, Line) = getToken(Line);
@@ -213,7 +213,7 @@ llvm::Optional<InfoRecord> InfoRecord::parse(llvm::StringRef Line) {
UUID ID;
if (Line.trim().empty()) {
if (Str.empty() || !ID.SetFromStringRef(Str))
- return llvm::None;
+ return std::nullopt;
}
return InfoRecord(std::move(ID));
}
@@ -228,17 +228,17 @@ static llvm::Optional<T> parseNumberName(llvm::StringRef Line,
Token TokenType) {
// TOKEN number name
if (consume<Token>(Line) != TokenType)
- return llvm::None;
+ return std::nullopt;
llvm::StringRef Str;
size_t Number;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, Number))
- return llvm::None;
+ return std::nullopt;
llvm::StringRef Name = Line.trim();
if (Name.empty())
- return llvm::None;
+ return std::nullopt;
return T(Number, Name);
}
@@ -310,7 +310,7 @@ llvm::Optional<FuncRecord> FuncRecord::parse(llvm::StringRef Line) {
if (parsePublicOrFunc(Line, Multiple, Address, &Size, ParamSize, Name))
return FuncRecord(Multiple, Address, Size, ParamSize, Name);
- return llvm::None;
+ return std::nullopt;
}
bool breakpad::operator==(const FuncRecord &L, const FuncRecord &R) {
@@ -328,12 +328,12 @@ llvm::Optional<InlineRecord> InlineRecord::parse(llvm::StringRef Line) {
// INLINE inline_nest_level call_site_line call_site_file_num origin_num
// [address size]+
if (consume<Token>(Line) != Token::Inline)
- return llvm::None;
+ return std::nullopt;
llvm::SmallVector<llvm::StringRef> Tokens;
SplitString(Line, Tokens, " ");
if (Tokens.size() < 6 || Tokens.size() % 2 == 1)
- return llvm::None;
+ return std::nullopt;
size_t InlineNestLevel;
uint32_t CallSiteLineNum;
@@ -343,17 +343,17 @@ llvm::Optional<InlineRecord> InlineRecord::parse(llvm::StringRef Line) {
to_integer(Tokens[1], CallSiteLineNum) &&
to_integer(Tokens[2], CallSiteFileNum) &&
to_integer(Tokens[3], OriginNum)))
- return llvm::None;
+ return std::nullopt;
InlineRecord Record = InlineRecord(InlineNestLevel, CallSiteLineNum,
CallSiteFileNum, OriginNum);
for (size_t i = 4; i < Tokens.size(); i += 2) {
lldb::addr_t Address;
if (!to_integer(Tokens[i], Address, 16))
- return llvm::None;
+ return std::nullopt;
lldb::addr_t Size;
if (!to_integer(Tokens[i + 1].trim(), Size, 16))
- return llvm::None;
+ return std::nullopt;
Record.Ranges.emplace_back(Address, Size);
}
return Record;
@@ -381,22 +381,22 @@ llvm::Optional<LineRecord> LineRecord::parse(llvm::StringRef Line) {
llvm::StringRef Str;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, Address, 16))
- return llvm::None;
+ return std::nullopt;
lldb::addr_t Size;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, Size, 16))
- return llvm::None;
+ return std::nullopt;
uint32_t LineNum;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, LineNum))
- return llvm::None;
+ return std::nullopt;
size_t FileNum;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, FileNum))
- return llvm::None;
+ return std::nullopt;
return LineRecord(Address, Size, LineNum, FileNum);
}
@@ -419,7 +419,7 @@ llvm::Optional<PublicRecord> PublicRecord::parse(llvm::StringRef Line) {
if (parsePublicOrFunc(Line, Multiple, Address, nullptr, ParamSize, Name))
return PublicRecord(Multiple, Address, ParamSize, Name);
- return llvm::None;
+ return std::nullopt;
}
bool breakpad::operator==(const PublicRecord &L, const PublicRecord &R) {
@@ -440,9 +440,9 @@ llvm::Optional<StackCFIRecord> StackCFIRecord::parse(llvm::StringRef Line) {
// No token in exprN ends with a colon.
if (consume<Token>(Line) != Token::Stack)
- return llvm::None;
+ return std::nullopt;
if (consume<Token>(Line) != Token::CFI)
- return llvm::None;
+ return std::nullopt;
llvm::StringRef Str;
std::tie(Str, Line) = getToken(Line);
@@ -453,14 +453,14 @@ llvm::Optional<StackCFIRecord> StackCFIRecord::parse(llvm::StringRef Line) {
lldb::addr_t Address;
if (!to_integer(Str, Address, 16))
- return llvm::None;
+ return std::nullopt;
llvm::Optional<lldb::addr_t> Size;
if (IsInitRecord) {
Size.emplace();
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, *Size, 16))
- return llvm::None;
+ return std::nullopt;
}
return StackCFIRecord(Address, Size, Line.trim());
@@ -488,26 +488,26 @@ llvm::Optional<StackWinRecord> StackWinRecord::parse(llvm::StringRef Line) {
// program_string_OR_allocates_base_pointer
if (consume<Token>(Line) != Token::Stack)
- return llvm::None;
+ return std::nullopt;
if (consume<Token>(Line) != Token::Win)
- return llvm::None;
+ return std::nullopt;
llvm::StringRef Str;
uint8_t Type;
std::tie(Str, Line) = getToken(Line);
// Right now we only support the "FrameData" frame type.
if (!to_integer(Str, Type) || FrameType(Type) != FrameType::FrameData)
- return llvm::None;
+ return std::nullopt;
lldb::addr_t RVA;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, RVA, 16))
- return llvm::None;
+ return std::nullopt;
lldb::addr_t CodeSize;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, CodeSize, 16))
- return llvm::None;
+ return std::nullopt;
// Skip fields which we aren't using right now.
std::tie(Str, Line) = getToken(Line); // prologue_size
@@ -516,27 +516,27 @@ llvm::Optional<StackWinRecord> StackWinRecord::parse(llvm::StringRef Line) {
lldb::addr_t ParameterSize;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, ParameterSize, 16))
- return llvm::None;
+ return std::nullopt;
lldb::addr_t SavedRegisterSize;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, SavedRegisterSize, 16))
- return llvm::None;
+ return std::nullopt;
lldb::addr_t LocalSize;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, LocalSize, 16))
- return llvm::None;
+ return std::nullopt;
std::tie(Str, Line) = getToken(Line); // max_stack_size
uint8_t HasProgramString;
std::tie(Str, Line) = getToken(Line);
if (!to_integer(Str, HasProgramString))
- return llvm::None;
+ return std::nullopt;
// FrameData records should always have a program string.
if (!HasProgramString)
- return llvm::None;
+ return std::nullopt;
return StackWinRecord(RVA, CodeSize, ParameterSize, SavedRegisterSize,
LocalSize, Line.trim());
diff --git a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
index c591a4a7534ca..3d2e2003c8edc 100644
--- a/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
+++ b/lldb/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp
@@ -31,7 +31,7 @@ llvm::Optional<Header> Header::parse(llvm::StringRef text) {
std::tie(line, text) = text.split('\n');
auto Module = ModuleRecord::parse(line);
if (!Module)
- return llvm::None;
+ return std::nullopt;
llvm::Triple triple;
triple.setArch(Module->Arch);
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index cf1b375001d62..fee30ecb6240d 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -822,7 +822,7 @@ UUID ObjectFileELF::GetUUID() {
llvm::Optional<FileSpec> ObjectFileELF::GetDebugLink() {
if (m_gnu_debuglink_file.empty())
- return llvm::None;
+ return std::nullopt;
return FileSpec(m_gnu_debuglink_file);
}
@@ -1770,13 +1770,13 @@ class VMAddressProvider {
if (H.p_memsz == 0) {
LLDB_LOG(Log, "Ignoring zero-sized {0} segment. Corrupt object file?",
SegmentName);
- return llvm::None;
+ return std::nullopt;
}
if (Segments.overlaps(H.p_vaddr, H.p_vaddr + H.p_memsz)) {
LLDB_LOG(Log, "Ignoring overlapping {0} segment. Corrupt object file?",
SegmentName);
- return llvm::None;
+ return std::nullopt;
}
return VMRange(H.p_vaddr, H.p_memsz);
}
@@ -1801,7 +1801,7 @@ class VMAddressProvider {
if (Range.GetByteSize() > 0 &&
Sections.overlaps(Range.GetRangeBase(), Range.GetRangeEnd())) {
LLDB_LOG(Log, "Ignoring overlapping section. Corrupt object file?");
- return llvm::None;
+ return std::nullopt;
}
if (Segment)
Range.Slide(-Segment->GetFileAddress());
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index 72fc82c3cd804..d13f0881cf9b1 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -1092,7 +1092,7 @@ llvm::Optional<FileSpec> ObjectFilePECOFF::GetDebugLink() {
uint32_t gnu_debuglink_crc;
if (GetDebugLinkContents(*m_binary, gnu_debuglink_file, gnu_debuglink_crc))
return FileSpec(gnu_debuglink_file);
- return llvm::None;
+ return std::nullopt;
}
uint32_t ObjectFilePECOFF::ParseDependentModules() {
diff --git a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
index 905e9637493be..a8f47ffedd400 100644
--- a/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
+++ b/lldb/source/Plugins/ObjectFile/wasm/ObjectFileWasm.cpp
@@ -57,18 +57,18 @@ GetWasmString(llvm::DataExtractor &data, llvm::DataExtractor::Cursor &c) {
uint64_t len = data.getULEB128(c);
if (!c) {
consumeError(c.takeError());
- return llvm::None;
+ return std::nullopt;
}
if (len >= (uint64_t(1) << 32)) {
- return llvm::None;
+ return std::nullopt;
}
llvm::SmallVector<uint8_t, 32> str_storage;
data.getU8(c, str_storage, len);
if (!c) {
consumeError(c.takeError());
- return llvm::None;
+ return std::nullopt;
}
llvm::StringRef str = toStringRef(makeArrayRef(str_storage));
@@ -427,7 +427,7 @@ llvm::Optional<FileSpec> ObjectFileWasm::GetExternalDebugInfoFileSpec() {
return FileSpec(symbols_url->GetStringRef());
}
}
- return llvm::None;
+ return std::nullopt;
}
void ObjectFileWasm::Dump(Stream *s) {
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index a20643ad21c23..780f51cc18c22 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -153,14 +153,14 @@ bool PlatformRemoteGDBServer::GetRemoteOSVersion() {
llvm::Optional<std::string> PlatformRemoteGDBServer::GetRemoteOSBuildString() {
if (!m_gdb_client_up)
- return llvm::None;
+ return std::nullopt;
return m_gdb_client_up->GetOSBuildString();
}
llvm::Optional<std::string>
PlatformRemoteGDBServer::GetRemoteOSKernelDescription() {
if (!m_gdb_client_up)
- return llvm::None;
+ return std::nullopt;
return m_gdb_client_up->GetOSKernelDescription();
}
@@ -288,7 +288,7 @@ PlatformRemoteGDBServer::DoGetUserName(UserIDResolver::id_t uid) {
std::string name;
if (m_gdb_client_up && m_gdb_client_up->GetUserName(uid, name))
return std::move(name);
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<std::string>
@@ -296,7 +296,7 @@ PlatformRemoteGDBServer::DoGetGroupName(UserIDResolver::id_t gid) {
std::string name;
if (m_gdb_client_up && m_gdb_client_up->GetGroupName(gid, name))
return std::move(name);
- return llvm::None;
+ return std::nullopt;
}
uint32_t PlatformRemoteGDBServer::FindProcesses(
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
index 5f4be5b00fdb6..2051b5b1572b5 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTCollector.cpp
@@ -73,7 +73,7 @@ static Optional<int> GetCGroupFileDescriptor(lldb::pid_t pid) {
std::ifstream ifile;
ifile.open(formatv("/proc/{0}/cgroup", pid));
if (!ifile)
- return None;
+ return std::nullopt;
std::string line;
while (std::getline(ifile, line)) {
@@ -82,7 +82,7 @@ static Optional<int> GetCGroupFileDescriptor(lldb::pid_t pid) {
std::string slice = line.substr(line.find_first_of("/"));
if (slice.empty())
- return None;
+ return std::nullopt;
std::string cgroup_file = formatv("/sys/fs/cgroup/{0}", slice);
// This cgroup should for the duration of the target, so we don't need to
// invoke close ourselves.
@@ -92,7 +92,7 @@ static Optional<int> GetCGroupFileDescriptor(lldb::pid_t pid) {
return fd;
}
}
- return None;
+ return std::nullopt;
}
Error IntelPTCollector::TraceStart(const TraceIntelPTStartRequest &request) {
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
index d8ee3e5600c9e..0453de25faf4a 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.cpp
@@ -51,7 +51,7 @@ IntelPTMultiCoreTrace::StartOnAllCores(const TraceIntelPTStartRequest &request,
for (cpu_id_t cpu_id : *cpu_ids) {
Expected<IntelPTSingleBufferTrace> core_trace =
- IntelPTSingleBufferTrace::Start(request, /*tid=*/None, cpu_id,
+ IntelPTSingleBufferTrace::Start(request, /*tid=*/std::nullopt, cpu_id,
/*disabled=*/true, cgroup_fd);
if (!core_trace)
return IncludePerfEventParanoidMessageInError(core_trace.takeError());
@@ -149,7 +149,7 @@ Expected<Optional<std::vector<uint8_t>>>
IntelPTMultiCoreTrace::TryGetBinaryData(
const TraceGetBinaryDataRequest &request) {
if (!request.cpu_id)
- return None;
+ return std::nullopt;
auto it = m_traces_per_core.find(*request.cpu_id);
if (it == m_traces_per_core.end())
return createStringError(
@@ -160,5 +160,5 @@ IntelPTMultiCoreTrace::TryGetBinaryData(
return it->second.first.GetIptTrace();
if (request.kind == IntelPTDataKinds::kPerfContextSwitchTrace)
return it->second.second.GetReadOnlyDataBuffer();
- return None;
+ return std::nullopt;
}
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
index b522e9fede659..38503b13230ab 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTMultiCoreTrace.h
@@ -43,7 +43,7 @@ class IntelPTMultiCoreTrace : public IntelPTProcessTrace {
static llvm::Expected<std::unique_ptr<IntelPTMultiCoreTrace>>
StartOnAllCores(const TraceIntelPTStartRequest &request,
NativeProcessProtocol &process,
- llvm::Optional<int> cgroup_fd = llvm::None);
+ llvm::Optional<int> cgroup_fd = std::nullopt);
/// Execute the provided callback on each core that is being traced.
///
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
index 29369cc5e46d0..677038bf96039 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
+++ b/lldb/source/Plugins/Process/Linux/IntelPTSingleBufferTrace.h
@@ -52,8 +52,8 @@ class IntelPTSingleBufferTrace {
static llvm::Expected<IntelPTSingleBufferTrace>
Start(const TraceIntelPTStartRequest &request,
llvm::Optional<lldb::tid_t> tid,
- llvm::Optional<lldb::cpu_id_t> cpu_id = llvm::None,
- bool disabled = false, llvm::Optional<int> cgroup_fd = llvm::None);
+ llvm::Optional<lldb::cpu_id_t> cpu_id = std::nullopt,
+ bool disabled = false, llvm::Optional<int> cgroup_fd = std::nullopt);
/// \return
/// The bytes requested by a jLLDBTraceGetBinaryData packet that was routed
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
index f2c86e347e8ff..e42f6276e9221 100644
--- a/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
+++ b/lldb/source/Plugins/Process/Linux/IntelPTThreadTraceCollection.cpp
@@ -76,12 +76,12 @@ llvm::Expected<llvm::Optional<std::vector<uint8_t>>>
IntelPTThreadTraceCollection::TryGetBinaryData(
const TraceGetBinaryDataRequest &request) {
if (!request.tid)
- return None;
+ return std::nullopt;
if (request.kind != IntelPTDataKinds::kIptTrace)
- return None;
+ return std::nullopt;
if (!TracesThread(*request.tid))
- return None;
+ return std::nullopt;
if (Expected<IntelPTSingleBufferTrace &> trace =
GetTracedThread(*request.tid))
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index a76cc6a8f0acf..ffa15f4023dba 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -1877,13 +1877,13 @@ static llvm::Optional<WaitStatus> HandlePid(::pid_t pid) {
-1, ::waitpid, pid, &status, __WALL | __WNOTHREAD | WNOHANG);
if (wait_pid == 0)
- return llvm::None;
+ return std::nullopt;
if (wait_pid == -1) {
Status error(errno, eErrorTypePOSIX);
LLDB_LOG(log, "waitpid({0}, &status, _) failed: {1}", pid,
error);
- return llvm::None;
+ return std::nullopt;
}
assert(wait_pid == pid);
diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
index 9e2326c3a784b..f715d58941844 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
@@ -53,7 +53,7 @@ class NativeRegisterContextLinux
};
/// Return architecture-specific data needed to make inferior syscalls, if
/// they are supported.
- virtual llvm::Optional<SyscallData> GetSyscallData() { return llvm::None; }
+ virtual llvm::Optional<SyscallData> GetSyscallData() { return std::nullopt; }
struct MmapData {
// Syscall numbers can be found (e.g.) in /usr/include/asm/unistd.h for the
@@ -63,7 +63,7 @@ class NativeRegisterContextLinux
};
/// Return the architecture-specific data needed to make mmap syscalls, if
/// they are supported.
- virtual llvm::Optional<MmapData> GetMmapData() { return llvm::None; }
+ virtual llvm::Optional<MmapData> GetMmapData() { return std::nullopt; }
struct MemoryTaggingDetails {
/// Object with tag handling utilities. If the function below returns
diff --git a/lldb/source/Plugins/Process/Linux/Perf.cpp b/lldb/source/Plugins/Process/Linux/Perf.cpp
index 9617c2df849af..a3095c8c103bb 100644
--- a/lldb/source/Plugins/Process/Linux/Perf.cpp
+++ b/lldb/source/Plugins/Process/Linux/Perf.cpp
@@ -366,8 +366,8 @@ lldb_private::process_linux::CreateContextSwitchTracePerfEvent(
if (parent_perf_event)
group_fd = parent_perf_event->GetFd();
- if (Expected<PerfEvent> perf_event =
- PerfEvent::Init(attr, /*pid=*/None, cpu_id, group_fd, /*flags=*/0)) {
+ if (Expected<PerfEvent> perf_event = PerfEvent::Init(
+ attr, /*pid=*/std::nullopt, cpu_id, group_fd, /*flags=*/0)) {
if (Error mmap_err = perf_event->MmapMetadataAndBuffers(
data_buffer_numpages, 0, /*data_buffer_write=*/false)) {
return std::move(mmap_err);
diff --git a/lldb/source/Plugins/Process/Linux/Perf.h b/lldb/source/Plugins/Process/Linux/Perf.h
index 86056c7c9927a..fb3fd244664f8 100644
--- a/lldb/source/Plugins/Process/Linux/Perf.h
+++ b/lldb/source/Plugins/Process/Linux/Perf.h
@@ -126,7 +126,7 @@ class PerfEvent {
/// all threads and processes are monitored.
static llvm::Expected<PerfEvent>
Init(perf_event_attr &attr, llvm::Optional<lldb::pid_t> pid,
- llvm::Optional<lldb::cpu_id_t> core = llvm::None);
+ llvm::Optional<lldb::cpu_id_t> core = std::nullopt);
/// Mmap the metadata page and the data and aux buffers of the perf event and
/// expose them through \a PerfEvent::GetMetadataPage() , \a
diff --git a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
index fe64da873d22a..a09cb9810d914 100644
--- a/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
+++ b/lldb/source/Plugins/Process/POSIX/NativeProcessELF.cpp
@@ -17,7 +17,7 @@ NativeProcessELF::GetAuxValue(enum AuxVector::EntryType type) {
if (m_aux_vector == nullptr) {
auto buffer_or_error = GetAuxvData();
if (!buffer_or_error)
- return llvm::None;
+ return std::nullopt;
DataExtractor auxv_data(buffer_or_error.get()->getBufferStart(),
buffer_or_error.get()->getBufferSize(),
GetByteOrder(), GetAddressByteSize());
diff --git a/lldb/source/Plugins/Process/Utility/AuxVector.cpp b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
index c4f45f759a33c..821f56958daf5 100644
--- a/lldb/source/Plugins/Process/Utility/AuxVector.cpp
+++ b/lldb/source/Plugins/Process/Utility/AuxVector.cpp
@@ -34,7 +34,7 @@ AuxVector::GetAuxValue(enum EntryType entry_type) const {
auto it = m_auxv_entries.find(static_cast<uint64_t>(entry_type));
if (it != m_auxv_entries.end())
return it->second;
- return llvm::None;
+ return std::nullopt;
}
void AuxVector::DumpToLog(lldb_private::Log *log) const {
diff --git a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
index 04614ea3f6625..de4a23d4d5059 100644
--- a/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
+++ b/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
@@ -50,12 +50,12 @@ GetPtrauthInstructionInfo(Target &target, const ArchSpec &arch,
DisassemblerSP disassembler_sp = Disassembler::DisassembleRange(
arch, plugin_name, flavor, target, range_bounds, prefer_file_cache);
if (!disassembler_sp)
- return llvm::None;
+ return std::nullopt;
InstructionList &insn_list = disassembler_sp->GetInstructionList();
InstructionSP insn = insn_list.GetInstructionAtIndex(0);
if (!insn)
- return llvm::None;
+ return std::nullopt;
return PtrauthInstructionInfo{insn->IsAuthenticated(), insn->IsLoad(),
insn->DoesBranch()};
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
index 6f3bf02cd303b..8482ae8f47d6e 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
@@ -22,7 +22,7 @@ getNoteType(const llvm::Triple &Triple,
continue;
return Entry.Note;
}
- return llvm::None;
+ return std::nullopt;
}
DataExtractor lldb_private::getRegset(llvm::ArrayRef<CoreNote> Notes,
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 347c47b078f45..a8af26a82b08e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -947,7 +947,7 @@ llvm::Optional<std::string> GDBRemoteCommunicationClient::GetOSBuildString() {
if (!m_os_build.empty())
return m_os_build;
}
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<std::string>
@@ -956,7 +956,7 @@ GDBRemoteCommunicationClient::GetOSKernelDescription() {
if (!m_os_kernel.empty())
return m_os_kernel;
}
- return llvm::None;
+ return std::nullopt;
}
bool GDBRemoteCommunicationClient::GetHostname(std::string &s) {
@@ -2706,7 +2706,7 @@ GDBRemoteCommunicationClient::SendSetCurrentThreadPacket(uint64_t tid,
if (response.IsUnsupportedResponse() && IsConnected())
return {{1, 1}};
}
- return llvm::None;
+ return std::nullopt;
}
bool GDBRemoteCommunicationClient::SetCurrentThread(uint64_t tid,
@@ -3082,20 +3082,20 @@ GDBRemoteCommunicationClient::FStat(lldb::user_id_t fd) {
if (SendPacketAndWaitForResponse(stream.GetString(), response) ==
PacketResult::Success) {
if (response.GetChar() != 'F')
- return llvm::None;
+ return std::nullopt;
int64_t size = response.GetS64(-1, 16);
if (size > 0 && response.GetChar() == ';') {
std::string buffer;
if (response.GetEscapedBinaryData(buffer)) {
GDBRemoteFStatData out;
if (buffer.size() != sizeof(out))
- return llvm::None;
+ return std::nullopt;
memcpy(&out, buffer.data(), sizeof(out));
return out;
}
}
}
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<GDBRemoteFStatData>
@@ -3103,7 +3103,7 @@ GDBRemoteCommunicationClient::Stat(const lldb_private::FileSpec &file_spec) {
Status error;
lldb::user_id_t fd = OpenFile(file_spec, File::eOpenOptionReadOnly, 0, error);
if (fd == UINT64_MAX)
- return llvm::None;
+ return std::nullopt;
llvm::Optional<GDBRemoteFStatData> st = FStat(fd);
CloseFile(fd, error);
return st;
@@ -3710,9 +3710,9 @@ llvm::Optional<QOffsets> GDBRemoteCommunicationClient::GetQOffsets() {
StringExtractorGDBRemote response;
if (SendPacketAndWaitForResponse("qOffsets", response) !=
PacketResult::Success)
- return llvm::None;
+ return std::nullopt;
if (!response.IsNormalResponse())
- return llvm::None;
+ return std::nullopt;
QOffsets result;
llvm::StringRef ref = response.GetStringRef();
@@ -3727,9 +3727,9 @@ llvm::Optional<QOffsets> GDBRemoteCommunicationClient::GetQOffsets() {
if (ref.consume_front("Text=")) {
result.segments = false;
if (!GetOffset())
- return llvm::None;
+ return std::nullopt;
if (!ref.consume_front(";Data=") || !GetOffset())
- return llvm::None;
+ return std::nullopt;
if (ref.empty())
return result;
if (ref.consume_front(";Bss=") && GetOffset() && ref.empty())
@@ -3737,13 +3737,13 @@ llvm::Optional<QOffsets> GDBRemoteCommunicationClient::GetQOffsets() {
} else if (ref.consume_front("TextSeg=")) {
result.segments = true;
if (!GetOffset())
- return llvm::None;
+ return std::nullopt;
if (ref.empty())
return result;
if (ref.consume_front(";DataSeg=") && GetOffset() && ref.empty())
return result;
}
- return llvm::None;
+ return std::nullopt;
}
bool GDBRemoteCommunicationClient::GetModuleInfo(
@@ -3816,30 +3816,30 @@ static llvm::Optional<ModuleSpec>
ParseModuleSpec(StructuredData::Dictionary *dict) {
ModuleSpec result;
if (!dict)
- return llvm::None;
+ return std::nullopt;
llvm::StringRef string;
uint64_t integer;
if (!dict->GetValueForKeyAsString("uuid", string))
- return llvm::None;
+ return std::nullopt;
if (!result.GetUUID().SetFromStringRef(string))
- return llvm::None;
+ return std::nullopt;
if (!dict->GetValueForKeyAsInteger("file_offset", integer))
- return llvm::None;
+ return std::nullopt;
result.SetObjectOffset(integer);
if (!dict->GetValueForKeyAsInteger("file_size", integer))
- return llvm::None;
+ return std::nullopt;
result.SetObjectSize(integer);
if (!dict->GetValueForKeyAsString("triple", string))
- return llvm::None;
+ return std::nullopt;
result.GetArchitecture().SetTriple(string);
if (!dict->GetValueForKeyAsString("file_path", string))
- return llvm::None;
+ return std::nullopt;
result.GetFileSpec() = FileSpec(string, result.GetArchitecture().GetTriple());
return result;
@@ -3851,7 +3851,7 @@ GDBRemoteCommunicationClient::GetModulesInfo(
namespace json = llvm::json;
if (!m_supports_jModulesInfo)
- return llvm::None;
+ return std::nullopt;
json::Array module_array;
for (const FileSpec &module_file_spec : module_file_specs) {
@@ -3874,21 +3874,21 @@ GDBRemoteCommunicationClient::GetModulesInfo(
if (SendPacketAndWaitForResponse(payload.GetString(), response) !=
PacketResult::Success ||
response.IsErrorResponse())
- return llvm::None;
+ return std::nullopt;
if (response.IsUnsupportedResponse()) {
m_supports_jModulesInfo = false;
- return llvm::None;
+ return std::nullopt;
}
StructuredData::ObjectSP response_object_sp =
StructuredData::ParseJSON(std::string(response.GetStringRef()));
if (!response_object_sp)
- return llvm::None;
+ return std::nullopt;
StructuredData::Array *response_array = response_object_sp->GetAsArray();
if (!response_array)
- return llvm::None;
+ return std::nullopt;
std::vector<ModuleSpec> result;
for (size_t i = 0; i < response_array->GetSize(); ++i) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 4ea8472c008ca..13446d560d87e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -655,7 +655,7 @@ GetRegistersAsJSON(NativeThreadProtocol &thread) {
reg_ctx.GetExpeditedRegisters(ExpeditedRegs::Minimal);
#endif
if (expedited_regs.empty())
- return llvm::None;
+ return std::nullopt;
for (auto ®_num : expedited_regs) {
const RegisterInfo *const reg_info_p =
@@ -3658,7 +3658,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qWatchpointSupportInfo(
auto hw_debug_cap = m_current_process->GetHardwareDebugSupportInfo();
StreamGDBRemote response;
- if (hw_debug_cap == llvm::None)
+ if (hw_debug_cap == std::nullopt)
response.Printf("num:0;");
else
response.Printf("num:%d;", hw_debug_cap->second);
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 83b496b3b9780..3c67e26fd84fc 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -3448,7 +3448,7 @@ thread_result_t ProcessGDBRemote::AsyncThread() {
") listener.WaitForEvent (NULL, event_sp)...",
__FUNCTION__, GetID());
- if (m_async_listener_sp->GetEvent(event_sp, llvm::None)) {
+ if (m_async_listener_sp->GetEvent(event_sp, std::nullopt)) {
const uint32_t event_type = event_sp->GetType();
if (event_sp->BroadcasterIs(&m_async_broadcaster)) {
LLDB_LOGF(log,
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
index d14b707f72090..379189a518f4b 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpParser.cpp
@@ -224,7 +224,7 @@ llvm::Optional<LinuxProcStatus> MinidumpParser::GetLinuxProcStatus() {
llvm::ArrayRef<uint8_t> data = GetStream(StreamType::LinuxProcStatus);
if (data.size() == 0)
- return llvm::None;
+ return std::nullopt;
return LinuxProcStatus::Parse(data);
}
@@ -240,7 +240,7 @@ llvm::Optional<lldb::pid_t> MinidumpParser::GetPid() {
return proc_status->GetPid();
}
- return llvm::None;
+ return std::nullopt;
}
llvm::ArrayRef<minidump::Module> MinidumpParser::GetModuleList() {
@@ -442,14 +442,14 @@ MinidumpParser::FindMemoryRange(lldb::addr_t addr) {
const size_t range_size = loc_desc.DataSize;
if (loc_desc.RVA + loc_desc.DataSize > GetData().size())
- return llvm::None;
+ return std::nullopt;
if (range_start <= addr && addr < range_start + range_size) {
auto ExpectedSlice = GetMinidumpFile().getRawData(loc_desc);
if (!ExpectedSlice) {
LLDB_LOG_ERROR(log, ExpectedSlice.takeError(),
"Failed to get memory slice: {0}");
- return llvm::None;
+ return std::nullopt;
}
return minidump::Range(range_start, *ExpectedSlice);
}
@@ -468,14 +468,14 @@ MinidumpParser::FindMemoryRange(lldb::addr_t addr) {
MinidumpMemoryDescriptor64::ParseMemory64List(data64);
if (memory64_list.empty())
- return llvm::None;
+ return std::nullopt;
for (const auto &memory_desc64 : memory64_list) {
const lldb::addr_t range_start = memory_desc64.start_of_memory_range;
const size_t range_size = memory_desc64.data_size;
if (base_rva + range_size > GetData().size())
- return llvm::None;
+ return std::nullopt;
if (range_start <= addr && addr < range_start + range_size) {
return minidump::Range(range_start,
@@ -485,7 +485,7 @@ MinidumpParser::FindMemoryRange(lldb::addr_t addr) {
}
}
- return llvm::None;
+ return std::nullopt;
}
llvm::ArrayRef<uint8_t> MinidumpParser::GetMemory(lldb::addr_t addr,
diff --git a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
index abddd79ad7dc8..b3ff6bfa1b212 100644
--- a/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
+++ b/lldb/source/Plugins/Process/minidump/MinidumpTypes.cpp
@@ -29,7 +29,7 @@ llvm::Optional<lldb::pid_t> MinidumpMiscInfo::GetPid() const {
if (flags1 & pid_flag)
return llvm::Optional<lldb::pid_t>(process_id);
- return llvm::None;
+ return std::nullopt;
}
// Linux Proc Status
@@ -52,7 +52,7 @@ LinuxProcStatus::Parse(llvm::ArrayRef<uint8_t> &data) {
}
}
- return llvm::None;
+ return std::nullopt;
}
lldb::pid_t LinuxProcStatus::GetPid() const { return pid; }
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index 2884003c9894d..07bc35785a2ad 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -495,7 +495,7 @@ void SymbolFileBreakpad::AddSymbols(Symtab &symtab) {
for (llvm::StringRef line : lines(Record::Public)) {
if (auto record = PublicRecord::parse(line))
- add_symbol(record->Address, llvm::None, record->Name);
+ add_symbol(record->Address, std::nullopt, record->Name);
else
LLDB_LOG(log, "Failed to parse: {0}. Skipping record.", line);
}
@@ -528,7 +528,7 @@ GetRule(llvm::StringRef &unwind_rules) {
llvm::StringRef lhs, rest;
std::tie(lhs, rest) = getToken(unwind_rules);
if (!lhs.consume_back(":"))
- return llvm::None;
+ return std::nullopt;
// Seek forward to the next register: expression pair
llvm::StringRef::size_type pos = rest.find(": ");
@@ -541,7 +541,7 @@ GetRule(llvm::StringRef &unwind_rules) {
// Go back one token to find the end of the current rule.
pos = rest.rfind(' ', pos);
if (pos == llvm::StringRef::npos)
- return llvm::None;
+ return std::nullopt;
llvm::StringRef rhs = rest.take_front(pos);
unwind_rules = rest.drop_front(pos);
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
index 39ed8e577ac9b..2ffff5140ece3 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
@@ -95,7 +95,7 @@ class SymbolFileBreakpad : public SymbolFileCommon {
llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
lldb::user_id_t type_uid,
const lldb_private::ExecutionContext *exe_ctx) override {
- return llvm::None;
+ return std::nullopt;
}
bool CompleteType(CompilerType &compiler_type) override { return false; }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
index 25cb368763c16..909db83e9284e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
@@ -36,11 +36,11 @@ llvm::Optional<DIERef> DIERef::Decode(const DataExtractor &data,
// it will return 0
dw_offset_t die_offset = data.GetU32(offset_ptr);
if (die_offset == 0)
- return llvm::None;
+ return std::nullopt;
if (dwo_num_valid)
return DIERef(dwo_num, section, die_offset);
else
- return DIERef(llvm::None, section, die_offset);
+ return DIERef(std::nullopt, section, die_offset);
}
void DIERef::Encode(DataEncoder &encoder) const {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
index ce0a054eee08e..e980f686958eb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
@@ -37,7 +37,7 @@ class DIERef {
llvm::Optional<uint32_t> dwo_num() const {
if (m_dwo_num_valid)
return m_dwo_num;
- return llvm::None;
+ return std::nullopt;
}
Section section() const { return static_cast<Section>(m_section); }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
index 364d34c733755..0292e743004a3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -23,7 +23,7 @@ DWARFASTParser::ParseChildArrayInfo(const DWARFDIE &parent_die,
const ExecutionContext *exe_ctx) {
SymbolFile::ArrayInfo array_info;
if (!parent_die)
- return llvm::None;
+ return std::nullopt;
for (DWARFDIE die : parent_die.children()) {
const dw_tag_t tag = die.Tag();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index fa09eea9ad7ac..905df91ecaeb7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1273,7 +1273,7 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
}
}
return std::make_shared<Type>(
- die.GetID(), dwarf, attrs.name, llvm::None, nullptr, LLDB_INVALID_UID,
+ die.GetID(), dwarf, attrs.name, std::nullopt, nullptr, LLDB_INVALID_UID,
Type::eEncodingIsUID, &attrs.decl, clang_type, Type::ResolveState::Full);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
index e5cf598719001..23835d8c3b27e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
@@ -20,7 +20,7 @@ using namespace lldb_private;
llvm::Optional<DIERef> DWARFBaseDIE::GetDIERef() const {
if (!IsValid())
- return llvm::None;
+ return std::nullopt;
return DIERef(m_cu->GetSymbolFileDWARF().GetDwoNum(), m_cu->GetDebugSection(),
m_die->GetOffset());
@@ -57,7 +57,7 @@ llvm::Optional<uint64_t>
DWARFBaseDIE::GetAttributeValueAsOptionalUnsigned(const dw_attr_t attr) const {
if (IsValid())
return m_die->GetAttributeValueAsOptionalUnsigned(GetCU(), attr);
- return llvm::None;
+ return std::nullopt;
}
uint64_t DWARFBaseDIE::GetAttributeValueAsAddress(const dw_attr_t attr,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
index 37e28a09f3c45..d76ff198d0036 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
@@ -41,12 +41,12 @@ DWARFContext::LoadOrGetSection(llvm::Optional<SectionType> main_section_type,
}
const DWARFDataExtractor &DWARFContext::getOrLoadCuIndexData() {
- return LoadOrGetSection(llvm::None, eSectionTypeDWARFDebugCuIndex,
+ return LoadOrGetSection(std::nullopt, eSectionTypeDWARFDebugCuIndex,
m_data_debug_cu_index);
}
const DWARFDataExtractor &DWARFContext::getOrLoadTuIndexData() {
- return LoadOrGetSection(llvm::None, eSectionTypeDWARFDebugTuIndex,
+ return LoadOrGetSection(std::nullopt, eSectionTypeDWARFDebugTuIndex,
m_data_debug_tu_index);
}
@@ -56,12 +56,12 @@ const DWARFDataExtractor &DWARFContext::getOrLoadAbbrevData() {
}
const DWARFDataExtractor &DWARFContext::getOrLoadArangesData() {
- return LoadOrGetSection(eSectionTypeDWARFDebugAranges, llvm::None,
+ return LoadOrGetSection(eSectionTypeDWARFDebugAranges, std::nullopt,
m_data_debug_aranges);
}
const DWARFDataExtractor &DWARFContext::getOrLoadAddrData() {
- return LoadOrGetSection(eSectionTypeDWARFDebugAddr, llvm::None,
+ return LoadOrGetSection(eSectionTypeDWARFDebugAddr, std::nullopt,
m_data_debug_addr);
}
@@ -71,12 +71,12 @@ const DWARFDataExtractor &DWARFContext::getOrLoadDebugInfoData() {
}
const DWARFDataExtractor &DWARFContext::getOrLoadLineData() {
- return LoadOrGetSection(eSectionTypeDWARFDebugLine, llvm::None,
+ return LoadOrGetSection(eSectionTypeDWARFDebugLine, std::nullopt,
m_data_debug_line);
}
const DWARFDataExtractor &DWARFContext::getOrLoadLineStrData() {
- return LoadOrGetSection(eSectionTypeDWARFDebugLineStr, llvm::None,
+ return LoadOrGetSection(eSectionTypeDWARFDebugLineStr, std::nullopt,
m_data_debug_line_str);
}
@@ -92,12 +92,12 @@ const DWARFDataExtractor &DWARFContext::getOrLoadLocListsData() {
}
const DWARFDataExtractor &DWARFContext::getOrLoadMacroData() {
- return LoadOrGetSection(eSectionTypeDWARFDebugMacro, llvm::None,
+ return LoadOrGetSection(eSectionTypeDWARFDebugMacro, std::nullopt,
m_data_debug_macro);
}
const DWARFDataExtractor &DWARFContext::getOrLoadRangesData() {
- return LoadOrGetSection(eSectionTypeDWARFDebugRanges, llvm::None,
+ return LoadOrGetSection(eSectionTypeDWARFDebugRanges, std::nullopt,
m_data_debug_ranges);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index c10eae311a936..481a8cc811102 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -555,7 +555,7 @@ DWARFDebugInfoEntry::GetAttributeValueAsOptionalUnsigned(
if (GetAttributeValue(cu, attr, form_value, nullptr,
check_specification_or_abstract_origin))
return form_value.Unsigned();
- return llvm::None;
+ return std::nullopt;
}
// GetAttributeValueAsReference
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index 08b2416837766..4efb5a2029e85 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -193,7 +193,7 @@ DWARFFormValue::GetFixedSize(dw_form_t form, const DWARFUnit *u) {
return g_form_sizes[form].size;
if (form == DW_FORM_addr && u)
return u->GetAddressByteSize();
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<uint8_t> DWARFFormValue::GetFixedSize() const {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index 9fdab3c5273f9..5c05f83d88810 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -241,12 +241,12 @@ class DWARFUnit : public lldb_private::UserID {
llvm::Optional<uint64_t> GetLoclistOffset(uint32_t Index) {
if (!m_loclist_table_header)
- return llvm::None;
+ return std::nullopt;
std::optional<uint64_t> Offset = m_loclist_table_header->getOffsetEntry(
m_dwarf.GetDWARFContext().getOrLoadLocListsData().GetAsLLVM(), Index);
if (!Offset)
- return llvm::None;
+ return std::nullopt;
return *Offset + m_loclists_base;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index d0b2ef66d4010..7dee031d14385 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -45,18 +45,18 @@ llvm::Optional<DIERef>
DebugNamesDWARFIndex::ToDIERef(const DebugNames::Entry &entry) {
std::optional<uint64_t> cu_offset = entry.getCUOffset();
if (!cu_offset)
- return llvm::None;
+ return std::nullopt;
DWARFUnit *cu = m_debug_info.GetUnitAtOffset(DIERef::Section::DebugInfo, *cu_offset);
if (!cu)
- return llvm::None;
+ return std::nullopt;
cu = &cu->GetNonSkeletonUnit();
if (std::optional<uint64_t> die_offset = entry.getDIEUnitOffset())
return DIERef(cu->GetSymbolFileDWARF().GetDwoNum(),
DIERef::Section::DebugInfo, cu->GetOffset() + *die_offset);
- return llvm::None;
+ return std::nullopt;
}
bool DebugNamesDWARFIndex::ProcessEntry(
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
index efc08e47a2800..0006949865def 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
@@ -65,7 +65,7 @@ class DWARFMappedHash {
DIEInfo(dw_offset_t o, dw_tag_t t, uint32_t f, uint32_t h);
explicit operator DIERef() const {
- return DIERef(llvm::None, DIERef::Section::DebugInfo, die_offset);
+ return DIERef(std::nullopt, DIERef::Section::DebugInfo, die_offset);
}
};
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index bd29d4120e9b1..880b5211491fb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -798,7 +798,7 @@ llvm::Optional<uint32_t> SymbolFileDWARF::GetDWARFUnitIndex(uint32_t cu_idx) {
if (m_lldb_cu_to_dwarf_unit.empty())
return cu_idx;
if (cu_idx >= m_lldb_cu_to_dwarf_unit.size())
- return llvm::None;
+ return std::nullopt;
return m_lldb_cu_to_dwarf_unit[cu_idx];
}
@@ -1422,11 +1422,11 @@ SymbolFileDWARF::DecodeUID(lldb::user_id_t uid) {
SymbolFileDWARF *dwarf = debug_map->GetSymbolFileByOSOIndex(
debug_map->GetOSOIndexFromUserID(uid));
return DecodedUID{
- *dwarf, {llvm::None, DIERef::Section::DebugInfo, dw_offset_t(uid)}};
+ *dwarf, {std::nullopt, DIERef::Section::DebugInfo, dw_offset_t(uid)}};
}
dw_offset_t die_offset = uid;
if (die_offset == DW_INVALID_OFFSET)
- return llvm::None;
+ return std::nullopt;
DIERef::Section section =
uid >> 63 ? DIERef::Section::DebugTypes : DIERef::Section::DebugInfo;
@@ -1507,7 +1507,7 @@ SymbolFileDWARF::GetDynamicArrayInfoForUID(
if (DWARFDIE type_die = GetDIE(type_uid))
return DWARFASTParser::ParseChildArrayInfo(type_die, exe_ctx);
else
- return llvm::None;
+ return std::nullopt;
}
Type *SymbolFileDWARF::ResolveTypeUID(const DIERef &die_ref) {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 89f935bb848b1..5b5327d77a593 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -278,7 +278,7 @@ class SymbolFileDWARF : public lldb_private::SymbolFileCommon,
GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu,
const DWARFDebugInfoEntry &cu_die);
- virtual llvm::Optional<uint32_t> GetDwoNum() { return llvm::None; }
+ virtual llvm::Optional<uint32_t> GetDwoNum() { return std::nullopt; }
/// If this is a DWARF object with a single CU, return its DW_AT_dwo_id.
llvm::Optional<uint64_t> GetDWOId();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 2dfd5dc7e9426..cbe166281b4bc 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -784,7 +784,7 @@ SymbolFileDWARFDebugMap::GetDynamicArrayInfoForUID(
SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx);
if (oso_dwarf)
return oso_dwarf->GetDynamicArrayInfoForUID(type_uid, exe_ctx);
- return llvm::None;
+ return std::nullopt;
}
bool SymbolFileDWARFDebugMap::CompleteType(CompilerType &compiler_type) {
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
index b29c153367594..3d644256c8e6a 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp
@@ -165,7 +165,7 @@ static DWARFExpression MakeRegisterBasedLocationExpressionInternal(
DWARFExpression lldb_private::npdb::MakeEnregisteredLocationExpression(
llvm::codeview::RegisterId reg, lldb::ModuleSP module) {
- return MakeRegisterBasedLocationExpressionInternal(reg, llvm::None, module);
+ return MakeRegisterBasedLocationExpressionInternal(reg, std::nullopt, module);
}
DWARFExpression lldb_private::npdb::MakeRegRelLocationExpression(
@@ -275,7 +275,7 @@ lldb_private::npdb::MakeEnregisteredLocationExpressionForComposite(
}
MemberValLocation loc = offset_loc.second;
llvm::Optional<int32_t> offset =
- loc.is_at_reg ? llvm::None
+ loc.is_at_reg ? std::nullopt
: llvm::Optional<int32_t>(loc.reg_offset);
if (!MakeRegisterBasedLocationExpressionInternal(
stream, (RegisterId)loc.reg_id, register_kind, offset,
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index b3b05d47f2014..2b41b69a9e0b1 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -150,7 +150,7 @@ TranslateCallingConvention(llvm::codeview::CallingConvention conv) {
case CC::NearVector:
return clang::CallingConv::CC_X86VectorCall;
default:
- return llvm::None;
+ return std::nullopt;
}
}
@@ -284,19 +284,19 @@ llvm::Optional<CompilerDecl> PdbAstBuilder::GetOrCreateDeclForUid(PdbSymUid uid)
case PdbSymUidKind::Type: {
clang::QualType qt = GetOrCreateType(uid.asTypeSym());
if (qt.isNull())
- return llvm::None;
+ return std::nullopt;
if (auto *tag = qt->getAsTagDecl()) {
result = tag;
break;
}
- return llvm::None;
+ return std::nullopt;
}
default:
- return llvm::None;
+ return std::nullopt;
}
if (!result)
- return llvm::None;
+ return std::nullopt;
m_uid_to_decl[toOpaqueUid(uid)] = result;
return ToCompilerDecl(*result);
}
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
index 3a76f8bff316f..b1e96ed838a6e 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp
@@ -80,7 +80,7 @@ PdbIndex::GetModuleIndexForAddr(uint16_t segment, uint32_t offset) const {
llvm::Optional<uint16_t> PdbIndex::GetModuleIndexForVa(lldb::addr_t va) const {
auto iter = m_va_to_modi.find(va);
if (iter == m_va_to_modi.end())
- return llvm::None;
+ return std::nullopt;
return iter.value();
}
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 5b8176f84c64d..5e686751d7626 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -246,12 +246,12 @@ GetNestedTagDefinition(const NestedTypeRecord &Record,
// If it's a simple type, then this is something like `using foo = int`.
if (Record.Type.isSimple())
- return llvm::None;
+ return std::nullopt;
CVType cvt = tpi.getType(Record.Type);
if (!IsTagRecord(cvt))
- return llvm::None;
+ return std::nullopt;
// If it's an inner definition, then treat whatever name we have here as a
// single component of a mangled name. So we can inject it into the parent's
@@ -259,7 +259,7 @@ GetNestedTagDefinition(const NestedTypeRecord &Record,
CVTagRecord child = CVTagRecord::create(cvt);
std::string qname = std::string(parent.asTag().getUniqueName());
if (qname.size() < 4 || child.asTag().getUniqueName().size() < 4)
- return llvm::None;
+ return std::nullopt;
// qname[3] is the tag type identifier (struct, class, union, etc). Since the
// inner tag type is not necessarily the same as the outer tag type, re-write
@@ -272,7 +272,7 @@ GetNestedTagDefinition(const NestedTypeRecord &Record,
piece.push_back('@');
qname.insert(4, std::move(piece));
if (qname != child.asTag().UniqueName)
- return llvm::None;
+ return std::nullopt;
return std::move(child);
}
@@ -1508,10 +1508,10 @@ void SymbolFileNativePDB::ParseInlineSite(PdbCompilandSymId id,
file_offset = *next_file_offset;
if (next_line_offset) {
cur_line_offset = next_line_offset;
- next_line_offset = llvm::None;
+ next_line_offset = std::nullopt;
}
- code_offset_base = is_terminal_entry ? llvm::None : code_offset_end;
- code_offset_end = next_file_offset = llvm::None;
+ code_offset_base = is_terminal_entry ? std::nullopt : code_offset_end;
+ code_offset_end = next_file_offset = std::nullopt;
}
if (code_offset_base && cur_line_offset) {
if (is_terminal_entry) {
@@ -2108,7 +2108,7 @@ Type *SymbolFileNativePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
llvm::Optional<SymbolFile::ArrayInfo>
SymbolFileNativePDB::GetDynamicArrayInfoForUID(
lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
- return llvm::None;
+ return std::nullopt;
}
bool SymbolFileNativePDB::CompleteType(CompilerType &compiler_type) {
@@ -2276,7 +2276,7 @@ SymbolFileNativePDB::FindSymbolScope(PdbCompilandSymId id) {
// Global symbols have parent offset of 0. Return llvm::None to indicate
// this.
if (id.offset == 0)
- return llvm::None;
+ return std::nullopt;
return id;
}
@@ -2293,7 +2293,7 @@ SymbolFileNativePDB::FindSymbolScope(PdbCompilandSymId id) {
if (begin.offset() > id.offset) {
// We passed it. We couldn't even find this symbol record.
lldbassert(false && "Invalid compiland symbol id!");
- return llvm::None;
+ return std::nullopt;
}
// We haven't found the symbol yet. Check if we need to open or close the
@@ -2314,7 +2314,7 @@ SymbolFileNativePDB::FindSymbolScope(PdbCompilandSymId id) {
++begin;
}
if (scope_stack.empty())
- return llvm::None;
+ return std::nullopt;
// We have a match! Return the top of the stack
return scope_stack.back();
}
@@ -2323,6 +2323,6 @@ llvm::Optional<llvm::codeview::TypeIndex>
SymbolFileNativePDB::GetParentType(llvm::codeview::TypeIndex ti) {
auto parent_iter = m_parent_types.find(ti);
if (parent_iter == m_parent_types.end())
- return llvm::None;
+ return std::nullopt;
return parent_iter->second;
}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 7dbc13c1f01fc..6e6c0e8c90cbc 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -663,7 +663,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
GetDeclarationForSymbol(type, decl);
return std::make_shared<lldb_private::Type>(
type.getSymIndexId(), m_ast.GetSymbolFile(), ConstString(name),
- llvm::None, nullptr, LLDB_INVALID_UID,
+ std::nullopt, nullptr, LLDB_INVALID_UID,
lldb_private::Type::eEncodingIsUID, decl, func_sig_ast_type,
lldb_private::Type::ResolveState::Full);
} break;
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index 3e0b733913af2..7875f8a6580a1 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -592,7 +592,7 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
llvm::Optional<SymbolFile::ArrayInfo> SymbolFilePDB::GetDynamicArrayInfoForUID(
lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
- return llvm::None;
+ return std::nullopt;
}
bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) {
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index cc22eaeef779c..262943119b007 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -232,7 +232,7 @@ Type *SymbolFileSymtab::ResolveTypeUID(lldb::user_id_t type_uid) {
llvm::Optional<SymbolFile::ArrayInfo>
SymbolFileSymtab::GetDynamicArrayInfoForUID(
lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
- return llvm::None;
+ return std::nullopt;
}
bool SymbolFileSymtab::CompleteType(lldb_private::CompilerType &compiler_type) {
diff --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
index aab2223dd3961..a99324db1da27 100644
--- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
+++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.cpp
@@ -349,7 +349,7 @@ HTRBlockLayerUP lldb_private::BasicSuperBlockMerge(IHTRLayer &layer) {
// Tail logic
construct_next_layer(i - superblock_size + 1, superblock_size);
// Reset the block_head since the prev super block has come to and end
- superblock_head = llvm::None;
+ superblock_head = std::nullopt;
superblock_size = 0;
} else if (isHead) {
if (superblock_size) { // this handles (tail, head) adjacency -
@@ -369,7 +369,7 @@ HTRBlockLayerUP lldb_private::BasicSuperBlockMerge(IHTRLayer &layer) {
// End previous super block
construct_next_layer(i - superblock_size + 1, superblock_size);
// Reset the block_head since the prev super block has come to and end
- superblock_head = llvm::None;
+ superblock_head = std::nullopt;
superblock_size = 0;
} else {
if (!superblock_head)
diff --git a/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp b/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
index df8da3967fc6d..cc4ebfff65951 100644
--- a/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
+++ b/lldb/source/Plugins/TraceExporter/ctf/CommandObjectThreadTraceExportCTF.cpp
@@ -54,7 +54,7 @@ Status CommandObjectThreadTraceExportCTF::CommandOptions::SetOptionValue(
void CommandObjectThreadTraceExportCTF::CommandOptions::OptionParsingStarting(
ExecutionContext *execution_context) {
m_file.clear();
- m_thread_index = None;
+ m_thread_index = std::nullopt;
}
llvm::ArrayRef<OptionDefinition>
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index a55a4911e023f..bd017dab20bf0 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -3716,15 +3716,15 @@ bool TypeSystemClang::SupportsLanguage(lldb::LanguageType language) {
Optional<std::string>
TypeSystemClang::GetCXXClassName(const CompilerType &type) {
if (!type)
- return llvm::None;
+ return std::nullopt;
clang::QualType qual_type(ClangUtil::GetCanonicalQualType(type));
if (qual_type.isNull())
- return llvm::None;
+ return std::nullopt;
clang::CXXRecordDecl *cxx_record_decl = qual_type->getAsCXXRecordDecl();
if (!cxx_record_decl)
- return llvm::None;
+ return std::nullopt;
return std::string(cxx_record_decl->getIdentifier()->getNameStart());
}
@@ -4719,7 +4719,7 @@ TypeSystemClang::GetBitSize(lldb::opaque_compiler_type_t type,
if (GetCompleteType(type))
return getASTContext().getTypeSize(qual_type);
else
- return None;
+ return std::nullopt;
break;
case clang::Type::ObjCInterface:
@@ -4769,7 +4769,7 @@ TypeSystemClang::GetBitSize(lldb::opaque_compiler_type_t type,
return bit_size;
}
}
- return None;
+ return std::nullopt;
}
llvm::Optional<size_t>
@@ -5345,7 +5345,7 @@ GetDynamicArrayInfo(TypeSystemClang &ast, SymbolFile *sym_file,
if (auto *metadata = ast.GetMetadata(qual_type.getTypePtr()))
return sym_file->GetDynamicArrayInfoForUID(metadata->GetUserID(),
exe_ctx);
- return llvm::None;
+ return std::nullopt;
}
uint32_t TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
@@ -7290,11 +7290,11 @@ TypeSystemClang::GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
const clang::ClassTemplateSpecializationDecl *template_decl =
GetAsTemplateSpecialization(type);
if (!template_decl)
- return llvm::None;
+ return std::nullopt;
const auto *arg = GetNthTemplateArgument(template_decl, idx, expand_pack);
if (!arg || arg->getKind() != clang::TemplateArgument::Integral)
- return llvm::None;
+ return std::nullopt;
return {{arg->getAsIntegral(), GetType(arg->getIntegralType())}};
}
@@ -9890,7 +9890,7 @@ class SpecializedScratchAST : public TypeSystemClang {
} // namespace
char ScratchTypeSystemClang::ID;
-const std::nullopt_t ScratchTypeSystemClang::DefaultAST = llvm::None;
+const std::nullopt_t ScratchTypeSystemClang::DefaultAST = std::nullopt;
ScratchTypeSystemClang::ScratchTypeSystemClang(Target &target,
llvm::Triple triple)
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index 276b66b3b1536..9cf7cd339e92a 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -744,7 +744,7 @@ class TypeSystemClang : public TypeSystem {
ExecutionContextScope *exe_scope) {
if (llvm::Optional<uint64_t> bit_size = GetBitSize(type, exe_scope))
return (*bit_size + 7) / 8;
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<uint64_t>
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp
index 8b979d352fc82..6d2233e42734b 100644
--- a/lldb/source/Symbol/CompileUnit.cpp
+++ b/lldb/source/Symbol/CompileUnit.cpp
@@ -237,7 +237,8 @@ uint32_t CompileUnit::FindLineEntry(uint32_t start_idx, uint32_t line,
return UINT32_MAX;
// TODO: Handle SourceLocationSpec column information
- SourceLocationSpec location_spec(*file_spec_ptr, line, /*column=*/llvm::None,
+ SourceLocationSpec location_spec(*file_spec_ptr, line,
+ /*column=*/std::nullopt,
/*check_inlines=*/false, exact);
LineTable *line_table = GetLineTable();
@@ -321,7 +322,7 @@ void CompileUnit::ResolveSymbolContext(
const llvm::Optional<uint16_t> column =
src_location_spec.GetColumn()
? llvm::Optional<uint16_t>(line_entry.column)
- : llvm::None;
+ : std::nullopt;
SourceLocationSpec found_entry(line_entry.file, line_entry.line, column,
inlines, exact);
diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp
index 34dc7140c1fd1..20e63f65584c3 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -765,7 +765,7 @@ CompilerType::GetIntegralTemplateArgument(size_t idx, bool expand_pack) const {
if (IsValid())
if (auto type_system_sp = GetTypeSystem())
return type_system_sp->GetIntegralTemplateArgument(m_type, idx, expand_pack);
- return llvm::None;
+ return std::nullopt;
}
CompilerType CompilerType::GetTypeForFormatters() const {
diff --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
index 4e51bd411a756..30d781aaf4559 100644
--- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp
+++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp
@@ -197,7 +197,7 @@ bool DWARFCallFrameInfo::GetAddressRange(Address addr, AddressRange &range) {
llvm::Optional<DWARFCallFrameInfo::FDEEntryMap::Entry>
DWARFCallFrameInfo::GetFirstFDEEntryInRange(const AddressRange &range) {
if (!m_section_sp || m_section_sp->IsEncrypted())
- return llvm::None;
+ return std::nullopt;
GetFDEIndex();
@@ -208,7 +208,7 @@ DWARFCallFrameInfo::GetFirstFDEEntryInRange(const AddressRange &range) {
FDEEntryMap::Range(start_file_addr, range.GetByteSize())))
return *fde;
- return llvm::None;
+ return std::nullopt;
}
void DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 8ec4bc90cd131..5ed0e66bdacbd 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -306,7 +306,7 @@ llvm::ArrayRef<std::unique_ptr<CallEdge>> Function::GetCallEdges() {
Block &block = GetBlock(/*can_create*/true);
SymbolFile *sym_file = block.GetSymbolFile();
if (!sym_file)
- return llvm::None;
+ return std::nullopt;
// Lazily read call site information from the SymbolFile.
m_call_edges = sym_file->ParseCallEdgesInFunction(GetID());
diff --git a/lldb/source/Symbol/PostfixExpression.cpp b/lldb/source/Symbol/PostfixExpression.cpp
index e80e134f29bb5..62be3ba254dec 100644
--- a/lldb/source/Symbol/PostfixExpression.cpp
+++ b/lldb/source/Symbol/PostfixExpression.cpp
@@ -23,7 +23,7 @@ using namespace lldb_private::dwarf;
static llvm::Optional<BinaryOpNode::OpType>
GetBinaryOpType(llvm::StringRef token) {
if (token.size() != 1)
- return llvm::None;
+ return std::nullopt;
switch (token[0]) {
case '@':
return BinaryOpNode::Align;
@@ -32,14 +32,14 @@ GetBinaryOpType(llvm::StringRef token) {
case '+':
return BinaryOpNode::Plus;
}
- return llvm::None;
+ return std::nullopt;
}
static llvm::Optional<UnaryOpNode::OpType>
GetUnaryOpType(llvm::StringRef token) {
if (token == "^")
return UnaryOpNode::Deref;
- return llvm::None;
+ return std::nullopt;
}
Node *postfix::ParseOneExpression(llvm::StringRef expr,
diff --git a/lldb/source/Symbol/SymbolFileOnDemand.cpp b/lldb/source/Symbol/SymbolFileOnDemand.cpp
index 7f8a2bc146adb..796d306716f10 100644
--- a/lldb/source/Symbol/SymbolFileOnDemand.cpp
+++ b/lldb/source/Symbol/SymbolFileOnDemand.cpp
@@ -203,7 +203,7 @@ SymbolFileOnDemand::GetDynamicArrayInfoForUID(
if (!m_debug_info_enabled) {
LLDB_LOG(GetLog(), "[{0}] {1} is skipped", GetSymbolFileName(),
__FUNCTION__);
- return llvm::None;
+ return std::nullopt;
}
return m_sym_file_impl->GetDynamicArrayInfoForUID(type_uid, exe_ctx);
}
diff --git a/lldb/source/Symbol/TypeSystem.cpp b/lldb/source/Symbol/TypeSystem.cpp
index 7671f11847f45..d1d78fc1eec52 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -135,7 +135,7 @@ CompilerType TypeSystem::GetTypeTemplateArgument(opaque_compiler_type_t type,
llvm::Optional<CompilerType::IntegralTemplateArgument>
TypeSystem::GetIntegralTemplateArgument(opaque_compiler_type_t type, size_t idx,
bool expand_pack) {
- return llvm::None;
+ return std::nullopt;
}
LazyBool TypeSystem::ShouldPrintAsOneLiner(void *type, ValueObject *valobj) {
@@ -177,7 +177,7 @@ TypeSystem::CreateUtilityFunction(std::string text, std::string name) {
}
llvm::Optional<llvm::json::Value> TypeSystem::ReportStatistics() {
- return llvm::None;
+ return std::nullopt;
}
#pragma mark TypeSystemMap
diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp
index bd4690547c6bd..51301e4ee43fb 100644
--- a/lldb/source/Symbol/UnwindPlan.cpp
+++ b/lldb/source/Symbol/UnwindPlan.cpp
@@ -71,10 +71,10 @@ void UnwindPlan::Row::RegisterLocation::SetIsDWARFExpression(
static llvm::Optional<std::pair<lldb::ByteOrder, uint32_t>>
GetByteOrderAndAddrSize(Thread *thread) {
if (!thread)
- return llvm::None;
+ return std::nullopt;
ProcessSP process_sp = thread->GetProcess();
if (!process_sp)
- return llvm::None;
+ return std::nullopt;
ArchSpec arch = process_sp->GetTarget().GetArchitecture();
return std::make_pair(arch.GetByteOrder(), arch.GetAddressByteSize());
}
diff --git a/lldb/source/Symbol/UnwindTable.cpp b/lldb/source/Symbol/UnwindTable.cpp
index fe69e41b36382..77681c477a4ac 100644
--- a/lldb/source/Symbol/UnwindTable.cpp
+++ b/lldb/source/Symbol/UnwindTable.cpp
@@ -108,7 +108,7 @@ llvm::Optional<AddressRange> UnwindTable::GetAddressRange(const Address &addr,
if (m_debug_frame_up && m_debug_frame_up->GetAddressRange(addr, range))
return range;
- return llvm::None;
+ return std::nullopt;
}
FuncUnwindersSP
diff --git a/lldb/source/Target/MemoryTagMap.cpp b/lldb/source/Target/MemoryTagMap.cpp
index 846eef9209da3..4fe5c8b2b3386 100644
--- a/lldb/source/Target/MemoryTagMap.cpp
+++ b/lldb/source/Target/MemoryTagMap.cpp
@@ -59,6 +59,6 @@ llvm::Optional<lldb::addr_t> MemoryTagMap::GetTag(lldb::addr_t addr) const {
// were inserted.
auto found = m_addr_to_tag.find(addr);
if (found == m_addr_to_tag.end())
- return llvm::None;
+ return std::nullopt;
return found->second;
}
diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp
index cbee5934846a0..61a4841fbe5f4 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/source/Target/PathMappingList.cpp
@@ -235,7 +235,7 @@ PathMappingList::ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const {
AppendPathComponents(fixed, path_ref, orig_style);
return removed_prefix;
}
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<FileSpec> PathMappingList::FindFile(const FileSpec &orig_spec) const {
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 7bb2b1ccf7cbb..0e258f0f96a69 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -1810,7 +1810,7 @@ lldb::ProcessSP Platform::DoConnectProcess(llvm::StringRef connect_url,
if (synchronous) {
EventSP event_sp;
- process_sp->WaitForProcessToStop(llvm::None, &event_sp, true, listener_sp,
+ process_sp->WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp,
nullptr);
process_sp->RestoreProcessEvents();
bool pop_process_io_handler = false;
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 694e5dc93e675..f12a01df86b74 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1372,8 +1372,8 @@ Status Process::ResumeSynchronous(Stream *stream) {
Status error = PrivateResume();
if (error.Success()) {
- StateType state = WaitForProcessToStop(llvm::None, nullptr, true,
- listener_sp, stream);
+ StateType state =
+ WaitForProcessToStop(std::nullopt, nullptr, true, listener_sp, stream);
const bool must_be_alive =
false; // eStateExited is ok, so this must be false
if (!StateIsStoppedState(state, must_be_alive))
@@ -2636,7 +2636,7 @@ Status Process::LoadCore() {
// Wait for a stopped event since we just posted one above...
lldb::EventSP event_sp;
StateType state =
- WaitForProcessToStop(llvm::None, &event_sp, true, listener_sp);
+ WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp);
if (!StateIsStoppedState(state, false)) {
Log *log = GetLog(LLDBLog::Process);
@@ -3038,7 +3038,7 @@ Status Process::ConnectRemote(llvm::StringRef remote_url) {
if (error.Success()) {
if (GetID() != LLDB_INVALID_PROCESS_ID) {
EventSP event_sp;
- StateType state = WaitForProcessStopPrivate(event_sp, llvm::None);
+ StateType state = WaitForProcessStopPrivate(event_sp, std::nullopt);
if (state == eStateStopped || state == eStateCrashed) {
// If we attached and actually have a process on the other end, then
@@ -3785,7 +3785,7 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
bool interrupt_requested = false;
while (!exit_now) {
EventSP event_sp;
- GetEventsPrivate(event_sp, llvm::None, control_only);
+ GetEventsPrivate(event_sp, std::nullopt, control_only);
if (event_sp->BroadcasterIs(&m_private_state_control_broadcaster)) {
LLDB_LOGF(log,
"Process::%s (arg = %p, pid = %" PRIu64
@@ -4609,7 +4609,7 @@ GetExpressionTimeout(const EvaluateExpressionOptions &options,
return GetOneThreadExpressionTimeout(options);
if (!options.GetTimeout())
- return llvm::None;
+ return std::nullopt;
else
return *options.GetTimeout() - GetOneThreadExpressionTimeout(options);
}
@@ -4663,7 +4663,7 @@ HandleStoppedEvent(lldb::tid_t thread_id, const ThreadPlanSP &thread_plan_sp,
if (!handle_interrupts &&
Process::ProcessEventData::GetInterruptedFromEvent(event_sp.get()))
- return llvm::None;
+ return std::nullopt;
LLDB_LOG(log, "thread plan did not successfully complete");
if (!options.DoesUnwindOnError())
diff --git a/lldb/source/Target/ProcessTrace.cpp b/lldb/source/Target/ProcessTrace.cpp
index 6b147cb285a70..061af9e0e520f 100644
--- a/lldb/source/Target/ProcessTrace.cpp
+++ b/lldb/source/Target/ProcessTrace.cpp
@@ -63,7 +63,7 @@ void ProcessTrace::DidAttach(ArchSpec &process_arch) {
SetPrivateState(eStateStopped);
EventSP event_sp;
- WaitForProcessToStop(llvm::None, &event_sp, true, listener_sp);
+ WaitForProcessToStop(std::nullopt, &event_sp, true, listener_sp);
RestoreProcessEvents();
diff --git a/lldb/source/Target/RemoteAwarePlatform.cpp b/lldb/source/Target/RemoteAwarePlatform.cpp
index c7b0ade845cf1..ea3011eebdc17 100644
--- a/lldb/source/Target/RemoteAwarePlatform.cpp
+++ b/lldb/source/Target/RemoteAwarePlatform.cpp
@@ -308,13 +308,13 @@ bool RemoteAwarePlatform::GetRemoteOSVersion() {
llvm::Optional<std::string> RemoteAwarePlatform::GetRemoteOSBuildString() {
if (m_remote_platform_sp)
return m_remote_platform_sp->GetRemoteOSBuildString();
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<std::string> RemoteAwarePlatform::GetRemoteOSKernelDescription() {
if (m_remote_platform_sp)
return m_remote_platform_sp->GetRemoteOSKernelDescription();
- return llvm::None;
+ return std::nullopt;
}
ArchSpec RemoteAwarePlatform::GetRemoteSystemArchitecture() {
diff --git a/lldb/source/Target/Statistics.cpp b/lldb/source/Target/Statistics.cpp
index 268b7ccaf3f95..c739ac7058cae 100644
--- a/lldb/source/Target/Statistics.cpp
+++ b/lldb/source/Target/Statistics.cpp
@@ -158,7 +158,7 @@ json::Value TargetStats::ToJSON(Target &target) {
void TargetStats::SetLaunchOrAttachTime() {
m_launch_or_attach_time = StatsClock::now();
- m_first_private_stop_time = llvm::None;
+ m_first_private_stop_time = std::nullopt;
}
void TargetStats::SetFirstPrivateStopTime() {
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 22071b76a805b..bbb685f117ab8 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3176,7 +3176,7 @@ Status Target::Launch(ProcessLaunchInfo &launch_info, Stream *stream) {
assert(launch_info.GetHijackListener());
EventSP first_stop_event_sp;
- state = m_process_sp->WaitForProcessToStop(llvm::None, &first_stop_event_sp,
+ state = m_process_sp->WaitForProcessToStop(std::nullopt, &first_stop_event_sp,
rebroadcast_first_stop,
launch_info.GetHijackListener());
m_process_sp->RestoreProcessEvents();
@@ -3332,8 +3332,9 @@ Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) {
if (async) {
process_sp->RestoreProcessEvents();
} else {
- state = process_sp->WaitForProcessToStop(
- llvm::None, nullptr, false, attach_info.GetHijackListener(), stream);
+ state = process_sp->WaitForProcessToStop(std::nullopt, nullptr, false,
+ attach_info.GetHijackListener(),
+ stream);
process_sp->RestoreProcessEvents();
if (state != eStateStopped) {
diff --git a/lldb/source/Target/Trace.cpp b/lldb/source/Target/Trace.cpp
index 68220253c45e6..f4c35bf1b1248 100644
--- a/lldb/source/Target/Trace.cpp
+++ b/lldb/source/Target/Trace.cpp
@@ -52,7 +52,7 @@ template <typename K, typename V>
static Optional<V> Lookup(DenseMap<K, V> &map, K k) {
auto it = map.find(k);
if (it == map.end())
- return None;
+ return std::nullopt;
return it->second;
}
@@ -69,7 +69,7 @@ template <typename K1, typename K2, typename V>
static Optional<V> Lookup(DenseMap<K1, DenseMap<K2, V>> &map, K1 k1, K2 k2) {
auto it = map.find(k1);
if (it == map.end())
- return None;
+ return std::nullopt;
return Lookup(it->second, k2);
}
@@ -236,7 +236,7 @@ Trace::GetLiveThreadBinaryData(lldb::tid_t tid, llvm::StringRef kind) {
kind.data(), tid);
TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(), tid,
- /*cpu_id=*/None};
+ /*cpu_id=*/std::nullopt};
return GetLiveTraceBinaryData(request, *size);
}
@@ -254,7 +254,7 @@ Trace::GetLiveCpuBinaryData(lldb::cpu_id_t cpu_id, llvm::StringRef kind) {
kind.data(), cpu_id);
TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(),
- /*tid=*/None, cpu_id};
+ /*tid=*/std::nullopt, cpu_id};
return m_live_process->TraceGetBinaryData(request);
}
@@ -267,7 +267,8 @@ Trace::GetLiveProcessBinaryData(llvm::StringRef kind) {
"Tracing data \"%s\" is not available for the process.", kind.data());
TraceGetBinaryDataRequest request{GetPluginName().str(), kind.str(),
- /*tid=*/None, /*cpu_id*/ None};
+ /*tid=*/std::nullopt,
+ /*cpu_id*/ std::nullopt};
return GetLiveTraceBinaryData(request, *size);
}
diff --git a/lldb/source/Target/TraceDumper.cpp b/lldb/source/Target/TraceDumper.cpp
index 268dc039365f7..374c8ad922650 100644
--- a/lldb/source/Target/TraceDumper.cpp
+++ b/lldb/source/Target/TraceDumper.cpp
@@ -22,7 +22,7 @@ using namespace llvm;
/// The given string or \b None if it's empty.
static Optional<const char *> ToOptionalString(const char *s) {
if (!s)
- return None;
+ return std::nullopt;
return s;
}
@@ -409,7 +409,7 @@ class OutputWriterJSON : public TraceDumper::OutputWriter {
m_j.attribute("timestamp_ns", item.timestamp
? Optional<std::string>(
std::to_string(*item.timestamp))
- : None);
+ : std::nullopt);
if (item.event) {
DumpEvent(item);
diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index e4d5405445eaa..519e516a50c30 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -313,7 +313,7 @@ llvm::Optional<FileSpec::Style> FileSpec::GuessPathStyle(llvm::StringRef absolut
(absolute_path.substr(1, 2) == R"(:\)" ||
absolute_path.substr(1, 2) == R"(:/)"))
return Style::windows;
- return llvm::None;
+ return std::nullopt;
}
// Dump the object to the supplied stream. If the object contains a valid
diff --git a/lldb/source/Utility/StringExtractorGDBRemote.cpp b/lldb/source/Utility/StringExtractorGDBRemote.cpp
index fc740615dd05a..882af91988c0a 100644
--- a/lldb/source/Utility/StringExtractorGDBRemote.cpp
+++ b/lldb/source/Utility/StringExtractorGDBRemote.cpp
@@ -652,7 +652,7 @@ StringExtractorGDBRemote::GetPidTid(lldb::pid_t default_pid) {
} else if (view.consumeInteger(16, pid) || pid == 0) {
// not a valid hex integer OR unsupported pid 0
m_index = UINT64_MAX;
- return llvm::None;
+ return std::nullopt;
}
// "." must follow if we expect TID too; otherwise, we assume -1
@@ -671,7 +671,7 @@ StringExtractorGDBRemote::GetPidTid(lldb::pid_t default_pid) {
} else if (view.consumeInteger(16, tid) || tid == 0 || pid == AllProcesses) {
// not a valid hex integer OR tid 0 OR pid -1 + a specific tid
m_index = UINT64_MAX;
- return llvm::None;
+ return std::nullopt;
}
// update m_index
diff --git a/lldb/source/Utility/UriParser.cpp b/lldb/source/Utility/UriParser.cpp
index b7771d57aefdb..3da90f1d5b860 100644
--- a/lldb/source/Utility/UriParser.cpp
+++ b/lldb/source/Utility/UriParser.cpp
@@ -30,7 +30,7 @@ llvm::Optional<URI> URI::Parse(llvm::StringRef uri) {
const llvm::StringRef kSchemeSep("://");
auto pos = uri.find(kSchemeSep);
if (pos == std::string::npos)
- return llvm::None;
+ return std::nullopt;
// Extract path.
ret.scheme = uri.substr(0, pos);
@@ -50,12 +50,12 @@ llvm::Optional<URI> URI::Parse(llvm::StringRef uri) {
// hostname is enclosed with square brackets.
pos = host_port.rfind(']');
if (pos == std::string::npos)
- return llvm::None;
+ return std::nullopt;
ret.hostname = host_port.substr(1, pos - 1);
host_port = host_port.drop_front(pos + 1);
if (!host_port.empty() && !host_port.consume_front(":"))
- return llvm::None;
+ return std::nullopt;
} else {
std::tie(ret.hostname, host_port) = host_port.split(':');
}
@@ -64,10 +64,10 @@ llvm::Optional<URI> URI::Parse(llvm::StringRef uri) {
if (!host_port.empty()) {
uint16_t port_value = 0;
if (host_port.getAsInteger(0, port_value))
- return llvm::None;
+ return std::nullopt;
ret.port = port_value;
} else
- ret.port = llvm::None;
+ ret.port = std::nullopt;
return ret;
}
diff --git a/lldb/source/Utility/UserIDResolver.cpp b/lldb/source/Utility/UserIDResolver.cpp
index 73bdde77cc0fb..20a3779243690 100644
--- a/lldb/source/Utility/UserIDResolver.cpp
+++ b/lldb/source/Utility/UserIDResolver.cpp
@@ -18,23 +18,23 @@ llvm::Optional<llvm::StringRef> UserIDResolver::Get(
llvm::Optional<std::string> (UserIDResolver::*do_get)(id_t)) {
std::lock_guard<std::mutex> guard(m_mutex);
- auto iter_bool = cache.try_emplace(id, llvm::None);
+ auto iter_bool = cache.try_emplace(id, std::nullopt);
if (iter_bool.second)
iter_bool.first->second = (this->*do_get)(id);
if (iter_bool.first->second)
return llvm::StringRef(*iter_bool.first->second);
- return llvm::None;
+ return std::nullopt;
}
namespace {
class NoopResolver : public UserIDResolver {
protected:
llvm::Optional<std::string> DoGetUserName(id_t uid) override {
- return llvm::None;
+ return std::nullopt;
}
llvm::Optional<std::string> DoGetGroupName(id_t gid) override {
- return llvm::None;
+ return std::nullopt;
}
};
} // namespace
diff --git a/lldb/tools/lldb-server/lldb-platform.cpp b/lldb/tools/lldb-server/lldb-platform.cpp
index 9f8b4c7d67ee3..0211de77bb75b 100644
--- a/lldb/tools/lldb-server/lldb-platform.cpp
+++ b/lldb/tools/lldb-server/lldb-platform.cpp
@@ -366,7 +366,7 @@ int main_platform(int argc, char *argv[]) {
bool interrupt = false;
bool done = false;
while (!interrupt && !done) {
- if (platform.GetPacketAndSendResponse(llvm::None, error, interrupt,
+ if (platform.GetPacketAndSendResponse(std::nullopt, error, interrupt,
done) !=
GDBRemoteCommunication::PacketResult::Success)
break;
diff --git a/lldb/tools/lldb-vscode/JSONUtils.h b/lldb/tools/lldb-vscode/JSONUtils.h
index c812ec87beab0..011c107b9ab12 100644
--- a/lldb/tools/lldb-vscode/JSONUtils.h
+++ b/lldb/tools/lldb-vscode/JSONUtils.h
@@ -208,9 +208,10 @@ void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
/// It is useful to ensure the same line
/// provided by the setBreakpoints request are returned to the IDE as a
/// fallback.
-void AppendBreakpoint(lldb::SBBreakpoint &bp, llvm::json::Array &breakpoints,
- llvm::Optional<llvm::StringRef> request_path = llvm::None,
- llvm::Optional<uint32_t> request_line = llvm::None);
+void AppendBreakpoint(
+ lldb::SBBreakpoint &bp, llvm::json::Array &breakpoints,
+ llvm::Optional<llvm::StringRef> request_path = std::nullopt,
+ llvm::Optional<uint32_t> request_line = std::nullopt);
/// Converts breakpoint location to a Visual Studio Code "Breakpoint"
///
@@ -235,8 +236,8 @@ void AppendBreakpoint(lldb::SBBreakpoint &bp, llvm::json::Array &breakpoints,
/// definition outlined by Microsoft.
llvm::json::Value
CreateBreakpoint(lldb::SBBreakpoint &bp,
- llvm::Optional<llvm::StringRef> request_path = llvm::None,
- llvm::Optional<uint32_t> request_line = llvm::None);
+ llvm::Optional<llvm::StringRef> request_path = std::nullopt,
+ llvm::Optional<uint32_t> request_line = std::nullopt);
/// Converts a LLDB module to a VS Code DAP module for use in "modules" events.
///
diff --git a/lldb/tools/lldb-vscode/ProgressEvent.cpp b/lldb/tools/lldb-vscode/ProgressEvent.cpp
index 5c1f8c63ebefc..69a8a2eabb95b 100644
--- a/lldb/tools/lldb-vscode/ProgressEvent.cpp
+++ b/lldb/tools/lldb-vscode/ProgressEvent.cpp
@@ -69,14 +69,14 @@ Optional<ProgressEvent> ProgressEvent::Create(uint64_t progress_id,
const ProgressEvent *prev_event) {
// If it's an update without a previous event, we abort
if (completed > 0 && completed < total && !prev_event)
- return None;
+ return std::nullopt;
ProgressEvent event(progress_id, message, completed, total, prev_event);
// We shouldn't show unnamed start events in the IDE
if (event.GetEventType() == progressStart && event.GetEventName().empty())
- return None;
+ return std::nullopt;
if (prev_event && prev_event->EqualsForIDE(event))
- return None;
+ return std::nullopt;
return event;
}
@@ -163,7 +163,7 @@ const ProgressEvent &ProgressEventManager::GetMostRecentEvent() const {
void ProgressEventManager::Update(uint64_t progress_id, uint64_t completed,
uint64_t total) {
if (Optional<ProgressEvent> event = ProgressEvent::Create(
- progress_id, None, completed, total, &GetMostRecentEvent())) {
+ progress_id, std::nullopt, completed, total, &GetMostRecentEvent())) {
if (event->GetEventType() == progressEnd)
m_finished = true;
More information about the lldb-commits
mailing list