[lldb] Use std::optional instead of llvm::Optional (NFC)

This patch replaces (llvm::|)Optional< with std::optional<.  I'll post
a separate patch to clean up the "using" declarations, #include
"llvm/ADT/Optional.h", etc.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
Kazu Hirata
2023-01-07 14:18:35 -08:00
parent f190ce625a
commit 2fe8327406
387 changed files with 1323 additions and 1324 deletions

View File

@@ -941,7 +941,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess(
return true;
}
llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordThread(
const char *python_function_name, const char *session_dictionary_name,
lldb::ThreadSP thread) {
if (python_function_name == NULL || python_function_name[0] == '\0' ||
@@ -988,7 +988,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordTarget(
return true;
}
llvm::Optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
std::optional<std::string> lldb_private::LLDBSWIGPythonRunScriptKeywordFrame(
const char *python_function_name, const char *session_dictionary_name,
lldb::StackFrameSP frame) {
if (python_function_name == NULL || python_function_name[0] == '\0' ||

View File

@@ -44,7 +44,7 @@ rules of thumb:
missing object files, or otherwise inconsistent debug info, LLVM's
error handling types such as `llvm::Expected<T>
<https://llvm.org/doxygen/classllvm_1_1Expected.html>`_ or
`llvm::Optional<T>
`std::optional<T>
<https://llvm.org/doxygen/classllvm_1_1Optional.html>`_ should be
used. Functions that may fail should return their result using these
wrapper types instead of using a bool to indicate success. Returning

View File

@@ -58,7 +58,7 @@ public:
/// If \p input was not a valid breakpoint ID string, returns
/// \b std::nullopt. Otherwise returns a BreakpointID with members filled
/// out accordingly.
static llvm::Optional<BreakpointID>
static std::optional<BreakpointID>
ParseCanonicalReference(llvm::StringRef input);
/// Takes an input string and checks to see whether it is a breakpoint name.

View File

@@ -206,7 +206,7 @@ protected:
void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list,
bool skip_prologue, llvm::StringRef log_ident,
uint32_t line = 0,
llvm::Optional<uint16_t> column = std::nullopt);
std::optional<uint16_t> column = std::nullopt);
void SetSCMatchesByLine(SearchFilter &, SymbolContextList &, bool,
const char *) = delete;

View File

@@ -25,7 +25,7 @@ public:
BreakpointResolverFileLine(
const lldb::BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue,
const SourceLocationSpec &location_spec,
llvm::Optional<llvm::StringRef> removed_prefix_opt = std::nullopt);
std::optional<llvm::StringRef> removed_prefix_opt = std::nullopt);
static BreakpointResolver *
CreateFromStructuredData(const lldb::BreakpointSP &bkpt,
@@ -66,7 +66,7 @@ protected:
bool m_skip_prologue;
// Any previously removed file path prefix by reverse source mapping.
// This is used to auto deduce source map if needed.
llvm::Optional<llvm::StringRef> m_removed_prefix_opt;
std::optional<llvm::StringRef> m_removed_prefix_opt;
private:
BreakpointResolverFileLine(const BreakpointResolverFileLine &) = delete;

View File

@@ -108,13 +108,13 @@ private:
/// it is out of date.
struct CacheSignature {
/// UUID of object file or module.
llvm::Optional<UUID> m_uuid = std::nullopt;
std::optional<UUID> m_uuid = std::nullopt;
/// Modification time of file on disk.
llvm::Optional<std::time_t> m_mod_time = std::nullopt;
std::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 = std::nullopt;
std::optional<std::time_t> m_obj_mod_time = std::nullopt;
CacheSignature() = default;

View File

@@ -174,7 +174,7 @@ public:
ScriptInterpreter *
GetScriptInterpreter(bool can_create = true,
llvm::Optional<lldb::ScriptLanguage> language = {});
std::optional<lldb::ScriptLanguage> language = {});
lldb::ListenerSP GetListener() { return m_listener_sp; }
@@ -403,7 +403,7 @@ public:
/// ensure the given warning is only broadcast once.
static void
ReportWarning(std::string message,
llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
std::optional<lldb::user_id_t> debugger_id = std::nullopt,
std::once_flag *once = nullptr);
/// Report error events.
@@ -425,7 +425,7 @@ public:
/// ensure the given error is only broadcast once.
static void
ReportError(std::string message,
llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
std::optional<lldb::user_id_t> debugger_id = std::nullopt,
std::once_flag *once = nullptr);
/// Report info events.
@@ -445,7 +445,7 @@ public:
/// ensure the given info is only logged once.
static void
ReportInfo(std::string message,
llvm::Optional<lldb::user_id_t> debugger_id = std::nullopt,
std::optional<lldb::user_id_t> debugger_id = std::nullopt,
std::once_flag *once = nullptr);
static void ReportSymbolChange(const ModuleSpec &module_spec);
@@ -486,11 +486,11 @@ protected:
/// delivered to all debuggers.
static void ReportProgress(uint64_t progress_id, const std::string &message,
uint64_t completed, uint64_t total,
llvm::Optional<lldb::user_id_t> debugger_id);
std::optional<lldb::user_id_t> debugger_id);
static void ReportDiagnosticImpl(DiagnosticEventData::Type type,
std::string message,
llvm::Optional<lldb::user_id_t> debugger_id,
std::optional<lldb::user_id_t> debugger_id,
std::once_flag *once);
void PrintProgress(const ProgressEventData &data);
@@ -574,7 +574,7 @@ protected:
IOHandlerStack m_io_handler_stack;
std::recursive_mutex m_io_handler_synchronous_mutex;
llvm::Optional<uint64_t> m_current_event_id;
std::optional<uint64_t> m_current_event_id;
llvm::StringMap<std::weak_ptr<LogHandler>> m_stream_handlers;
std::shared_ptr<CallbackLogHandler> m_callback_handler_sp;

View File

@@ -378,7 +378,7 @@ public:
virtual bool TestEmulation(Stream *out_stream, ArchSpec &arch,
OptionValueDictionary *test_data) = 0;
virtual llvm::Optional<RegisterInfo>
virtual std::optional<RegisterInfo>
GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) = 0;
// Optional overrides
@@ -391,7 +391,7 @@ public:
uint32_t reg_num, std::string &reg_name);
// RegisterInfo variants
llvm::Optional<RegisterValue> ReadRegister(const RegisterInfo &reg_info);
std::optional<RegisterValue> ReadRegister(const RegisterInfo &reg_info);
uint64_t ReadRegisterUnsigned(const RegisterInfo &reg_info,
uint64_t fail_value, bool *success_ptr);

View File

@@ -113,12 +113,12 @@ public:
/// The stream to which the highlighted version of the user string should
/// be written.
virtual void Highlight(const HighlightStyle &options, llvm::StringRef line,
llvm::Optional<size_t> cursor_pos,
std::optional<size_t> cursor_pos,
llvm::StringRef previous_lines, Stream &s) const = 0;
/// Utility method for calling Highlight without a stream.
std::string Highlight(const HighlightStyle &options, llvm::StringRef line,
llvm::Optional<size_t> cursor_pos,
std::optional<size_t> cursor_pos,
llvm::StringRef previous_lines = "") const;
};
@@ -129,7 +129,7 @@ public:
llvm::StringRef GetName() const override { return "none"; }
void Highlight(const HighlightStyle &options, llvm::StringRef line,
llvm::Optional<size_t> cursor_pos,
std::optional<size_t> cursor_pos,
llvm::StringRef previous_lines, Stream &s) const override;
};

View File

@@ -201,8 +201,8 @@ public:
virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
virtual llvm::Optional<std::string> IOHandlerSuggestion(IOHandler &io_handler,
llvm::StringRef line);
virtual std::optional<std::string> IOHandlerSuggestion(IOHandler &io_handler,
llvm::StringRef line);
virtual void IOHandlerComplete(IOHandler &io_handler,
CompletionRequest &request);
@@ -418,7 +418,7 @@ private:
int FixIndentationCallback(Editline *editline, const StringList &lines,
int cursor_position);
llvm::Optional<std::string> SuggestionCallback(llvm::StringRef line);
std::optional<std::string> SuggestionCallback(llvm::StringRef line);
void AutoCompleteCallback(CompletionRequest &request);
#endif

View File

@@ -842,11 +842,11 @@ public:
void ReportErrorIfModifyDetected(const char *format, ...)
__attribute__((format(printf, 2, 3)));
void ReportWarningOptimization(llvm::Optional<lldb::user_id_t> debugger_id);
void ReportWarningOptimization(std::optional<lldb::user_id_t> debugger_id);
void
ReportWarningUnsupportedLanguage(lldb::LanguageType language,
llvm::Optional<lldb::user_id_t> debugger_id);
std::optional<lldb::user_id_t> debugger_id);
// Return true if the file backing this module has changed since the module
// was originally created since we saved the initial file modification time
@@ -895,7 +895,7 @@ public:
/// \return
/// The newly remapped filespec that is may or may not exist if
/// \a path was successfully located.
llvm::Optional<std::string> RemapSourceFile(llvm::StringRef path) const;
std::optional<std::string> RemapSourceFile(llvm::StringRef path) const;
bool RemapSourceFile(const char *, std::string &) const = delete;
/// Update the ArchSpec to a more specific variant.
@@ -1054,9 +1054,9 @@ protected:
lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
/// parser for this module as it may or may
/// not be shared with the SymbolFile
llvm::Optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders
/// objects created for this
/// Module's functions
std::optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders
/// objects created for this
/// Module's functions
lldb::SymbolVendorUP
m_symfile_up; ///< A pointer to the symbol vendor for this module.
std::vector<lldb::SymbolVendorUP>

View File

