From: Kazu Hirata Date: Sat, 7 Jan 2023 22:18:35 +0000 (-0800) Subject: [lldb] Use std::optional instead of llvm::Optional (NFC) X-Git-Tag: upstream/17.0.6~21809 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2fe8327406050d2585d2ced910a678e28caefcf5;p=platform%2Fupstream%2Fllvm.git [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 --- diff --git a/lldb/bindings/python/python-wrapper.swig b/lldb/bindings/python/python-wrapper.swig index 7342d9d..91b26ff 100644 --- a/lldb/bindings/python/python-wrapper.swig +++ b/lldb/bindings/python/python-wrapper.swig @@ -941,7 +941,7 @@ bool lldb_private::LLDBSWIGPythonRunScriptKeywordProcess( return true; } -llvm::Optional lldb_private::LLDBSWIGPythonRunScriptKeywordThread( +std::optional 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 lldb_private::LLDBSWIGPythonRunScriptKeywordFrame( +std::optional 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' || diff --git a/lldb/docs/resources/contributing.rst b/lldb/docs/resources/contributing.rst index 26b13a5..b2d4cf0 100644 --- a/lldb/docs/resources/contributing.rst +++ b/lldb/docs/resources/contributing.rst @@ -44,7 +44,7 @@ rules of thumb: missing object files, or otherwise inconsistent debug info, LLVM's error handling types such as `llvm::Expected `_ or - `llvm::Optional + `std::optional `_ should be used. Functions that may fail should return their result using these wrapper types instead of using a bool to indicate success. Returning diff --git a/lldb/include/lldb/Breakpoint/BreakpointID.h b/lldb/include/lldb/Breakpoint/BreakpointID.h index 4d171f0..dff9011 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointID.h +++ b/lldb/include/lldb/Breakpoint/BreakpointID.h @@ -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 + static std::optional ParseCanonicalReference(llvm::StringRef input); /// Takes an input string and checks to see whether it is a breakpoint name. diff --git a/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/lldb/include/lldb/Breakpoint/BreakpointResolver.h index 6c71f19..a0b37c9 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolver.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolver.h @@ -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 column = std::nullopt); + std::optional 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 5bf8d3e..5864a28 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/lldb/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -25,7 +25,7 @@ public: BreakpointResolverFileLine( const lldb::BreakpointSP &bkpt, lldb::addr_t offset, bool skip_prologue, const SourceLocationSpec &location_spec, - llvm::Optional removed_prefix_opt = std::nullopt); + std::optional 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 m_removed_prefix_opt; + std::optional m_removed_prefix_opt; private: BreakpointResolverFileLine(const BreakpointResolverFileLine &) = delete; diff --git a/lldb/include/lldb/Core/DataFileCache.h b/lldb/include/lldb/Core/DataFileCache.h index 4ad943c..5b63443 100644 --- a/lldb/include/lldb/Core/DataFileCache.h +++ b/lldb/include/lldb/Core/DataFileCache.h @@ -108,13 +108,13 @@ private: /// it is out of date. struct CacheSignature { /// UUID of object file or module. - llvm::Optional m_uuid = std::nullopt; + std::optional m_uuid = std::nullopt; /// Modification time of file on disk. - llvm::Optional m_mod_time = std::nullopt; + std::optional 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 m_obj_mod_time = std::nullopt; + std::optional m_obj_mod_time = std::nullopt; CacheSignature() = default; diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index 636ac23..dd3e6c0 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -174,7 +174,7 @@ public: ScriptInterpreter * GetScriptInterpreter(bool can_create = true, - llvm::Optional language = {}); + std::optional 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 debugger_id = std::nullopt, + std::optional 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 debugger_id = std::nullopt, + std::optional 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 debugger_id = std::nullopt, + std::optional 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 debugger_id); + std::optional debugger_id); static void ReportDiagnosticImpl(DiagnosticEventData::Type type, std::string message, - llvm::Optional debugger_id, + std::optional 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 m_current_event_id; + std::optional m_current_event_id; llvm::StringMap> m_stream_handlers; std::shared_ptr m_callback_handler_sp; diff --git a/lldb/include/lldb/Core/EmulateInstruction.h b/lldb/include/lldb/Core/EmulateInstruction.h index 2168802..6d76380 100644 --- a/lldb/include/lldb/Core/EmulateInstruction.h +++ b/lldb/include/lldb/Core/EmulateInstruction.h @@ -378,7 +378,7 @@ public: virtual bool TestEmulation(Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) = 0; - virtual llvm::Optional + virtual std::optional GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num) = 0; // Optional overrides @@ -391,7 +391,7 @@ public: uint32_t reg_num, std::string ®_name); // RegisterInfo variants - llvm::Optional ReadRegister(const RegisterInfo ®_info); + std::optional ReadRegister(const RegisterInfo ®_info); uint64_t ReadRegisterUnsigned(const RegisterInfo ®_info, uint64_t fail_value, bool *success_ptr); diff --git a/lldb/include/lldb/Core/Highlighter.h b/lldb/include/lldb/Core/Highlighter.h index 258d47c..58ecd37 100644 --- a/lldb/include/lldb/Core/Highlighter.h +++ b/lldb/include/lldb/Core/Highlighter.h @@ -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 cursor_pos, + std::optional 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 cursor_pos, + std::optional 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 cursor_pos, + std::optional cursor_pos, llvm::StringRef previous_lines, Stream &s) const override; }; diff --git a/lldb/include/lldb/Core/IOHandler.h b/lldb/include/lldb/Core/IOHandler.h index f2f9fa0..18d87ac 100644 --- a/lldb/include/lldb/Core/IOHandler.h +++ b/lldb/include/lldb/Core/IOHandler.h @@ -201,8 +201,8 @@ public: virtual void IOHandlerDeactivated(IOHandler &io_handler) {} - virtual llvm::Optional IOHandlerSuggestion(IOHandler &io_handler, - llvm::StringRef line); + virtual std::optional 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 SuggestionCallback(llvm::StringRef line); + std::optional SuggestionCallback(llvm::StringRef line); void AutoCompleteCallback(CompletionRequest &request); #endif diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 8ea6a27..56c3de1 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -842,11 +842,11 @@ public: void ReportErrorIfModifyDetected(const char *format, ...) __attribute__((format(printf, 2, 3))); - void ReportWarningOptimization(llvm::Optional debugger_id); + void ReportWarningOptimization(std::optional debugger_id); void ReportWarningUnsupportedLanguage(lldb::LanguageType language, - llvm::Optional debugger_id); + std::optional 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 RemapSourceFile(llvm::StringRef path) const; + std::optional 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 m_unwind_table; ///< Table of FuncUnwinders - /// objects created for this - /// Module's functions + std::optional 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 diff --git a/lldb/include/lldb/Core/Progress.h b/lldb/include/lldb/Core/Progress.h index 9238647..4807870 100644 --- a/lldb/include/lldb/Core/Progress.h +++ b/lldb/include/lldb/Core/Progress.h @@ -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 m_debugger_id; + std::optional 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. diff --git a/lldb/include/lldb/Core/SourceLocationSpec.h b/lldb/include/lldb/Core/SourceLocationSpec.h index 8fbb32a..3550dc0 100644 --- a/lldb/include/lldb/Core/SourceLocationSpec.h +++ b/lldb/include/lldb/Core/SourceLocationSpec.h @@ -48,7 +48,7 @@ public: /// Whether to look for an exact match. /// explicit SourceLocationSpec(FileSpec file_spec, uint32_t line, - llvm::Optional column = std::nullopt, + std::optional 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 GetLine() const; + std::optional GetLine() const; - llvm::Optional GetColumn() const; + std::optional GetColumn() const; bool GetCheckInlines() const { return m_check_inlines; } diff --git a/lldb/include/lldb/Core/SourceManager.h b/lldb/include/lldb/Core/SourceManager.h index 382b206..c272f7f 100644 --- a/lldb/include/lldb/Core/SourceManager.h +++ b/lldb/include/lldb/Core/SourceManager.h @@ -42,7 +42,7 @@ public: void UpdateIfNeeded(); - size_t DisplaySourceLines(uint32_t line, llvm::Optional column, + size_t DisplaySourceLines(uint32_t line, std::optional column, uint32_t context_before, uint32_t context_after, Stream *s); void FindLinesMatchingRegex(RegularExpression ®ex, uint32_t start_line, diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index 0f3ae9b..398c6e9 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -358,7 +358,7 @@ public: virtual bool CanProvideValue(); // Subclasses must implement the functions below. - virtual llvm::Optional GetByteSize() = 0; + virtual std::optional GetByteSize() = 0; virtual lldb::ValueType GetValueType() const = 0; diff --git a/lldb/include/lldb/Core/ValueObjectCast.h b/lldb/include/lldb/Core/ValueObjectCast.h index b9604ff..fe053c1 100644 --- a/lldb/include/lldb/Core/ValueObjectCast.h +++ b/lldb/include/lldb/Core/ValueObjectCast.h @@ -31,7 +31,7 @@ public: ConstString name, const CompilerType &cast_type); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; size_t CalculateNumChildren(uint32_t max) override; diff --git a/lldb/include/lldb/Core/ValueObjectChild.h b/lldb/include/lldb/Core/ValueObjectChild.h index 949b90e..a655911 100644 --- a/lldb/include/lldb/Core/ValueObjectChild.h +++ b/lldb/include/lldb/Core/ValueObjectChild.h @@ -31,7 +31,7 @@ class ValueObjectChild : public ValueObject { public: ~ValueObjectChild() override; - llvm::Optional GetByteSize() override { return m_byte_size; } + std::optional 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 m_can_update_with_invalid_exe_ctx; + std::optional m_can_update_with_invalid_exe_ctx; friend class ValueObject; friend class ValueObjectConstResult; diff --git a/lldb/include/lldb/Core/ValueObjectConstResult.h b/lldb/include/lldb/Core/ValueObjectConstResult.h index 3625828..4edd495 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResult.h +++ b/lldb/include/lldb/Core/ValueObjectConstResult.h @@ -63,7 +63,7 @@ public: static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const Status &error); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; lldb::ValueType GetValueType() const override; @@ -114,7 +114,7 @@ protected: CompilerType GetCompilerTypeImpl() override; ConstString m_type_name; - llvm::Optional m_byte_size; + std::optional m_byte_size; ValueObjectConstResultImpl m_impl; diff --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h index 36d9be9..2758b4e 100644 --- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h +++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h @@ -35,7 +35,7 @@ class ValueObjectDynamicValue : public ValueObject { public: ~ValueObjectDynamicValue() override = default; - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Core/ValueObjectMemory.h b/lldb/include/lldb/Core/ValueObjectMemory.h index 2666ff4..3c01df3 100644 --- a/lldb/include/lldb/Core/ValueObjectMemory.h +++ b/lldb/include/lldb/Core/ValueObjectMemory.h @@ -41,7 +41,7 @@ public: const Address &address, const CompilerType &ast_type); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h index 9277eaa..60c299c 100644 --- a/lldb/include/lldb/Core/ValueObjectRegister.h +++ b/lldb/include/lldb/Core/ValueObjectRegister.h @@ -37,7 +37,7 @@ public: lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; lldb::ValueType GetValueType() const override { return lldb::eValueTypeRegisterSet; @@ -87,7 +87,7 @@ public: lldb::RegisterContextSP ®_ctx_sp, const RegisterInfo *reg_info); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; lldb::ValueType GetValueType() const override { return lldb::eValueTypeRegister; diff --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h index 27d25fb..bdd6c1b 100644 --- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -37,7 +37,7 @@ class ValueObjectSynthetic : public ValueObject { public: ~ValueObjectSynthetic() override; - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h index 23be7ae..bba28ce 100644 --- a/lldb/include/lldb/Core/ValueObjectVariable.h +++ b/lldb/include/lldb/Core/ValueObjectVariable.h @@ -38,7 +38,7 @@ public: static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp); - llvm::Optional GetByteSize() override; + std::optional GetByteSize() override; ConstString GetTypeName() override; diff --git a/lldb/include/lldb/Expression/ExpressionVariable.h b/lldb/include/lldb/Expression/ExpressionVariable.h index d1a3261..2734353 100644 --- a/lldb/include/lldb/Expression/ExpressionVariable.h +++ b/lldb/include/lldb/Expression/ExpressionVariable.h @@ -33,7 +33,7 @@ public: virtual ~ExpressionVariable(); - llvm::Optional GetByteSize() { return m_frozen_sp->GetByteSize(); } + std::optional 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 + virtual std::optional GetCompilerTypeFromPersistentDecl(ConstString type_name) = 0; virtual lldb::addr_t LookupSymbol(ConstString name); diff --git a/lldb/include/lldb/Host/Editline.h b/lldb/include/lldb/Host/Editline.h index ee92121..bda3f06 100644 --- a/lldb/include/lldb/Host/Editline.h +++ b/lldb/include/lldb/Host/Editline.h @@ -99,7 +99,7 @@ using FixIndentationCallbackType = llvm::unique_function; using SuggestionCallbackType = - llvm::unique_function(llvm::StringRef)>; + llvm::unique_function(llvm::StringRef)>; using CompleteCallbackType = llvm::unique_function; diff --git a/lldb/include/lldb/Host/File.h b/lldb/include/lldb/Host/File.h index 85c1ae8..ba5772d 100644 --- a/lldb/include/lldb/Host/File.h +++ b/lldb/include/lldb/Host/File.h @@ -438,10 +438,10 @@ private: class SerialPort : public NativeFile { public: struct Options { - llvm::Optional BaudRate = std::nullopt; - llvm::Optional Parity = std::nullopt; - llvm::Optional ParityCheck = std::nullopt; - llvm::Optional StopBits = std::nullopt; + std::optional BaudRate = std::nullopt; + std::optional Parity = std::nullopt; + std::optional ParityCheck = std::nullopt; + std::optional StopBits = std::nullopt; }; // Obtain Options corresponding to the passed URL query string diff --git a/lldb/include/lldb/Host/FileSystem.h b/lldb/include/lldb/Host/FileSystem.h index 52242ac..aefad00 100644 --- a/lldb/include/lldb/Host/FileSystem.h +++ b/lldb/include/lldb/Host/FileSystem.h @@ -196,7 +196,7 @@ public: void SetHomeDirectory(std::string home_directory); private: - static llvm::Optional &InstanceImpl(); + static std::optional &InstanceImpl(); llvm::IntrusiveRefCntPtr m_fs; std::string m_home_directory; }; diff --git a/lldb/include/lldb/Host/HostInfoBase.h b/lldb/include/lldb/Host/HostInfoBase.h index 11a50cf..42f71d9 100644 --- a/lldb/include/lldb/Host/HostInfoBase.h +++ b/lldb/include/lldb/Host/HostInfoBase.h @@ -65,7 +65,8 @@ public: static const ArchSpec & GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault); - static llvm::Optional ParseArchitectureKind(llvm::StringRef kind); + static std::optional + ParseArchitectureKind(llvm::StringRef kind); /// Returns the directory containing the lldb shared library. Only the /// directory member of the FileSpec is filled in. diff --git a/lldb/include/lldb/Host/common/NativeProcessProtocol.h b/lldb/include/lldb/Host/common/NativeProcessProtocol.h index b1d6638..057c07b 100644 --- a/lldb/include/lldb/Host/common/NativeProcessProtocol.h +++ b/lldb/include/lldb/Host/common/NativeProcessProtocol.h @@ -172,7 +172,7 @@ public: // Watchpoint functions virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const; - virtual llvm::Optional> + virtual std::optional> 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 GetExitStatus(); + virtual std::optional 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 m_exit_status; + std::optional m_exit_status; NativeDelegate &m_delegate; NativeWatchpointList m_watchpoint_list; diff --git a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h index 1d7d8fe..d265b8a 100644 --- a/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h +++ b/lldb/include/lldb/Host/freebsd/HostInfoFreeBSD.h @@ -19,7 +19,7 @@ namespace lldb_private { class HostInfoFreeBSD : public HostInfoPosix { public: static llvm::VersionTuple GetOSVersion(); - static llvm::Optional GetOSBuildString(); + static std::optional GetOSBuildString(); static FileSpec GetProgramFileSpec(); }; } diff --git a/lldb/include/lldb/Host/linux/Host.h b/lldb/include/lldb/Host/linux/Host.h index f17c5b6..08ac41b 100644 --- a/lldb/include/lldb/Host/linux/Host.h +++ b/lldb/include/lldb/Host/linux/Host.h @@ -16,7 +16,7 @@ namespace lldb_private { // Get PID (i.e. the primary thread ID) corresponding to the specified TID. -llvm::Optional getPIDForTID(lldb::pid_t tid); +std::optional getPIDForTID(lldb::pid_t tid); } // namespace lldb_private diff --git a/lldb/include/lldb/Host/linux/HostInfoLinux.h b/lldb/include/lldb/Host/linux/HostInfoLinux.h index 6cf4ace..2964f3f 100644 --- a/lldb/include/lldb/Host/linux/HostInfoLinux.h +++ b/lldb/include/lldb/Host/linux/HostInfoLinux.h @@ -27,7 +27,7 @@ public: static void Terminate(); static llvm::VersionTuple GetOSVersion(); - static llvm::Optional GetOSBuildString(); + static std::optional GetOSBuildString(); static llvm::StringRef GetDistributionId(); static FileSpec GetProgramFileSpec(); diff --git a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h index ebe77c6..0402509 100644 --- a/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h +++ b/lldb/include/lldb/Host/macosx/HostInfoMacOSX.h @@ -25,7 +25,7 @@ class HostInfoMacOSX : public HostInfoPosix { public: static llvm::VersionTuple GetOSVersion(); static llvm::VersionTuple GetMacCatalystVersion(); - static llvm::Optional GetOSBuildString(); + static std::optional GetOSBuildString(); static FileSpec GetProgramFileSpec(); static FileSpec GetXcodeContentsDirectory(); static FileSpec GetXcodeDeveloperDirectory(); diff --git a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h index 2024af7..01daefa 100644 --- a/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h +++ b/lldb/include/lldb/Host/netbsd/HostInfoNetBSD.h @@ -19,7 +19,7 @@ namespace lldb_private { class HostInfoNetBSD : public HostInfoPosix { public: static llvm::VersionTuple GetOSVersion(); - static llvm::Optional GetOSBuildString(); + static std::optional GetOSBuildString(); static FileSpec GetProgramFileSpec(); }; } diff --git a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h index 9746deb..ed8aa2a 100644 --- a/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h +++ b/lldb/include/lldb/Host/openbsd/HostInfoOpenBSD.h @@ -19,7 +19,7 @@ namespace lldb_private { class HostInfoOpenBSD : public HostInfoPosix { public: static llvm::VersionTuple GetOSVersion(); - static llvm::Optional GetOSBuildString(); + static std::optional GetOSBuildString(); static FileSpec GetProgramFileSpec(); }; } diff --git a/lldb/include/lldb/Host/posix/HostInfoPosix.h b/lldb/include/lldb/Host/posix/HostInfoPosix.h index 407fa49..8d070d3 100644 --- a/lldb/include/lldb/Host/posix/HostInfoPosix.h +++ b/lldb/include/lldb/Host/posix/HostInfoPosix.h @@ -23,7 +23,7 @@ class HostInfoPosix : public HostInfoBase { public: static size_t GetPageSize(); static bool GetHostname(std::string &s); - static llvm::Optional GetOSKernelDescription(); + static std::optional GetOSKernelDescription(); static uint32_t GetUserID(); static uint32_t GetGroupID(); diff --git a/lldb/include/lldb/Host/windows/HostInfoWindows.h b/lldb/include/lldb/Host/windows/HostInfoWindows.h index b8381fa..8a4f5c7 100644 --- a/lldb/include/lldb/Host/windows/HostInfoWindows.h +++ b/lldb/include/lldb/Host/windows/HostInfoWindows.h @@ -28,8 +28,8 @@ public: static UserIDResolver &GetUserIDResolver(); static llvm::VersionTuple GetOSVersion(); - static llvm::Optional GetOSBuildString(); - static llvm::Optional GetOSKernelDescription(); + static std::optional GetOSBuildString(); + static std::optional GetOSKernelDescription(); static bool GetHostname(std::string &s); static FileSpec GetProgramFileSpec(); static FileSpec GetDefaultShell(); diff --git a/lldb/include/lldb/Interpreter/CommandHistory.h b/lldb/include/lldb/Interpreter/CommandHistory.h index 60a2df3..aa30185 100644 --- a/lldb/include/lldb/Interpreter/CommandHistory.h +++ b/lldb/include/lldb/Interpreter/CommandHistory.h @@ -29,7 +29,7 @@ public: bool IsEmpty() const; - llvm::Optional FindString(llvm::StringRef input_str) const; + std::optional FindString(llvm::StringRef input_str) const; llvm::StringRef GetStringAtIndex(size_t idx) const; diff --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h index e73999e..38ff061 100644 --- a/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -407,7 +407,7 @@ public: /// Returns the auto-suggestion string that should be added to the given /// command line. - llvm::Optional GetAutoSuggestionForCommand(llvm::StringRef line); + std::optional 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 m_quit_exit_code; + std::optional m_quit_exit_code; // If the driver is accepts custom exit codes for the 'quit' command. bool m_allow_exit_code = false; diff --git a/lldb/include/lldb/Interpreter/CommandObject.h b/lldb/include/lldb/Interpreter/CommandObject.h index cebd8a3..86750a4 100644 --- a/lldb/include/lldb/Interpreter/CommandObject.h +++ b/lldb/include/lldb/Interpreter/CommandObject.h @@ -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 + virtual std::optional GetRepeatCommand(Args ¤t_command_args, uint32_t index) { return std::nullopt; } diff --git a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h index 4414011..1c14b49 100644 --- a/lldb/include/lldb/Interpreter/CommandObjectMultiword.h +++ b/lldb/include/lldb/Interpreter/CommandObjectMultiword.h @@ -56,8 +56,8 @@ public: void HandleCompletion(CompletionRequest &request) override; - llvm::Optional GetRepeatCommand(Args ¤t_command_args, - uint32_t index) override; + std::optional GetRepeatCommand(Args ¤t_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 GetRepeatCommand(Args ¤t_command_args, - uint32_t index) override; + std::optional GetRepeatCommand(Args ¤t_command_args, + uint32_t index) override; /// \return /// An error message to be displayed when the command is executed (i.e. diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/lldb/include/lldb/Interpreter/ScriptInterpreter.h index 548b84f..ec561804 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -576,7 +576,7 @@ public: Status GetStatusFromSBError(const lldb::SBError &error) const; - llvm::Optional GetOpaqueTypeFromSBMemoryRegionInfo( + std::optional GetOpaqueTypeFromSBMemoryRegionInfo( const lldb::SBMemoryRegionInfo &mem_region) const; protected: diff --git a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h index beaadb3..6d1860a 100644 --- a/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h +++ b/lldb/include/lldb/Interpreter/ScriptedProcessInterface.h @@ -36,7 +36,7 @@ public: virtual Status Stop() { return Status("ScriptedProcess did not stop"); } - virtual llvm::Optional + virtual std::optional 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 GetScriptedThreadPluginName() { + virtual std::optional GetScriptedThreadPluginName() { return std::nullopt; } @@ -87,11 +87,11 @@ public: virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; } - virtual llvm::Optional GetName() { return std::nullopt; } + virtual std::optional GetName() { return std::nullopt; } virtual lldb::StateType GetState() { return lldb::eStateInvalid; } - virtual llvm::Optional GetQueue() { return std::nullopt; } + virtual std::optional GetQueue() { return std::nullopt; } virtual StructuredData::DictionarySP GetStopReason() { return {}; } @@ -99,7 +99,7 @@ public: virtual StructuredData::DictionarySP GetRegisterInfo() { return {}; } - virtual llvm::Optional GetRegisterContext() { + virtual std::optional GetRegisterContext() { return std::nullopt; } diff --git a/lldb/include/lldb/Symbol/CompilerType.h b/lldb/include/lldb/Symbol/CompilerType.h index 818420f..c96fc5a 100644 --- a/lldb/include/lldb/Symbol/CompilerType.h +++ b/lldb/include/lldb/Symbol/CompilerType.h @@ -327,16 +327,15 @@ public: struct IntegralTemplateArgument; /// Return the size of the type in bytes. - llvm::Optional GetByteSize(ExecutionContextScope *exe_scope) const; + std::optional GetByteSize(ExecutionContextScope *exe_scope) const; /// Return the size of the type in bits. - llvm::Optional GetBitSize(ExecutionContextScope *exe_scope) const; + std::optional GetBitSize(ExecutionContextScope *exe_scope) const; lldb::Encoding GetEncoding(uint64_t &count) const; lldb::Format GetFormat() const; - llvm::Optional - GetTypeBitAlign(ExecutionContextScope *exe_scope) const; + std::optional 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 + std::optional GetIntegralTemplateArgument(size_t idx, bool expand_pack = false) const; CompilerType GetTypeForFormatters() const; diff --git a/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h b/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h index be70ac4..ea5c325 100644 --- a/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h +++ b/lldb/include/lldb/Symbol/DWARFCallFrameInfo.h @@ -123,7 +123,7 @@ private: bool IsEHFrame() const; - llvm::Optional + std::optional GetFirstFDEEntryInRange(const AddressRange &range); void GetFDEIndex(); diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index f0e1611..bae6e72 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -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 m_symtab_once_up; - llvm::Optional m_cache_hash; + std::optional 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 diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index b4f378f..d5fe033 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -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 + virtual std::optional 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> m_compile_units; + std::optional> m_compile_units; TypeList m_type_list; Symtab *m_symtab = nullptr; uint32_t m_abilities = 0; diff --git a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h index fc9c5800..1f5b0c0 100644 --- a/lldb/include/lldb/Symbol/SymbolFileOnDemand.h +++ b/lldb/include/lldb/Symbol/SymbolFileOnDemand.h @@ -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 GetDynamicArrayInfoForUID( + std::optional GetDynamicArrayInfoForUID( lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) override; diff --git a/lldb/include/lldb/Symbol/Type.h b/lldb/include/lldb/Symbol/Type.h index 045db47..d04a0fe 100644 --- a/lldb/include/lldb/Symbol/Type.h +++ b/lldb/include/lldb/Symbol/Type.h @@ -102,7 +102,7 @@ public: }; Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, - llvm::Optional byte_size, SymbolContextScope *context, + std::optional 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 GetByteSize(ExecutionContextScope *exe_scope); + std::optional GetByteSize(ExecutionContextScope *exe_scope); uint32_t GetNumChildren(bool omit_empty_base_classes); diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h index c3b0ef8..a358d6f 100644 --- a/lldb/include/lldb/Symbol/TypeSystem.h +++ b/lldb/include/lldb/Symbol/TypeSystem.h @@ -47,7 +47,7 @@ struct LanguageSet { LanguageSet(); /// If the set contains a single language only, return it. - llvm::Optional GetSingularLanguage(); + std::optional 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 + virtual std::optional 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 + virtual std::optional 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 + virtual std::optional 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 ReportStatistics(); + virtual std::optional 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 GetTypeSystemForLanguage( lldb::LanguageType language, - llvm::Optional create_callback = std::nullopt); + std::optional create_callback = std::nullopt); }; } // namespace lldb_private diff --git a/lldb/include/lldb/Symbol/UnwindTable.h b/lldb/include/lldb/Symbol/UnwindTable.h index b5e56d3..a302650 100644 --- a/lldb/include/lldb/Symbol/UnwindTable.h +++ b/lldb/include/lldb/Symbol/UnwindTable.h @@ -61,8 +61,8 @@ private: void Dump(Stream &s); void Initialize(); - llvm::Optional GetAddressRange(const Address &addr, - SymbolContext &sc); + std::optional GetAddressRange(const Address &addr, + SymbolContext &sc); typedef std::map collection; typedef collection::iterator iterator; diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index 5cd779f..9cc79dc 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -151,7 +151,7 @@ public: /// from the user interface. virtual bool IsAllowedRuntimeValue(ConstString name) { return false; } - virtual llvm::Optional GetRuntimeType(CompilerType base_type) { + virtual std::optional GetRuntimeType(CompilerType base_type) { return std::nullopt; } diff --git a/lldb/include/lldb/Target/MemoryRegionInfo.h b/lldb/include/lldb/Target/MemoryRegionInfo.h index 1bb7054..8d639a8 100644 --- a/lldb/include/lldb/Target/MemoryRegionInfo.h +++ b/lldb/include/lldb/Target/MemoryRegionInfo.h @@ -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> &GetDirtyPageList() const { + const std::optional> &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> m_dirty_pages; + std::optional> m_dirty_pages; }; inline bool operator<(const MemoryRegionInfo &lhs, diff --git a/lldb/include/lldb/Target/MemoryTagMap.h b/lldb/include/lldb/Target/MemoryTagMap.h index 953eb32..00543bb 100644 --- a/lldb/include/lldb/Target/MemoryTagMap.h +++ b/lldb/include/lldb/Target/MemoryTagMap.h @@ -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> GetTags(lldb::addr_t addr, - size_t len) const; + std::vector> 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 GetTag(lldb::addr_t addr) const; + std::optional GetTag(lldb::addr_t addr) const; // A map of granule aligned addresses to their memory tag std::map 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 allows it to handle + // returning a MemoryTagMap, std::optional 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; diff --git a/lldb/include/lldb/Target/PathMappingList.h b/lldb/include/lldb/Target/PathMappingList.h index 37267d9..447fb43 100644 --- a/lldb/include/lldb/Target/PathMappingList.h +++ b/lldb/include/lldb/Target/PathMappingList.h @@ -90,8 +90,8 @@ public: /// /// \return /// The remapped filespec that may or may not exist on disk. - llvm::Optional RemapPath(llvm::StringRef path, - bool only_if_exists = false) const; + std::optional 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 ReverseRemapPath(const FileSpec &file, - FileSpec &fixed) const; + std::optional 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 FindFile(const FileSpec &orig_spec) const; + std::optional FindFile(const FileSpec &orig_spec) const; uint32_t FindIndexForPath(llvm::StringRef path) const; diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h index c4073b1..08e47cc 100644 --- a/lldb/include/lldb/Target/Platform.h +++ b/lldb/include/lldb/Target/Platform.h @@ -204,9 +204,9 @@ public: bool SetOSVersion(llvm::VersionTuple os_version); - llvm::Optional GetOSBuildString(); + std::optional GetOSBuildString(); - llvm::Optional GetOSKernelDescription(); + std::optional 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 GetRemoteOSBuildString() { + virtual std::optional GetRemoteOSBuildString() { return std::nullopt; } - virtual llvm::Optional GetRemoteOSKernelDescription() { + virtual std::optional GetRemoteOSKernelDescription() { return std::nullopt; } diff --git a/lldb/include/lldb/Target/RemoteAwarePlatform.h b/lldb/include/lldb/Target/RemoteAwarePlatform.h index 8354b49..d183815 100644 --- a/lldb/include/lldb/Target/RemoteAwarePlatform.h +++ b/lldb/include/lldb/Target/RemoteAwarePlatform.h @@ -65,8 +65,8 @@ public: FileSpec &local_file) override; bool GetRemoteOSVersion() override; - llvm::Optional GetRemoteOSBuildString() override; - llvm::Optional GetRemoteOSKernelDescription() override; + std::optional GetRemoteOSBuildString() override; + std::optional GetRemoteOSKernelDescription() override; ArchSpec GetRemoteSystemArchitecture() override; Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir, diff --git a/lldb/include/lldb/Target/StackFrameRecognizer.h b/lldb/include/lldb/Target/StackFrameRecognizer.h index e14df80..419f0c0 100644 --- a/lldb/include/lldb/Target/StackFrameRecognizer.h +++ b/lldb/include/lldb/Target/StackFrameRecognizer.h @@ -155,7 +155,7 @@ class ValueObjectRecognizerSynthesizedValue : public ValueObject { SetName(parent.GetName()); } - llvm::Optional GetByteSize() override { + std::optional GetByteSize() override { return m_parent->GetByteSize(); } lldb::ValueType GetValueType() const override { return m_type; } diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 2be51ac..f672786 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -146,9 +146,9 @@ public: protected: StatsDuration m_create_time; - llvm::Optional m_launch_or_attach_time; - llvm::Optional m_first_private_stop_time; - llvm::Optional m_first_public_stop_time; + std::optional m_launch_or_attach_time; + std::optional m_first_private_stop_time; + std::optional m_first_public_stop_time; StatsSuccessFail m_expr_eval{"expressionEvaluation"}; StatsSuccessFail m_frame_var{"frameVariable"}; std::vector m_module_identifiers; diff --git a/lldb/include/lldb/Target/Trace.h b/lldb/include/lldb/Target/Trace.h index bf6b24f..fc67a0e 100644 --- a/lldb/include/lldb/Target/Trace.h +++ b/lldb/include/lldb/Target/Trace.h @@ -465,19 +465,19 @@ protected: GetLiveProcessBinaryData(llvm::StringRef kind); /// Get the size of the data returned by \a GetLiveThreadBinaryData - llvm::Optional GetLiveThreadBinaryDataSize(lldb::tid_t tid, - llvm::StringRef kind); + std::optional GetLiveThreadBinaryDataSize(lldb::tid_t tid, + llvm::StringRef kind); /// Get the size of the data returned by \a GetLiveCpuBinaryData - llvm::Optional GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id, - llvm::StringRef kind); + std::optional GetLiveCpuBinaryDataSize(lldb::cpu_id_t cpu_id, + llvm::StringRef kind); /// Get the size of the data returned by \a GetLiveProcessBinaryData - llvm::Optional GetLiveProcessBinaryDataSize(llvm::StringRef kind); + std::optional GetLiveProcessBinaryDataSize(llvm::StringRef kind); /// Constructor for post mortem processes Trace(llvm::ArrayRef postmortem_processes, - llvm::Optional> postmortem_cpus); + std::optional> 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> cpus; + std::optional> 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 live_refresh_error; + std::optional live_refresh_error; } m_storage; /// Get the storage after refreshing the data in the case of a live process. diff --git a/lldb/include/lldb/Target/TraceCursor.h b/lldb/include/lldb/Target/TraceCursor.h index 576b370..cfc25b0 100644 --- a/lldb/include/lldb/Target/TraceCursor.h +++ b/lldb/include/lldb/Target/TraceCursor.h @@ -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 GetWallClockTime() const = 0; + virtual std::optional GetWallClockTime() const = 0; /// Get some metadata associated with a synchronization point event. As /// different trace technologies might have different values for this, diff --git a/lldb/include/lldb/Target/TraceDumper.h b/lldb/include/lldb/Target/TraceDumper.h index 4a8fbf8..72dcf64 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 id = std::nullopt; + std::optional id = std::nullopt; /// Optional number of instructions to skip from the starting position /// of the cursor. - llvm::Optional skip = std::nullopt; + std::optional 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 timestamp; + std::optional timestamp; std::optional hw_clock; std::optional sync_point_metadata; - llvm::Optional error; - llvm::Optional event; - llvm::Optional symbol_info; - llvm::Optional prev_symbol_info; + std::optional error; + std::optional event; + std::optional symbol_info; + std::optional prev_symbol_info; std::optional cpu_id; }; @@ -350,7 +350,8 @@ public: /// \return /// A optional to the untraced prefix segment of this call. - const llvm::Optional &GetUntracedPrefixSegment() const; + const std::optional & + 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 m_untraced_prefix_segment; + std::optional 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 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 DumpInstructions(size_t count); + std::optional DumpInstructions(size_t count); /// Dump all function calls forwards chronologically and hierarchically void DumpFunctionCalls(); diff --git a/lldb/include/lldb/Target/UnixSignals.h b/lldb/include/lldb/Target/UnixSignals.h index 52761ae..c996723 100644 --- a/lldb/include/lldb/Target/UnixSignals.h +++ b/lldb/include/lldb/Target/UnixSignals.h @@ -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 GetFilteredSignals(llvm::Optional should_suppress, - llvm::Optional should_stop, - llvm::Optional should_notify); + std::vector GetFilteredSignals(std::optional should_suppress, + std::optional should_stop, + std::optional should_notify); protected: // Classes that inherit from UnixSignals can see and modify these diff --git a/lldb/include/lldb/Utility/Diagnostics.h b/lldb/include/lldb/Utility/Diagnostics.h index f9246f1..225346a 100644 --- a/lldb/include/lldb/Utility/Diagnostics.h +++ b/lldb/include/lldb/Utility/Diagnostics.h @@ -56,7 +56,7 @@ public: static llvm::Expected CreateUniqueDirectory(); private: - static llvm::Optional &InstanceImpl(); + static std::optional &InstanceImpl(); llvm::Error DumpDiangosticsLog(const FileSpec &dir) const; diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h index b191865..e4d3d12 100644 --- a/lldb/include/lldb/Utility/FileSpec.h +++ b/lldb/include/lldb/Utility/FileSpec.h @@ -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