@@ -103,7 +103,7 @@ private:
const uint64_t m_total;
/// The optional debugger ID to report progress to. If this has no value then
/// all debuggers will receive this event.
llvm::Optional<lldb::user_id_t> m_debugger_id;
std::optional<lldb::user_id_t> m_debugger_id;
/// Set to true when progress has been reported where m_completed == m_total
/// to ensure that we don't send progress updates after progress has
/// completed.

View File

@@ -48,7 +48,7 @@ public:
/// Whether to look for an exact match.
///
explicit SourceLocationSpec(FileSpec file_spec, uint32_t line,
llvm::Optional<uint16_t> column = std::nullopt,
std::optional<uint16_t> column = std::nullopt,
bool check_inlines = false,
bool exact_match = false);
@@ -166,9 +166,9 @@ public:
FileSpec GetFileSpec() const { return m_declaration.GetFile(); }
llvm::Optional<uint32_t> GetLine() const;
std::optional<uint32_t> GetLine() const;
llvm::Optional<uint16_t> GetColumn() const;
std::optional<uint16_t> GetColumn() const;
bool GetCheckInlines() const { return m_check_inlines; }

View File

@@ -42,7 +42,7 @@ public:
void UpdateIfNeeded();
size_t DisplaySourceLines(uint32_t line, llvm::Optional<size_t> column,
size_t DisplaySourceLines(uint32_t line, std::optional<size_t> column,
uint32_t context_before, uint32_t context_after,
Stream *s);
void FindLinesMatchingRegex(RegularExpression &regex, uint32_t start_line,

View File

@@ -358,7 +358,7 @@ public:
virtual bool CanProvideValue();
// Subclasses must implement the functions below.
virtual llvm::Optional<uint64_t> GetByteSize() = 0;
virtual std::optional<uint64_t> GetByteSize() = 0;
virtual lldb::ValueType GetValueType() const = 0;

View File

@@ -31,7 +31,7 @@ public:
ConstString name,
const CompilerType &cast_type);
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
size_t CalculateNumChildren(uint32_t max) override;

View File

@@ -31,7 +31,7 @@ class ValueObjectChild : public ValueObject {
public:
~ValueObjectChild() override;
llvm::Optional<uint64_t> GetByteSize() override { return m_byte_size; }
std::optional<uint64_t> GetByteSize() override { return m_byte_size; }
lldb::offset_t GetByteOffset() override { return m_byte_offset; }
@@ -70,7 +70,7 @@ protected:
uint8_t m_bitfield_bit_offset;
bool m_is_base_class;
bool m_is_deref_of_parent;
llvm::Optional<LazyBool> m_can_update_with_invalid_exe_ctx;
std::optional<LazyBool> m_can_update_with_invalid_exe_ctx;
friend class ValueObject;
friend class ValueObjectConstResult;

View File

@@ -63,7 +63,7 @@ public:
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
const Status &error);
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
lldb::ValueType GetValueType() const override;
@@ -114,7 +114,7 @@ protected:
CompilerType GetCompilerTypeImpl() override;
ConstString m_type_name;
llvm::Optional<uint64_t> m_byte_size;
std::optional<uint64_t> m_byte_size;
ValueObjectConstResultImpl m_impl;

View File

@@ -35,7 +35,7 @@ class ValueObjectDynamicValue : public ValueObject {
public:
~ValueObjectDynamicValue() override = default;
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;

View File

@@ -41,7 +41,7 @@ public:
const Address &address,
const CompilerType &ast_type);
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;

View File

@@ -37,7 +37,7 @@ public:
lldb::RegisterContextSP &reg_ctx_sp,
uint32_t set_idx);
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
lldb::ValueType GetValueType() const override {
return lldb::eValueTypeRegisterSet;
@@ -87,7 +87,7 @@ public:
lldb::RegisterContextSP &reg_ctx_sp,
const RegisterInfo *reg_info);
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
lldb::ValueType GetValueType() const override {
return lldb::eValueTypeRegister;

View File

@@ -37,7 +37,7 @@ class ValueObjectSynthetic : public ValueObject {
public:
~ValueObjectSynthetic() override;
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;

View File

@@ -38,7 +38,7 @@ public:
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
const lldb::VariableSP &var_sp);
llvm::Optional<uint64_t> GetByteSize() override;
std::optional<uint64_t> GetByteSize() override;
ConstString GetTypeName() override;

View File

@@ -33,7 +33,7 @@ public:
virtual ~ExpressionVariable();
llvm::Optional<uint64_t> GetByteSize() { return m_frozen_sp->GetByteSize(); }
std::optional<uint64_t> GetByteSize() { return m_frozen_sp->GetByteSize(); }
ConstString GetName() { return m_frozen_sp->GetName(); }
@@ -227,7 +227,7 @@ public:
virtual void
RemovePersistentVariable(lldb::ExpressionVariableSP variable) = 0;
virtual llvm::Optional<CompilerType>
virtual std::optional<CompilerType>
GetCompilerTypeFromPersistentDecl(ConstString type_name) = 0;
virtual lldb::addr_t LookupSymbol(ConstString name);

View File

@@ -99,7 +99,7 @@ using FixIndentationCallbackType =
llvm::unique_function<int(Editline *, StringList &, int)>;
using SuggestionCallbackType =
llvm::unique_function<llvm::Optional<std::string>(llvm::StringRef)>;
llvm::unique_function<std::optional<std::string>(llvm::StringRef)>;
using CompleteCallbackType = llvm::unique_function<void(CompletionRequest &)>;

View File

@@ -438,10 +438,10 @@ private:
class SerialPort : public NativeFile {
public:
struct Options {
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;
std::optional<unsigned int> BaudRate = std::nullopt;
std::optional<Terminal::Parity> Parity = std::nullopt;
std::optional<Terminal::ParityCheck> ParityCheck = std::nullopt;
std::optional<unsigned int> StopBits = std::nullopt;
};
// Obtain Options corresponding to the passed URL query string

View File

@@ -196,7 +196,7 @@ public:
void SetHomeDirectory(std::string home_directory);
private:
static llvm::Optional<FileSystem> &InstanceImpl();
static std::optional<FileSystem> &InstanceImpl();
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
std::string m_home_directory;
};

View File

@@ -65,7 +65,8 @@ public:
static const ArchSpec &
GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
static std::optional<ArchitectureKind>
ParseArchitectureKind(llvm::StringRef kind);
/// Returns the directory containing the lldb shared library. Only the
/// directory member of the FileSpec is filled in.

View File

@@ -172,7 +172,7 @@ public:
// Watchpoint functions
virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const;
virtual llvm::Optional<std::pair<uint32_t, uint32_t>>
virtual std::optional<std::pair<uint32_t, uint32_t>>
GetHardwareDebugSupportInfo() const;
virtual Status SetWatchpoint(lldb::addr_t addr, size_t size,
@@ -205,7 +205,7 @@ public:
GetAuxvData() const = 0;
// Exit Status
virtual llvm::Optional<WaitStatus> GetExitStatus();
virtual std::optional<WaitStatus> GetExitStatus();
virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange);
@@ -423,7 +423,7 @@ protected:
lldb::StateType m_state = lldb::eStateInvalid;
mutable std::recursive_mutex m_state_mutex;
llvm::Optional<WaitStatus> m_exit_status;
std::optional<WaitStatus> m_exit_status;
NativeDelegate &m_delegate;
NativeWatchpointList m_watchpoint_list;

View File

@@ -19,7 +19,7 @@ namespace lldb_private {
class HostInfoFreeBSD : public HostInfoPosix {
public:
static llvm::VersionTuple GetOSVersion();
static llvm::Optional<std::string> GetOSBuildString();
static std::optional<std::string> GetOSBuildString();
static FileSpec GetProgramFileSpec();
};
}

View File

@@ -16,7 +16,7 @@
namespace lldb_private {
// Get PID (i.e. the primary thread ID) corresponding to the specified TID.
llvm::Optional<lldb::pid_t> getPIDForTID(lldb::pid_t tid);
std::optional<lldb::pid_t> getPIDForTID(lldb::pid_t tid);
} // namespace lldb_private

View File

@@ -27,7 +27,7 @@ public:
static void Terminate();
static llvm::VersionTuple GetOSVersion();
static llvm::Optional<std::string> GetOSBuildString();
static std::optional<std::string> GetOSBuildString();
static llvm::StringRef GetDistributionId();
static FileSpec GetProgramFileSpec();

View File

@@ -25,7 +25,7 @@ class HostInfoMacOSX : public HostInfoPosix {
public:
static llvm::VersionTuple GetOSVersion();
static llvm::VersionTuple GetMacCatalystVersion();
static llvm::Optional<std::string> GetOSBuildString();
static std::optional<std::string> GetOSBuildString();
static FileSpec GetProgramFileSpec();
static FileSpec GetXcodeContentsDirectory();
static FileSpec GetXcodeDeveloperDirectory();

View File

@@ -19,7 +19,7 @@ namespace lldb_private {
class HostInfoNetBSD : public HostInfoPosix {
public:
static llvm::VersionTuple GetOSVersion();
static llvm::Optional<std::string> GetOSBuildString();
static std::optional<std::string> GetOSBuildString();
static FileSpec GetProgramFileSpec();
};
}

View File

@@ -19,7 +19,7 @@ namespace lldb_private {
class HostInfoOpenBSD : public HostInfoPosix {
public:
static llvm::VersionTuple GetOSVersion();
static llvm::Optional<std::string> GetOSBuildString();
static std::optional<std::string> GetOSBuildString();
static FileSpec GetProgramFileSpec();
};
}

View File

@@ -23,7 +23,7 @@ class HostInfoPosix : public HostInfoBase {
public:
static size_t GetPageSize();
static bool GetHostname(std::string &s);
static llvm::Optional<std::string> GetOSKernelDescription();
static std::optional<std::string> GetOSKernelDescription();
static uint32_t GetUserID();
static uint32_t GetGroupID();

View File

@@ -28,8 +28,8 @@ public:
static UserIDResolver &GetUserIDResolver();
static llvm::VersionTuple GetOSVersion();
static llvm::Optional<std::string> GetOSBuildString();
static llvm::Optional<std::string> GetOSKernelDescription();
static std::optional<std::string> GetOSBuildString();
static std::optional<std::string> GetOSKernelDescription();
static bool GetHostname(std::string &s);
static FileSpec GetProgramFileSpec();
static FileSpec GetDefaultShell();

View File

@@ -29,7 +29,7 @@ public:
bool IsEmpty() const;
llvm::Optional<llvm::StringRef> FindString(llvm::StringRef input_str) const;
std::optional<llvm::StringRef> FindString(llvm::StringRef input_str) const;
llvm::StringRef GetStringAtIndex(size_t idx) const;

View File

@@ -407,7 +407,7 @@ public:
/// Returns the auto-suggestion string that should be added to the given
/// command line.
llvm::Optional<std::string> GetAutoSuggestionForCommand(llvm::StringRef line);
std::optional<std::string> GetAutoSuggestionForCommand(llvm::StringRef line);
// This handles command line completion.
void HandleCompletion(CompletionRequest &request);
@@ -743,7 +743,7 @@ private:
// The exit code the user has requested when calling the 'quit' command.
// No value means the user hasn't set a custom exit code so far.
llvm::Optional<int> m_quit_exit_code;
std::optional<int> m_quit_exit_code;
// If the driver is accepts custom exit codes for the 'quit' command.
bool m_allow_exit_code = false;

View File

@@ -278,7 +278,7 @@ public:
/// current command line.
/// Otherwise a std::string containing the command to be repeated.
/// If the string is empty, the command won't be allow repeating.
virtual llvm::Optional<std::string>
virtual std::optional<std::string>
GetRepeatCommand(Args &current_command_args, uint32_t index) {
return std::nullopt;
}

View File

@@ -56,8 +56,8 @@ public:
void HandleCompletion(CompletionRequest &request) override;
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override;
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override;
bool Execute(const char *args_string, CommandReturnObject &result) override;
@@ -121,8 +121,8 @@ public:
HandleArgumentCompletion(CompletionRequest &request,
OptionElementVector &opt_element_vector) override;
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override;
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override;
/// \return
/// An error message to be displayed when the command is executed (i.e.

View File

@@ -576,7 +576,7 @@ public:
Status GetStatusFromSBError(const lldb::SBError &error) const;
llvm::Optional<MemoryRegionInfo> GetOpaqueTypeFromSBMemoryRegionInfo(
std::optional<MemoryRegionInfo> GetOpaqueTypeFromSBMemoryRegionInfo(
const lldb::SBMemoryRegionInfo &mem_region) const;
protected:

View File

@@ -36,7 +36,7 @@ public:
virtual Status Stop() { return Status("ScriptedProcess did not stop"); }
virtual llvm::Optional<MemoryRegionInfo>
virtual std::optional<MemoryRegionInfo>
GetMemoryRegionContainingAddress(lldb::addr_t address, Status &error) {
error.SetErrorString("ScriptedProcess have no memory region.");
return {};
@@ -63,7 +63,7 @@ public:
virtual bool IsAlive() { return true; }
virtual llvm::Optional<std::string> GetScriptedThreadPluginName() {
virtual std::optional<std::string> GetScriptedThreadPluginName() {
return std::nullopt;
}
@@ -87,11 +87,11 @@ public:
virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; }
virtual llvm::Optional<std::string> GetName() { return std::nullopt; }
virtual std::optional<std::string> GetName() { return std::nullopt; }
virtual lldb::StateType GetState() { return lldb::eStateInvalid; }
virtual llvm::Optional<std::string> GetQueue() { return std::nullopt; }
virtual std::optional<std::string> GetQueue() { return std::nullopt; }
virtual StructuredData::DictionarySP GetStopReason() { return {}; }
@@ -99,7 +99,7 @@ public:
virtual StructuredData::DictionarySP GetRegisterInfo() { return {}; }
virtual llvm::Optional<std::string> GetRegisterContext() {
virtual std::optional<std::string> GetRegisterContext() {
return std::nullopt;
}

View File

@@ -327,16 +327,15 @@ public:
struct IntegralTemplateArgument;
/// Return the size of the type in bytes.
llvm::Optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope) const;
std::optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope) const;
/// Return the size of the type in bits.
llvm::Optional<uint64_t> GetBitSize(ExecutionContextScope *exe_scope) const;
std::optional<uint64_t> GetBitSize(ExecutionContextScope *exe_scope) const;
lldb::Encoding GetEncoding(uint64_t &count) const;
lldb::Format GetFormat() const;
llvm::Optional<size_t>
GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
std::optional<size_t> GetTypeBitAlign(ExecutionContextScope *exe_scope) const;
uint32_t GetNumChildren(bool omit_empty_base_classes,
const ExecutionContext *exe_ctx) const;
@@ -419,7 +418,7 @@ public:
/// expanded to their supplied arguments. With expand_pack set to false, an
/// arguement pack will count as 1 argument and it is invalid to call this
/// method on the pack argument.
llvm::Optional<IntegralTemplateArgument>
std::optional<IntegralTemplateArgument>
GetIntegralTemplateArgument(size_t idx, bool expand_pack = false) const;
CompilerType GetTypeForFormatters() const;

View File

@@ -123,7 +123,7 @@ private:
bool IsEHFrame() const;
llvm::Optional<FDEEntryMap::Entry>
std::optional<FDEEntryMap::Entry>
GetFirstFDEEntryInRange(const AddressRange &range);
void GetFDEIndex();

View File

@@ -750,7 +750,7 @@ protected:
/// need to use a std::unique_ptr to a llvm::once_flag so if we clear the
/// symbol table, we can have a new once flag to use when it is created again.
std::unique_ptr<llvm::once_flag> m_symtab_once_up;
llvm::Optional<uint32_t> m_cache_hash;
std::optional<uint32_t> m_cache_hash;
/// Sets the architecture for a module. At present the architecture can
/// only be set if it is invalid. It is not allowed to switch from one

View File

@@ -205,7 +205,7 @@ public:
/// To support variable-length array types, this function takes an
/// optional \p ExecutionContext. If \c exe_ctx is non-null, the
/// dynamic characteristics for that context are returned.
virtual llvm::Optional<ArrayInfo>
virtual std::optional<ArrayInfo>
GetDynamicArrayInfoForUID(lldb::user_id_t type_uid,
const lldb_private::ExecutionContext *exe_ctx) = 0;
@@ -502,7 +502,7 @@ protected:
// case it isn't the same as the module
// object file (debug symbols in a separate
// file)
llvm::Optional<std::vector<lldb::CompUnitSP>> m_compile_units;
std::optional<std::vector<lldb::CompUnitSP>> m_compile_units;
TypeList m_type_list;
Symtab *m_symtab = nullptr;
uint32_t m_abilities = 0;

View File

@@ -97,7 +97,7 @@ public:
ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
llvm::Optional<ArrayInfo> GetDynamicArrayInfoForUID(
std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
lldb::user_id_t type_uid,
const lldb_private::ExecutionContext *exe_ctx) override;

View File

@@ -102,7 +102,7 @@ public:
};
Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name,
llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
std::optional<uint64_t> byte_size, SymbolContextScope *context,
lldb::user_id_t encoding_uid, EncodingDataType encoding_uid_type,
const Declaration &decl, const CompilerType &compiler_qual_type,
ResolveState compiler_type_resolve_state, uint32_t opaque_payload = 0);
@@ -138,7 +138,7 @@ public:
ConstString GetBaseName();
llvm::Optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope);
std::optional<uint64_t> GetByteSize(ExecutionContextScope *exe_scope);
uint32_t GetNumChildren(bool omit_empty_base_classes);

View File

@@ -47,7 +47,7 @@ struct LanguageSet {
LanguageSet();
/// If the set contains a single language only, return it.
llvm::Optional<lldb::LanguageType> GetSingularLanguage();
std::optional<lldb::LanguageType> GetSingularLanguage();
void Insert(lldb::LanguageType language);
bool Empty() const;
size_t Size() const;
@@ -286,7 +286,7 @@ public:
virtual const llvm::fltSemantics &GetFloatTypeSemantics(size_t byte_size) = 0;
virtual llvm::Optional<uint64_t>
virtual std::optional<uint64_t>
GetBitSize(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) = 0;
@@ -369,7 +369,7 @@ public:
virtual CompilerType
GetTypeTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx,
bool expand_pack);
virtual llvm::Optional<CompilerType::IntegralTemplateArgument>
virtual std::optional<CompilerType::IntegralTemplateArgument>
GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx,
bool expand_pack);
@@ -435,7 +435,7 @@ public:
virtual bool IsCStringType(lldb::opaque_compiler_type_t type,
uint32_t &length) = 0;
virtual llvm::Optional<size_t>
virtual std::optional<size_t>
GetTypeBitAlign(lldb::opaque_compiler_type_t type,
ExecutionContextScope *exe_scope) = 0;
@@ -517,7 +517,7 @@ public:
// meaningless type itself, instead preferring to use the dynamic type
virtual bool IsMeaninglessWithoutDynamicResolution(void *type);
virtual llvm::Optional<llvm::json::Value> ReportStatistics();
virtual std::optional<llvm::json::Value> ReportStatistics();
bool GetHasForcefullyCompletedTypes() const {
return m_has_forcefully_completed_types;
@@ -575,7 +575,7 @@ private:
/// \return The found type system or an error.
llvm::Expected<lldb::TypeSystemSP> GetTypeSystemForLanguage(
lldb::LanguageType language,
llvm::Optional<CreateCallback> create_callback = std::nullopt);
std::optional<CreateCallback> create_callback = std::nullopt);
};
} // namespace lldb_private

View File

@@ -61,8 +61,8 @@ private:
void Dump(Stream &s);
void Initialize();
llvm::Optional<AddressRange> GetAddressRange(const Address &addr,
SymbolContext &sc);
std::optional<AddressRange> GetAddressRange(const Address &addr,
SymbolContext &sc);
typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection;
typedef collection::iterator iterator;

View File

@@ -151,7 +151,7 @@ public:
/// from the user interface.
virtual bool IsAllowedRuntimeValue(ConstString name) { return false; }
virtual llvm::Optional<CompilerType> GetRuntimeType(CompilerType base_type) {
virtual std::optional<CompilerType> GetRuntimeType(CompilerType base_type) {
return std::nullopt;
}

View File

@@ -121,7 +121,7 @@ public:
/// modified -- within this memory region. This is an Optional return
/// value; it will only be available if the remote stub was able to
/// detail this.
const llvm::Optional<std::vector<lldb::addr_t>> &GetDirtyPageList() const {
const std::optional<std::vector<lldb::addr_t>> &GetDirtyPageList() const {
return m_dirty_pages;
}
@@ -150,7 +150,7 @@ protected:
OptionalBool m_memory_tagged = eDontKnow;
OptionalBool m_is_stack_memory = eDontKnow;
int m_pagesize = 0;
llvm::Optional<std::vector<lldb::addr_t>> m_dirty_pages;
std::optional<std::vector<lldb::addr_t>> m_dirty_pages;
};
inline bool operator<(const MemoryRegionInfo &lhs,

View File

@@ -67,8 +67,8 @@ public:
/// If some of the range was tagged it will have items and some
/// of them may be std::nullopt.
/// (this saves the caller checking whether all items are std::nullopt)
std::vector<llvm::Optional<lldb::addr_t>> GetTags(lldb::addr_t addr,
size_t len) const;
std::vector<std::optional<lldb::addr_t>> GetTags(lldb::addr_t addr,
size_t len) const;
private:
/// Lookup the tag for address
@@ -80,7 +80,7 @@ private:
/// \return
/// The tag for the granule that address refers to, or std::nullopt
/// if it has no memory tag.
llvm::Optional<lldb::addr_t> GetTag(lldb::addr_t addr) const;
std::optional<lldb::addr_t> GetTag(lldb::addr_t addr) const;
// A map of granule aligned addresses to their memory tag
std::map<lldb::addr_t, lldb::addr_t> m_addr_to_tag;
@@ -88,7 +88,7 @@ private:
// Memory tag manager used to align addresses and get granule size.
// Ideally this would be a const& but only certain architectures will
// have a memory tag manager class to provide here. So for a method
// returning a MemoryTagMap, Optional<MemoryTagMap> allows it to handle
// returning a MemoryTagMap, std::optional<MemoryTagMap> allows it to handle
// architectures without memory tagging. Optionals cannot hold references
// so we go with a pointer that we assume will be not be null.
const MemoryTagManager *m_manager;

View File

@@ -90,8 +90,8 @@ public:
///
/// \return
/// The remapped filespec that may or may not exist on disk.
llvm::Optional<FileSpec> RemapPath(llvm::StringRef path,
bool only_if_exists = false) const;
std::optional<FileSpec> RemapPath(llvm::StringRef path,
bool only_if_exists = false) const;
bool RemapPath(const char *, std::string &) const = delete;
/// Perform reverse source path remap for input \a file.
@@ -108,8 +108,8 @@ public:
/// std::nullopt if no remapping happens, otherwise, the matching source
/// map entry's ""to_new_pathto"" part (which is the prefix of \a file) is
/// returned.
llvm::Optional<llvm::StringRef> ReverseRemapPath(const FileSpec &file,
FileSpec &fixed) const;
std::optional<llvm::StringRef> ReverseRemapPath(const FileSpec &file,
FileSpec &fixed) const;
/// Finds a source file given a file spec using the path remappings.
///
@@ -124,7 +124,7 @@ public:
///
/// \return
/// The newly remapped filespec that is guaranteed to exist.
llvm::Optional<FileSpec> FindFile(const FileSpec &orig_spec) const;
std::optional<FileSpec> FindFile(const FileSpec &orig_spec) const;
uint32_t FindIndexForPath(llvm::StringRef path) const;

View File

@@ -204,9 +204,9 @@ public:
bool SetOSVersion(llvm::VersionTuple os_version);
llvm::Optional<std::string> GetOSBuildString();
std::optional<std::string> GetOSBuildString();
llvm::Optional<std::string> GetOSKernelDescription();
std::optional<std::string> GetOSKernelDescription();
// Returns the name of the platform
llvm::StringRef GetName() { return GetPluginName(); }
@@ -232,11 +232,11 @@ public:
// HostInfo::GetOSVersion().
virtual bool GetRemoteOSVersion() { return false; }
virtual llvm::Optional<std::string> GetRemoteOSBuildString() {
virtual std::optional<std::string> GetRemoteOSBuildString() {
return std::nullopt;
}
virtual llvm::Optional<std::string> GetRemoteOSKernelDescription() {
virtual std::optional<std::string> GetRemoteOSKernelDescription() {
return std::nullopt;
}

View File

@@ -65,8 +65,8 @@ public:
FileSpec &local_file) override;
bool GetRemoteOSVersion() override;
llvm::Optional<std::string> GetRemoteOSBuildString() override;
llvm::Optional<std::string> GetRemoteOSKernelDescription() override;
std::optional<std::string> GetRemoteOSBuildString() override;
std::optional<std::string> GetRemoteOSKernelDescription() override;
ArchSpec GetRemoteSystemArchitecture() override;
Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir,

View File

@@ -155,7 +155,7 @@ class ValueObjectRecognizerSynthesizedValue : public ValueObject {
SetName(parent.GetName());
}
llvm::Optional<uint64_t> GetByteSize() override {
std::optional<uint64_t> GetByteSize() override {
return m_parent->GetByteSize();
}
lldb::ValueType GetValueType() const override { return m_type; }

View File

@@ -146,9 +146,9 @@ public:
protected:
StatsDuration m_create_time;
llvm::Optional<StatsTimepoint> m_launch_or_attach_time;
llvm::Optional<StatsTimepoint> m_first_private_stop_time;
llvm::Optional<StatsTimepoint> m_first_public_stop_time;
std::optional<StatsTimepoint> m_launch_or_attach_time;
std::optional<StatsTimepoint> m_first_private_stop_time;
std::optional<StatsTimepoint> m_first_public_stop_time;
StatsSuccessFail m_expr_eval{"expressionEvaluation"};
StatsSuccessFail m_frame_var{"frameVariable"};
std::vector<intptr_t> m_module_identifiers;

View File

@@ -465,19 +465,19 @@ protected:
GetLiveProcessBinaryData(llvm::StringRef kind);
/// Get the size of the data returned by \a GetLiveThreadBinaryData
llvm::Optional<uint64_t> GetLiveThreadBinaryDataSize(lldb::tid_t tid,
llvm::StringRef kind);
std::optional<uint64_t> GetLiveThreadBinaryDataSize(lldb::tid_t tid,
llvm::StringRef kind);
/// Get the size of the data returned by \a GetLiveCpuBinaryData
llvm::Optional<uint64_t> GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
llvm::StringRef kind);
std::optional<uint64_t> GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id,
llvm::StringRef kind);
/// Get the size of the data returned by \a GetLiveProcessBinaryData
llvm::Optional<uint64_t> GetLiveProcessBinaryDataSize(llvm::StringRef kind);
std::optional<uint64_t> GetLiveProcessBinaryDataSize(llvm::StringRef kind);
/// Constructor for post mortem processes
Trace(llvm::ArrayRef<lldb::ProcessSP> postmortem_processes,
llvm::Optional<std::vector<lldb::cpu_id_t>> postmortem_cpus);
std::optional<std::vector<lldb::cpu_id_t>> postmortem_cpus);
/// Constructor for a live process
Trace(Process &live_process) : m_live_process(&live_process) {}
@@ -572,7 +572,7 @@ private:
/// The list of cpus being traced. Might be \b None depending on the
/// plug-in.
llvm::Optional<std::vector<lldb::cpu_id_t>> cpus;
std::optional<std::vector<lldb::cpu_id_t>> cpus;
/// Postmortem traces can specific additional data files, which are
/// represented in this variable using a data kind identifier for each file.
@@ -588,7 +588,7 @@ private:
/// \}
llvm::Optional<std::string> live_refresh_error;
std::optional<std::string> live_refresh_error;
} m_storage;
/// Get the storage after refreshing the data in the case of a live process.

View File

@@ -271,7 +271,7 @@ public:
/// \return
/// The approximate wall clock time for the trace item, or \a std::nullopt
/// if not available.
virtual llvm::Optional<double> GetWallClockTime() const = 0;
virtual std::optional<double> GetWallClockTime() const = 0;
/// Get some metadata associated with a synchronization point event. As
/// different trace technologies might have different values for this,

View File

@@ -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 = std::nullopt;
std::optional<uint64_t> id = std::nullopt;
/// Optional number of instructions to skip from the starting position
/// of the cursor.
llvm::Optional<size_t> skip = std::nullopt;
std::optional<size_t> skip = std::nullopt;
};
/// Class used to dump the instructions of a \a TraceCursor using its current
@@ -63,13 +63,13 @@ public:
struct TraceItem {
lldb::user_id_t id;
lldb::addr_t load_address;
llvm::Optional<double> timestamp;
std::optional<double> timestamp;
std::optional<uint64_t> hw_clock;
std::optional<std::string> sync_point_metadata;
llvm::Optional<llvm::StringRef> error;
llvm::Optional<lldb::TraceEvent> event;
llvm::Optional<SymbolInfo> symbol_info;
llvm::Optional<SymbolInfo> prev_symbol_info;
std::optional<llvm::StringRef> error;
std::optional<lldb::TraceEvent> event;
std::optional<SymbolInfo> symbol_info;
std::optional<SymbolInfo> prev_symbol_info;
std::optional<lldb::cpu_id_t> cpu_id;
};
@@ -350,7 +350,8 @@ public:
/// \return
/// A optional to the untraced prefix segment of this call.
const llvm::Optional<UntracedPrefixSegment> &GetUntracedPrefixSegment() const;
const std::optional<UntracedPrefixSegment> &
GetUntracedPrefixSegment() const;
/// \return
/// A pointer to the parent call. It may be \b nullptr.
@@ -360,7 +361,7 @@ public:
private:
/// An optional untraced segment that precedes all the traced segments.
llvm::Optional<UntracedPrefixSegment> m_untraced_prefix_segment;
std::optional<UntracedPrefixSegment> m_untraced_prefix_segment;
/// The traced segments in order. We used a deque to prevent moving these
/// objects when appending to the list, which would happen with vector.
std::deque<TracedSegment> m_traced_segments;
@@ -413,7 +414,7 @@ public:
/// \return
/// The instruction id of the last traversed instruction, or \b
/// std::nullopt if no instructions were visited.
llvm::Optional<lldb::user_id_t> DumpInstructions(size_t count);
std::optional<lldb::user_id_t> DumpInstructions(size_t count);
/// Dump all function calls forwards chronologically and hierarchically
void DumpFunctionCalls();

View File

@@ -105,9 +105,9 @@ public:
// should_[suppress|stop|notify] flag can be std::nullopt - no filtering by
// this flag true - only signals that have it set to true are returned false -
// only signals that have it set to true are returned
std::vector<int32_t> GetFilteredSignals(llvm::Optional<bool> should_suppress,
llvm::Optional<bool> should_stop,
llvm::Optional<bool> should_notify);
std::vector<int32_t> GetFilteredSignals(std::optional<bool> should_suppress,
std::optional<bool> should_stop,
std::optional<bool> should_notify);
protected:
// Classes that inherit from UnixSignals can see and modify these

View File

@@ -56,7 +56,7 @@ public:
static llvm::Expected<FileSpec> CreateUniqueDirectory();
private:
static llvm::Optional<Diagnostics> &InstanceImpl();
static std::optional<Diagnostics> &InstanceImpl();
llvm::Error DumpDiangosticsLog(const FileSpec &dir) const;

View File

@@ -195,7 +195,7 @@ public:
/// The guess will be correct if the input path was a valid absolute path on
/// the system which produced it. On other paths the result of this function
/// is unreliable (e.g. "c:\foo.txt" is a valid relative posix path).
static llvm::Optional<Style> GuessPathStyle(llvm::StringRef absolute_path);
static std::optional<Style> GuessPathStyle(llvm::StringRef absolute_path);
/// Case sensitivity of path.
///

View File

@@ -120,7 +120,7 @@ public:
/// m_value if Cond(m_value) is true, std::nullopt otherwise (timeout
/// occurred).
template <typename C>
llvm::Optional<T> WaitFor(C Cond, const Timeout<std::micro> &timeout) {
std::optional<T> WaitFor(C Cond, const Timeout<std::micro> &timeout) {
std::unique_lock<std::mutex> lock(m_mutex);
auto RealCond = [&] { return Cond(m_value); };
if (!timeout) {
@@ -181,7 +181,7 @@ public:
/// \return
/// m_value if m_value != value, std::nullopt otherwise (timeout
/// occurred).
llvm::Optional<T>
std::optional<T>
WaitForValueNotEqualTo(T value,
const Timeout<std::micro> &timeout = std::nullopt) {
return WaitFor([&value](T current) { return value != current; }, timeout);

View File

@@ -66,7 +66,7 @@ protected:
write_is_set : 1, error_is_set : 1;
};
llvm::DenseMap<lldb::socket_t, FDInfo> m_fd_map;
llvm::Optional<std::chrono::steady_clock::time_point> m_end_time;
std::optional<std::chrono::steady_clock::time_point> m_end_time;
};
#endif // LLDB_UTILITY_SELECTHELPER_H

View File

@@ -211,7 +211,7 @@ public:
// Read thread-id from the packet. If the packet is valid, returns
// the pair (PID, TID), otherwise returns std::nullopt. If the packet
// does not list a PID, default_pid is used.
llvm::Optional<std::pair<lldb::pid_t, lldb::tid_t>>
std::optional<std::pair<lldb::pid_t, lldb::tid_t>>
GetPidTid(lldb::pid_t default_pid);
protected:

View File

@@ -17,7 +17,7 @@
namespace lldb_private {
// A general purpose class for representing timeouts for various APIs. It's
// basically an llvm::Optional<std::chrono::duration<int64_t, Ratio>>, but we
// basically an std::optional<std::chrono::duration<int64_t, Ratio>>, but we
// customize it a bit to enable the standard chrono implicit conversions (e.g.
// from Timeout<std::milli> to Timeout<std::micro>.
//
@@ -26,7 +26,7 @@ namespace lldb_private {
// complete the call if it will not block - >0 - wait for a given number of
// units for the result
template <typename Ratio>
class Timeout : public llvm::Optional<std::chrono::duration<int64_t, Ratio>> {
class Timeout : public std::optional<std::chrono::duration<int64_t, Ratio>> {
private:
template <typename Ratio2> using Dur = std::chrono::duration<int64_t, Ratio2>;
template <typename Rep2, typename Ratio2>
@@ -34,7 +34,7 @@ private:
std::is_convertible<std::chrono::duration<Rep2, Ratio2>,
std::chrono::duration<int64_t, Ratio>>::value>;
using Base = llvm::Optional<Dur<Ratio>>;
using Base = std::optional<Dur<Ratio>>;
public:
Timeout(std::nullopt_t none) : Base(none) {}

View File

@@ -22,7 +22,7 @@ namespace lldb_private {
struct URI {
llvm::StringRef scheme;
llvm::StringRef hostname;
llvm::Optional<uint16_t> port;
std::optional<uint16_t> port;
llvm::StringRef path;
bool operator==(const URI &R) const {
@@ -30,7 +30,7 @@ struct URI {
path == R.path;
}
static llvm::Optional<URI> Parse(llvm::StringRef uri);
static std::optional<URI> Parse(llvm::StringRef uri);
};
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const URI &U);

View File

@@ -26,10 +26,10 @@ public:
typedef uint32_t id_t;
virtual ~UserIDResolver(); // anchor
llvm::Optional<llvm::StringRef> GetUserName(id_t uid) {
std::optional<llvm::StringRef> GetUserName(id_t uid) {
return Get(uid, m_uid_cache, &UserIDResolver::DoGetUserName);
}
llvm::Optional<llvm::StringRef> GetGroupName(id_t gid) {
std::optional<llvm::StringRef> GetGroupName(id_t gid) {
return Get(gid, m_gid_cache, &UserIDResolver::DoGetGroupName);
}
@@ -38,15 +38,15 @@ public:
static UserIDResolver &GetNoopResolver();
protected:
virtual llvm::Optional<std::string> DoGetUserName(id_t uid) = 0;
virtual llvm::Optional<std::string> DoGetGroupName(id_t gid) = 0;
virtual std::optional<std::string> DoGetUserName(id_t uid) = 0;
virtual std::optional<std::string> DoGetGroupName(id_t gid) = 0;
private:
using Map = llvm::DenseMap<id_t, llvm::Optional<std::string>>;
using Map = llvm::DenseMap<id_t, std::optional<std::string>>;
llvm::Optional<llvm::StringRef>
std::optional<llvm::StringRef>
Get(id_t id, Map &cache,
llvm::Optional<std::string> (UserIDResolver::*do_get)(id_t));
std::optional<std::string> (UserIDResolver::*do_get)(id_t));
std::mutex m_mutex;
Map m_uid_cache;

View File

@@ -47,7 +47,7 @@ public:
m_auto_repeat_command =
auto_repeat_command == nullptr
? std::nullopt
: llvm::Optional<std::string>(auto_repeat_command);
: std::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.
CommandArgumentData none_arg{eArgTypeNone, eArgRepeatStar};
@@ -60,8 +60,8 @@ public:
/// but in short, if std::nullopt is returned, the previous command will be
/// repeated, and if an empty string is returned, no commands will be
/// executed.
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
if (!m_auto_repeat_command)
return std::nullopt;
else
@@ -78,7 +78,7 @@ protected:
return ret;
}
std::shared_ptr<lldb::SBCommandPluginInterface> m_backend;
llvm::Optional<std::string> m_auto_repeat_command;
std::optional<std::string> m_auto_repeat_command;
};
SBCommandInterpreter::SBCommandInterpreter(CommandInterpreter *interpreter)

View File

@@ -134,7 +134,7 @@ uint32_t SBMemoryRegionInfo::GetNumDirtyPages() {
LLDB_INSTRUMENT_VA(this);
uint32_t num_dirty_pages = 0;
const llvm::Optional<std::vector<addr_t>> &dirty_page_list =
const std::optional<std::vector<addr_t>> &dirty_page_list =
m_opaque_up->GetDirtyPageList();
if (dirty_page_list)
num_dirty_pages = dirty_page_list->size();
@@ -146,7 +146,7 @@ addr_t SBMemoryRegionInfo::GetDirtyPageAddressAtIndex(uint32_t idx) {
LLDB_INSTRUMENT_VA(this, idx);
addr_t dirty_page_addr = LLDB_INVALID_ADDRESS;
const llvm::Optional<std::vector<addr_t>> &dirty_page_list =
const std::optional<std::vector<addr_t>> &dirty_page_list =
m_opaque_up->GetDirtyPageList();
if (dirty_page_list && idx < dirty_page_list->size())
dirty_page_addr = (*dirty_page_list)[idx];

View File

@@ -121,7 +121,7 @@ uint64_t SBType::GetByteSize() {
LLDB_INSTRUMENT_VA(this);
if (IsValid())
if (llvm::Optional<uint64_t> size =
if (std::optional<uint64_t> size =
m_opaque_sp->GetCompilerType(false).GetByteSize(nullptr))
return *size;
return 0;

View File

@@ -63,7 +63,7 @@ void BreakpointID::GetCanonicalReference(Stream *s, break_id_t bp_id,
s->Printf("%i.%i", bp_id, loc_id);
}
llvm::Optional<BreakpointID>
std::optional<BreakpointID>
BreakpointID::ParseCanonicalReference(llvm::StringRef input) {
break_id_t bp_id;
break_id_t loc_id = LLDB_INVALID_BREAK_ID;

View File

@@ -181,7 +181,7 @@ namespace {
struct SourceLoc {
uint32_t line = UINT32_MAX;
uint16_t column;
SourceLoc(uint32_t l, llvm::Optional<uint16_t> c)
SourceLoc(uint32_t l, std::optional<uint16_t> c)
: line(l), column(c ? *c : LLDB_INVALID_COLUMN_NUMBER) {}
SourceLoc(const SymbolContext &sc)
: line(sc.line_entry.line),
@@ -202,7 +202,7 @@ bool operator<(const SourceLoc lhs, const SourceLoc rhs) {
void BreakpointResolver::SetSCMatchesByLine(
SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue,
llvm::StringRef log_ident, uint32_t line, llvm::Optional<uint16_t> column) {
llvm::StringRef log_ident, uint32_t line, std::optional<uint16_t> column) {
llvm::SmallVector<SymbolContext, 16> all_scs;
for (uint32_t i = 0; i < sc_list.GetSize(); ++i)
all_scs.push_back(sc_list[i]);

View File

@@ -25,7 +25,7 @@ using namespace lldb_private;
BreakpointResolverFileLine::BreakpointResolverFileLine(
const BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue,
const SourceLocationSpec &location_spec,
llvm::Optional<llvm::StringRef> removed_prefix_opt)
std::optional<llvm::StringRef> removed_prefix_opt)
: BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver, offset),
m_location_spec(location_spec), m_skip_prologue(skip_prologue),
m_removed_prefix_opt(removed_prefix_opt) {}
@@ -205,7 +205,7 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
// of "a" after consuming "b" from the back.
auto check_suffix =
[path_separator](llvm::StringRef a, llvm::StringRef b,
bool case_sensitive) -> llvm::Optional<llvm::StringRef> {
bool case_sensitive) -> std::optional<llvm::StringRef> {
if (case_sensitive ? a.consume_back(b) : a.consume_back_insensitive(b)) {
if (a.empty() || a.endswith(path_separator)) {
return a;
@@ -244,14 +244,14 @@ void BreakpointResolverFileLine::DeduceSourceMapping(
if (m_removed_prefix_opt.has_value())
llvm::sys::path::append(new_mapping_to, *m_removed_prefix_opt);
llvm::Optional<llvm::StringRef> new_mapping_from_opt =
std::optional<llvm::StringRef> new_mapping_from_opt =
check_suffix(sc_file_dir, request_file_dir, case_sensitive);
if (new_mapping_from_opt) {
new_mapping_from = *new_mapping_from_opt;
if (new_mapping_to.empty())
new_mapping_to = ".";
} else {
llvm::Optional<llvm::StringRef> new_mapping_to_opt =
std::optional<llvm::StringRef> new_mapping_to_opt =
check_suffix(request_file_dir, sc_file_dir, case_sensitive);
if (new_mapping_to_opt) {
new_mapping_from = ".";
@@ -291,7 +291,7 @@ Searcher::CallbackReturn BreakpointResolverFileLine::SearchCallback(
// same file spec in their line_entry and treat each set separately.
const uint32_t line = m_location_spec.GetLine().value_or(0);
const llvm::Optional<uint16_t> column = m_location_spec.GetColumn();
const std::optional<uint16_t> column = m_location_spec.GetColumn();
const size_t num_comp_units = context.module_sp->GetNumCompileUnits();
for (size_t i = 0; i < num_comp_units; i++) {

View File

@@ -2205,7 +2205,7 @@ public:
break;
case 'N':
llvm::Optional<FileSpec> file_spec;
std::optional<FileSpec> file_spec;
const llvm::StringRef dash_f("-f");
for (int arg_idx = 0; arg_idx < opt_arg_pos; arg_idx++) {
if (dash_f == request.GetParsedLine().GetArgumentAtIndex(arg_idx)) {

View File

@@ -58,8 +58,8 @@ public:
~CommandObjectCommandsSource() override = default;
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
return std::string("");
}

View File

@@ -100,9 +100,9 @@ public:
}
// Options.
llvm::Optional<lldb::addr_t> address;
llvm::Optional<ConstString> reg;
llvm::Optional<int64_t> offset;
std::optional<lldb::addr_t> address;
std::optional<ConstString> reg;
std::optional<int64_t> offset;
};
CommandObjectFrameDiagnose(CommandInterpreter &interpreter)
@@ -257,7 +257,7 @@ public:
return llvm::makeArrayRef(g_frame_select_options);
}
llvm::Optional<int32_t> relative_frame_offset;
std::optional<int32_t> relative_frame_offset;
};
CommandObjectFrameSelect(CommandInterpreter &interpreter)

View File

@@ -342,8 +342,8 @@ public:
Options *GetOptions() override { return &m_option_group; }
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
return m_cmd_name;
}
@@ -477,7 +477,7 @@ protected:
for (auto lang : languages_to_check) {
if (auto *persistent_vars =
target->GetPersistentExpressionStateForLanguage(lang)) {
if (llvm::Optional<CompilerType> type =
if (std::optional<CompilerType> type =
persistent_vars->GetCompilerTypeFromPersistentDecl(
lookup_type_name)) {
user_defined_types.emplace(*type);
@@ -522,7 +522,7 @@ protected:
--pointer_count;
}
llvm::Optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
std::optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
if (!size) {
result.AppendErrorWithFormat(
"unable to get the byte size of the type '%s'\n",
@@ -651,7 +651,7 @@ protected:
if (!m_format_options.GetFormatValue().OptionWasSet())
m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
llvm::Optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
std::optional<uint64_t> size = compiler_type.GetByteSize(nullptr);
if (!size) {
result.AppendError("can't get size of type");
return false;
@@ -1076,7 +1076,7 @@ protected:
m_memory_options.m_expr.GetStringValue(), frame, result_sp)) &&
result_sp) {
uint64_t value = result_sp->GetValueAsUnsigned(0);
llvm::Optional<uint64_t> size =
std::optional<uint64_t> size =
result_sp->GetCompilerType().GetByteSize(nullptr);
if (!size)
return false;
@@ -1601,8 +1601,8 @@ public:
~CommandObjectMemoryHistory() override = default;
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
return m_cmd_name;
}
@@ -1737,7 +1737,7 @@ protected:
if (memory_tagged == MemoryRegionInfo::OptionalBool::eYes)
result.AppendMessage("memory tagging: enabled");
const llvm::Optional<std::vector<addr_t>> &dirty_page_list =
const std::optional<std::vector<addr_t>> &dirty_page_list =
range_info.GetDirtyPageList();
if (dirty_page_list) {
const size_t page_count = dirty_page_list->size();
@@ -1852,8 +1852,8 @@ protected:
return false;
}
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
// If we repeat this command, repeat it without any arguments so we can
// show the next memory range
return m_cmd_name;

View File

@@ -291,7 +291,7 @@ void CommandObjectMultiword::HandleCompletion(CompletionRequest &request) {
sub_command_object->HandleCompletion(request);
}
llvm::Optional<std::string>
std::optional<std::string>
CommandObjectMultiword::GetRepeatCommand(Args &current_command_args,
uint32_t index) {
index++;
@@ -421,7 +421,7 @@ void CommandObjectProxy::HandleArgumentCompletion(
proxy_command->HandleArgumentCompletion(request, opt_element_vector);
}
llvm::Optional<std::string>
std::optional<std::string>
CommandObjectProxy::GetRepeatCommand(Args &current_command_args,
uint32_t index) {
CommandObject *proxy_command = GetProxyCommandObject();

View File

@@ -152,8 +152,8 @@ public:
Options *GetOptions() override { return &m_all_options; }
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
// No repeat for "process launch"...
return std::string("");
}

View File

@@ -722,8 +722,8 @@ public:
Options *GetOptions() override { return &m_options; }
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
// This is kind of gross, but the command hasn't been parsed yet so we
// can't look at the option values for this invocation... I have to scan
// the arguments directly.

View File

@@ -125,8 +125,8 @@ public:
Options *GetOptions() override { return &m_options; }
llvm::Optional<std::string> GetRepeatCommand(Args &current_args,
uint32_t idx) override {
std::optional<std::string> GetRepeatCommand(Args &current_args,
uint32_t idx) override {
llvm::StringRef count_opt("--count");
llvm::StringRef start_opt("--start");
@@ -2161,7 +2161,7 @@ public:
// Instance variables to hold the values for command options.
TraceDumperOptions m_dumper_options;
llvm::Optional<FileSpec> m_output_file;
std::optional<FileSpec> m_output_file;
};
CommandObjectTraceDumpFunctionCalls(CommandInterpreter &interpreter)
@@ -2198,7 +2198,7 @@ protected:
}
TraceCursorSP &cursor_sp = *cursor_or_error;
llvm::Optional<StreamFile> out_file;
std::optional<StreamFile> out_file;
if (m_options.m_output_file) {
out_file.emplace(m_options.m_output_file->GetPath().c_str(),
File::eOpenOptionWriteOnly | File::eOpenOptionCanCreate |
@@ -2335,7 +2335,7 @@ public:
// Instance variables to hold the values for command options.
size_t m_count;
size_t m_continue;
llvm::Optional<FileSpec> m_output_file;
std::optional<FileSpec> m_output_file;
TraceDumperOptions m_dumper_options;
};
@@ -2356,8 +2356,8 @@ public:
Options *GetOptions() override { return &m_options; }
llvm::Optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::optional<std::string> GetRepeatCommand(Args &current_command_args,
uint32_t index) override {
std::string cmd;
current_command_args.GetCommandString(cmd);
if (cmd.find(" --continue") == std::string::npos)
@@ -2395,7 +2395,7 @@ protected:
return false;
}
llvm::Optional<StreamFile> out_file;
std::optional<StreamFile> out_file;
if (m_options.m_output_file) {
out_file.emplace(m_options.m_output_file->GetPath().c_str(),
File::eOpenOptionWriteOnly | File::eOpenOptionCanCreate |
@@ -2420,7 +2420,7 @@ protected:
CommandOptions m_options;
// Last traversed id used to continue a repeat command. None means
// that all the trace has been consumed.
llvm::Optional<lldb::user_id_t> m_last_id;
std::optional<lldb::user_id_t> m_last_id;
};
// CommandObjectTraceDumpInfo

View File

@@ -1301,7 +1301,7 @@ static void PrivateReportProgress(Debugger &debugger, uint64_t progress_id,
void Debugger::ReportProgress(uint64_t progress_id, const std::string &message,
uint64_t completed, uint64_t total,
llvm::Optional<lldb::user_id_t> debugger_id) {
std::optional<lldb::user_id_t> debugger_id) {
// Check if this progress is for a specific debugger.
if (debugger_id) {
// It is debugger specific, grab it and deliver the event if the debugger
@@ -1357,7 +1357,7 @@ static void PrivateReportDiagnostic(Debugger &debugger,
void Debugger::ReportDiagnosticImpl(DiagnosticEventData::Type type,
std::string message,
llvm::Optional<lldb::user_id_t> debugger_id,
std::optional<lldb::user_id_t> debugger_id,
std::once_flag *once) {
auto ReportDiagnosticLambda = [&]() {
// The diagnostic subsystem is optional but we still want to broadcast
@@ -1394,21 +1394,21 @@ void Debugger::ReportDiagnosticImpl(DiagnosticEventData::Type type,
}
void Debugger::ReportWarning(std::string message,
llvm::Optional<lldb::user_id_t> debugger_id,
std::optional<lldb::user_id_t> debugger_id,
std::once_flag *once) {
ReportDiagnosticImpl(DiagnosticEventData::Type::Warning, std::move(message),
debugger_id, once);
}
void Debugger::ReportError(std::string message,
llvm::Optional<lldb::user_id_t> debugger_id,
std::optional<lldb::user_id_t> debugger_id,
std::once_flag *once) {
ReportDiagnosticImpl(DiagnosticEventData::Type::Error, std::move(message),
debugger_id, once);
}
void Debugger::ReportInfo(std::string message,
llvm::Optional<lldb::user_id_t> debugger_id,
std::optional<lldb::user_id_t> debugger_id,
std::once_flag *once) {
ReportDiagnosticImpl(DiagnosticEventData::Type::Info, std::move(message),
debugger_id, once);
@@ -1494,7 +1494,7 @@ bool Debugger::EnableLog(llvm::StringRef channel,
ScriptInterpreter *
Debugger::GetScriptInterpreter(bool can_create,
llvm::Optional<lldb::ScriptLanguage> language) {
std::optional<lldb::ScriptLanguage> language) {
std::lock_guard<std::recursive_mutex> locker(m_script_interpreter_mutex);
lldb::ScriptLanguage script_language =
language ? *language : GetScriptLanguage();

View File

@@ -51,9 +51,9 @@ using namespace lldb;
#define NON_PRINTABLE_CHAR '.'
static llvm::Optional<llvm::APInt> GetAPInt(const DataExtractor &data,
lldb::offset_t *offset_ptr,
lldb::offset_t byte_size) {
static std::optional<llvm::APInt> GetAPInt(const DataExtractor &data,
lldb::offset_t *offset_ptr,
lldb::offset_t byte_size) {
if (byte_size == 0)
return std::nullopt;
@@ -99,7 +99,7 @@ static llvm::Optional<llvm::APInt> GetAPInt(const DataExtractor &data,
static lldb::offset_t DumpAPInt(Stream *s, const DataExtractor &data,
lldb::offset_t offset, lldb::offset_t byte_size,
bool is_signed, unsigned radix) {
llvm::Optional<llvm::APInt> apint = GetAPInt(data, &offset, byte_size);
std::optional<llvm::APInt> apint = GetAPInt(data, &offset, byte_size);
if (apint) {
std::string apint_str = toString(*apint, radix, is_signed);
switch (radix) {
@@ -239,7 +239,7 @@ void DumpFloatingPoint(std::ostringstream &ss, FloatT f) {
ss << f;
}
static llvm::Optional<MemoryTagMap>
static std::optional<MemoryTagMap>
GetMemoryTags(lldb::addr_t addr, size_t length,
ExecutionContextScope *exe_scope) {
assert(addr != LLDB_INVALID_ADDRESS);
@@ -295,11 +295,10 @@ GetMemoryTags(lldb::addr_t addr, size_t length,
return memory_tag_map;
}
static void
printMemoryTags(const DataExtractor &DE, Stream *s, lldb::addr_t addr,
size_t len,
const llvm::Optional<MemoryTagMap> &memory_tag_map) {
std::vector<llvm::Optional<lldb::addr_t>> tags =
static void printMemoryTags(const DataExtractor &DE, Stream *s,
lldb::addr_t addr, size_t len,
const std::optional<MemoryTagMap> &memory_tag_map) {
std::vector<std::optional<lldb::addr_t>> tags =
memory_tag_map->GetTags(addr, len);
// Only print if there is at least one tag for this line
@@ -359,7 +358,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
offset_t offset = start_offset;
llvm::Optional<MemoryTagMap> memory_tag_map;
std::optional<MemoryTagMap> memory_tag_map;
if (show_memory_tags && base_addr != LLDB_INVALID_ADDRESS)
memory_tag_map =
GetMemoryTags(base_addr, DE.GetByteSize() - offset, exe_scope);
@@ -652,7 +651,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
if (exe_scope)
target_sp = exe_scope->CalculateTarget();
llvm::Optional<unsigned> format_max_padding;
std::optional<unsigned> format_max_padding;
if (target_sp)
format_max_padding = target_sp->GetMaxZeroPaddingInFloatFormat();
@@ -667,7 +666,7 @@ lldb::offset_t lldb_private::DumpDataExtractor(
// x87DoubleExtended semantics which has a byte size of 10 (80-bit).
const size_t semantics_byte_size =
(llvm::APFloat::getSizeInBits(semantics) + 7) / 8;
llvm::Optional<llvm::APInt> apint =
std::optional<llvm::APInt> apint =
GetAPInt(DE, &offset, semantics_byte_size);
if (apint) {
llvm::APFloat apfloat(semantics, *apint);

View File

@@ -73,7 +73,7 @@ EmulateInstruction::FindPlugin(const ArchSpec &arch,
EmulateInstruction::EmulateInstruction(const ArchSpec &arch) : m_arch(arch) {}
llvm::Optional<RegisterValue>
std::optional<RegisterValue>
EmulateInstruction::ReadRegister(const RegisterInfo &reg_info) {
if (m_read_reg_callback == nullptr)
return {};
@@ -88,11 +88,11 @@ EmulateInstruction::ReadRegister(const RegisterInfo &reg_info) {
bool EmulateInstruction::ReadRegister(lldb::RegisterKind reg_kind,
uint32_t reg_num,
RegisterValue &reg_value) {
llvm::Optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
if (!reg_info)
return false;
llvm::Optional<RegisterValue> value = ReadRegister(*reg_info);
std::optional<RegisterValue> value = ReadRegister(*reg_info);
if (value)
reg_value = *value;
return value.has_value();
@@ -113,7 +113,7 @@ uint64_t EmulateInstruction::ReadRegisterUnsigned(lldb::RegisterKind reg_kind,
uint64_t EmulateInstruction::ReadRegisterUnsigned(const RegisterInfo &reg_info,
uint64_t fail_value,
bool *success_ptr) {
llvm::Optional<RegisterValue> reg_value = ReadRegister(reg_info);
std::optional<RegisterValue> reg_value = ReadRegister(reg_info);
if (!reg_value) {
if (success_ptr)
*success_ptr = false;
@@ -135,7 +135,7 @@ bool EmulateInstruction::WriteRegister(const Context &context,
lldb::RegisterKind reg_kind,
uint32_t reg_num,
const RegisterValue &reg_value) {
llvm::Optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
if (reg_info)
return WriteRegister(context, *reg_info, reg_value);
return false;
@@ -145,7 +145,7 @@ bool EmulateInstruction::WriteRegisterUnsigned(const Context &context,
lldb::RegisterKind reg_kind,
uint32_t reg_num,
uint64_t uint_value) {
llvm::Optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
std::optional<RegisterInfo> reg_info = GetRegisterInfo(reg_kind, reg_num);
if (reg_info) {
RegisterValue reg_value;
if (reg_value.SetUInt(uint_value, reg_info->byte_size))

View File

@@ -28,7 +28,7 @@ void HighlightStyle::ColorStyle::Set(llvm::StringRef prefix,
void DefaultHighlighter::Highlight(const HighlightStyle &options,
llvm::StringRef line,
llvm::Optional<size_t> cursor_pos,
std::optional<size_t> cursor_pos,
llvm::StringRef previous_lines,
Stream &s) const {
// If we don't have a valid cursor, then we just print the line as-is.
@@ -73,7 +73,7 @@ HighlighterManager::getHighlighterFor(lldb::LanguageType language_type,
std::string Highlighter::Highlight(const HighlightStyle &options,
llvm::StringRef line,
llvm::Optional<size_t> cursor_pos,
std::optional<size_t> cursor_pos,
llvm::StringRef previous_lines) const {
StreamString s;
Highlight(options, line, cursor_pos, previous_lines, s);

View File

@@ -199,7 +199,7 @@ void IOHandlerConfirm::IOHandlerInputComplete(IOHandler &io_handler,
}
}
llvm::Optional<std::string>
std::optional<std::string>
IOHandlerDelegate::IOHandlerSuggestion(IOHandler &io_handler,
llvm::StringRef line) {
return io_handler.GetDebugger()
@@ -327,7 +327,7 @@ void IOHandlerEditline::TerminalSizeChanged() {
}
// Split out a line from the buffer, if there is a full one to get.
static Optional<std::string> SplitLine(std::string &line_buffer) {
static std::optional<std::string> SplitLine(std::string &line_buffer) {
size_t pos = line_buffer.find('\n');
if (pos == std::string::npos)
return std::nullopt;
@@ -339,7 +339,7 @@ static Optional<std::string> SplitLine(std::string &line_buffer) {
// If the final line of the file ends without a end-of-line, return
// it as a line anyway.
static Optional<std::string> SplitLineEOF(std::string &line_buffer) {
static std::optional<std::string> SplitLineEOF(std::string &line_buffer) {
if (llvm::all_of(line_buffer, llvm::isSpace))
return std::nullopt;
std::string line = std::move(line_buffer);
@@ -373,7 +373,7 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
}
}
Optional<std::string> got_line = SplitLine(m_line_buffer);
std::optional<std::string> got_line = SplitLine(m_line_buffer);
if (!got_line && !m_input_sp) {
// No more input file, we are done...
@@ -447,7 +447,7 @@ int IOHandlerEditline::FixIndentationCallback(Editline *editline,
return m_delegate.IOHandlerFixIndentation(*this, lines, cursor_position);
}
llvm::Optional<std::string>
std::optional<std::string>
IOHandlerEditline::SuggestionCallback(llvm::StringRef line) {
return m_delegate.IOHandlerSuggestion(*this, line);
}

View File

@@ -7025,7 +7025,7 @@ public:
StreamString lineStream;
llvm::Optional<size_t> column;
std::optional<size_t> column;
if (is_pc_line && m_sc.line_entry.IsValid() && m_sc.line_entry.column)
column = m_sc.line_entry.column - 1;
m_file_sp->DisplaySourceLines(curr_line + 1, column, 0, 0,

View File

@@ -1126,7 +1126,7 @@ bool Module::FileHasChanged() const {
}
void Module::ReportWarningOptimization(
llvm::Optional<lldb::user_id_t> debugger_id) {
std::optional<lldb::user_id_t> debugger_id) {
ConstString file_name = GetFileSpec().GetFilename();
if (file_name.IsEmpty())
return;
@@ -1140,7 +1140,7 @@ void Module::ReportWarningOptimization(
}
void Module::ReportWarningUnsupportedLanguage(
LanguageType language, llvm::Optional<lldb::user_id_t> debugger_id) {
LanguageType language, std::optional<lldb::user_id_t> debugger_id) {
StreamString ss;
ss << "This version of LLDB has no plugin for the language \""
<< Language::GetNameForLanguageType(language)
@@ -1635,8 +1635,7 @@ bool Module::FindSourceFile(const FileSpec &orig_spec,
return false;
}
llvm::Optional<std::string>
Module::RemapSourceFile(llvm::StringRef path) const {
std::optional<std::string> Module::RemapSourceFile(llvm::StringRef path) const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
if (auto remapped = m_source_mappings.RemapPath(path))
return remapped->GetPath();

View File

@@ -14,7 +14,7 @@ using namespace lldb;
using namespace lldb_private;
SourceLocationSpec::SourceLocationSpec(FileSpec file_spec, uint32_t line,
llvm::Optional<uint16_t> column,
std::optional<uint16_t> column,
bool check_inlines, bool exact_match)
: m_declaration(file_spec, line,
column.value_or(LLDB_INVALID_COLUMN_NUMBER)),
@@ -67,14 +67,14 @@ std::string SourceLocationSpec::GetString() const {
return ss.GetString().str();
}
llvm::Optional<uint32_t> SourceLocationSpec::GetLine() const {
std::optional<uint32_t> SourceLocationSpec::GetLine() const {
uint32_t line = m_declaration.GetLine();
if (line == 0 || line == LLDB_INVALID_LINE_NUMBER)
return std::nullopt;
return line;
}
llvm::Optional<uint16_t> SourceLocationSpec::GetColumn() const {
std::optional<uint16_t> SourceLocationSpec::GetColumn() const {
uint16_t column = m_declaration.GetColumn();
if (column == LLDB_INVALID_COLUMN_NUMBER)
return std::nullopt;

View File

@@ -223,7 +223,7 @@ size_t SourceManager::DisplaySourceLinesWithLineNumbersUsingLastFile(
// So far we treated column 0 as a special 'no column value', but
// DisplaySourceLines starts counting columns from 0 (and no column is
// expressed by passing an empty optional).
llvm::Optional<size_t> columnToHighlight;
std::optional<size_t> columnToHighlight;
if (line == curr_line && column)
columnToHighlight = column - 1;
@@ -558,7 +558,7 @@ void SourceManager::File::UpdateIfNeeded() {
}
size_t SourceManager::File::DisplaySourceLines(uint32_t line,
llvm::Optional<size_t> column,
std::optional<size_t> column,
uint32_t context_before,
uint32_t context_after,
Stream *s) {

View File

@@ -207,7 +207,7 @@ uint64_t Value::GetValueByteSize(Status *error_ptr, ExecutionContext *exe_ctx) {
case ContextType::Variable: // Variable *
{
auto *scope = exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr;
if (llvm::Optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
if (std::optional<uint64_t> size = GetCompilerType().GetByteSize(scope)) {
if (error_ptr)
error_ptr->Clear();
return *size;
@@ -305,7 +305,7 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
AddressType address_type = eAddressTypeFile;
Address file_so_addr;
const CompilerType &ast_type = GetCompilerType();
llvm::Optional<uint64_t> type_size = ast_type.GetByteSize(
std::optional<uint64_t> type_size = ast_type.GetByteSize(
exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr);
// Nothing to be done for a zero-sized type.
if (type_size && *type_size == 0)

View File

@@ -264,7 +264,7 @@ CompilerType ValueObject::MaybeCalculateCompleteType() {
if (auto *runtime =
process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
if (llvm::Optional<CompilerType> complete_type =
if (std::optional<CompilerType> complete_type =
runtime->GetRuntimeType(compiler_type)) {
m_override_type = *complete_type;
if (m_override_type.IsValid())
@@ -683,7 +683,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx,
ExecutionContext exe_ctx(GetExecutionContextRef());
llvm::Optional<uint64_t> item_type_size =
std::optional<uint64_t> item_type_size =
pointee_or_element_compiler_type.GetByteSize(
exe_ctx.GetBestExecutionContextScope());
if (!item_type_size)
@@ -1706,7 +1706,7 @@ ValueObjectSP ValueObject::GetSyntheticChildAtOffset(
return {};
ExecutionContext exe_ctx(GetExecutionContextRef());
llvm::Optional<uint64_t> size =
std::optional<uint64_t> size =
type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
if (!size)
return {};
@@ -1748,7 +1748,7 @@ ValueObjectSP ValueObject::GetSyntheticBase(uint32_t offset,
const bool is_base_class = true;
ExecutionContext exe_ctx(GetExecutionContextRef());
llvm::Optional<uint64_t> size =
std::optional<uint64_t> size =
type.GetByteSize(exe_ctx.GetBestExecutionContextScope());
if (!size)
return {};

View File

@@ -48,7 +48,7 @@ size_t ValueObjectCast::CalculateNumChildren(uint32_t max) {
return children_count <= max ? children_count : max;
}
llvm::Optional<uint64_t> ValueObjectCast::GetByteSize() {
std::optional<uint64_t> ValueObjectCast::GetByteSize() {
ExecutionContext exe_ctx(GetExecutionContextRef());
return m_value.GetValueByteSize(nullptr, &exe_ctx);
}

View File

@@ -204,7 +204,7 @@ lldb::ValueType ValueObjectConstResult::GetValueType() const {
return eValueTypeConstResult;
}
llvm::Optional<uint64_t> ValueObjectConstResult::GetByteSize() {
std::optional<uint64_t> ValueObjectConstResult::GetByteSize() {
ExecutionContext exe_ctx(GetExecutionContextRef());
if (!m_byte_size) {
if (auto size =

View File

@@ -95,7 +95,7 @@ size_t ValueObjectDynamicValue::CalculateNumChildren(uint32_t max) {
return m_parent->GetNumChildren(max);
}
llvm::Optional<uint64_t> ValueObjectDynamicValue::GetByteSize() {
std::optional<uint64_t> ValueObjectDynamicValue::GetByteSize() {
const bool success = UpdateValueIfNeeded(false);
if (success && m_dynamic_type_info.HasType()) {
ExecutionContext exe_ctx(GetExecutionContextRef());

View File

@@ -139,7 +139,7 @@ size_t ValueObjectMemory::CalculateNumChildren(uint32_t max) {
return child_count <= max ? child_count : max;
}
llvm::Optional<uint64_t> ValueObjectMemory::GetByteSize() {
std::optional<uint64_t> ValueObjectMemory::GetByteSize() {
ExecutionContext exe_ctx(GetExecutionContextRef());
if (m_type_sp)
return m_type_sp->GetByteSize(exe_ctx.GetBestExecutionContextScope());

Some files were not shown because too many files have changed in this diff Show More