llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-lldb Author: Pete Lawrence (PortalPete) <details> <summary>Changes</summary> ### Purpose For now, we'd like to get people's thought's on the goal, design, and scope of this PR by reviewing these preliminary changes. I recommend focussing (or starting) on these files: * `ValueObject.h` * `ValueObject.cpp` ### Goal Every `ValueObjectSP` will have an actual value and will never be equal to `nullptr`. ### Design To force each `ValueObjectSP` to contain _something_, we're considering changing the type from a typedef… ```cpp typedef std::shared_ptr<lldb_private::ValueObject> ValueObjectSP; ``` to this subclass: ```cpp class ValueObjectSP : public std::shared_ptr<lldb_private::ValueObject> { ValueObjectSP() = delete; operator bool() = delete; public: ValueObjectSP(std::shared_ptr<lldb_private::ValueObject> &&pointer) : std::shared_ptr<lldb_private::ValueObject>(std::move(pointer)) { assert(pointer); } }; ``` This class removes the default constructor to force each `ValueObjectSP` to point to a real `ValueObject` instance. It also removes `operator bool()` because no instance will ever equal `nullptr`. ### Change Patterns The bulk of the changes into one of these two camps: 1. For methods that have a `Status &error` parameter **and** return an `ValueObjectSP`, the return value *becomes* the container for the error state, which eliminate the need for a parameter. * This means that callers of these methods need to check the return value's error state. * `return_value->GetError.Success()` * `return_value->GetError.Fail()` 2. For all other methods that return a `ValueObjectSP` but don't have a `Status &` parameter, they now return `std::optional<ValueObjectSP>`. * This changes a fair amount of code in these ways: * Code which had been using the `std::shared_ptr` Boolean operator now uses the `std::optional` Boolean operator. * Nearby code has to call the optional's `value()` method to get the shared pointer inside. * Methods with lines that return `ValueObjectSP()` now return `{}`, which creates an optional with nothing in it. Again, I recommend focussing (or starting) on these files: * `ValueObject.h` * `ValueObject.cpp` ### Remaining work This is very much a work-in-progress for a proof of concept, which means: * It doesn't compile (yet) * So far I've modified 53 files * I estimate another 100-250 more files need to change based on the ninja build progress indicator. The remaining changes will just be more of the same but now's a good time to take a look at this sample to get a sense of the magnitude and trajectory of the remaining changes. --- Patch is 205.92 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/74912.diff 53 Files Affected: - (modified) lldb/include/lldb/Breakpoint/Watchpoint.h (+2-2) - (modified) lldb/include/lldb/Core/ValueObject.h (+43-34) - (modified) lldb/include/lldb/Core/ValueObjectConstResult.h (+4-4) - (modified) lldb/include/lldb/Core/ValueObjectConstResultCast.h (+3-3) - (modified) lldb/include/lldb/Core/ValueObjectConstResultChild.h (+3-3) - (modified) lldb/include/lldb/Core/ValueObjectConstResultImpl.h (+4-4) - (modified) lldb/include/lldb/Core/ValueObjectList.h (+10-7) - (modified) lldb/include/lldb/Core/ValueObjectRegister.h (+2-2) - (modified) lldb/include/lldb/Core/ValueObjectSyntheticFilter.h (+5-5) - (modified) lldb/include/lldb/Core/ValueObjectUpdater.h (+3-3) - (modified) lldb/include/lldb/DataFormatters/TypeSynthetic.h (+12-10) - (modified) lldb/include/lldb/DataFormatters/ValueObjectPrinter.h (+2-1) - (modified) lldb/include/lldb/DataFormatters/VectorIterator.h (+1-1) - (modified) lldb/include/lldb/Expression/ExpressionVariable.h (+37-16) - (modified) lldb/include/lldb/Expression/UserExpression.h (+1-1) - (modified) lldb/include/lldb/Interpreter/ScriptInterpreter.h (+4-4) - (modified) lldb/include/lldb/Target/LanguageRuntime.h (+3-3) - (modified) lldb/include/lldb/Target/StackFrame.h (+6-6) - (modified) lldb/include/lldb/Target/StackFrameRecognizer.h (+1-3) - (modified) lldb/include/lldb/Target/Target.h (+1-1) - (modified) lldb/include/lldb/Target/Thread.h (+2-2) - (modified) lldb/include/lldb/Target/ThreadPlan.h (+2-2) - (modified) lldb/include/lldb/Target/ThreadPlanCallFunction.h (+1-1) - (modified) lldb/include/lldb/lldb-forward.h (+19-1) - (modified) lldb/source/Breakpoint/BreakpointLocation.cpp (+2-4) - (modified) lldb/source/Breakpoint/Watchpoint.cpp (+13-9) - (modified) lldb/source/Commands/CommandObjectDWIMPrint.cpp (+12-11) - (modified) lldb/source/Commands/CommandObjectExpression.cpp (+14-11) - (modified) lldb/source/Commands/CommandObjectFrame.cpp (+19-17) - (modified) lldb/source/Commands/CommandObjectMemory.cpp (+9-16) - (modified) lldb/source/Commands/CommandObjectTarget.cpp (+3-4) - (modified) lldb/source/Commands/CommandObjectThread.cpp (+5-10) - (modified) lldb/source/Commands/CommandObjectType.cpp (+7-5) - (modified) lldb/source/Commands/CommandObjectWatchpoint.cpp (+9-9) - (modified) lldb/source/Core/FormatEntity.cpp (+15-14) - (modified) lldb/source/Core/IOHandlerCursesGUI.cpp (+16-13) - (modified) lldb/source/Core/ValueObject.cpp (+328-346) - (modified) lldb/source/Core/ValueObjectConstResult.cpp (+11-9) - (modified) lldb/source/Core/ValueObjectConstResultCast.cpp (+6-5) - (modified) lldb/source/Core/ValueObjectConstResultChild.cpp (+6-5) - (modified) lldb/source/Core/ValueObjectConstResultImpl.cpp (+32-17) - (modified) lldb/source/Core/ValueObjectList.cpp (+30-35) - (modified) lldb/source/Core/ValueObjectRegister.cpp (+2-2) - (modified) lldb/source/Core/ValueObjectSyntheticFilter.cpp (+24-22) - (modified) lldb/source/Core/ValueObjectUpdater.cpp (+9-9) - (modified) lldb/source/DataFormatters/FormatManager.cpp (+20-17) - (modified) lldb/source/DataFormatters/TypeSynthetic.cpp (+14-12) - (modified) lldb/source/DataFormatters/ValueObjectPrinter.cpp (+14-12) - (modified) lldb/source/DataFormatters/VectorType.cpp (+6-8) - (modified) lldb/source/Expression/ExpressionVariable.cpp (+9-5) - (modified) lldb/source/Target/StackFrame.cpp (+191-177) - (modified) lldb/source/Target/Target.cpp (+1-1) - (modified) lldb/source/Target/Thread.cpp (+13-10) ``````````diff diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h b/lldb/include/lldb/Breakpoint/Watchpoint.h index 851162af24c74e..78b81218bfcf45 100644 --- a/lldb/include/lldb/Breakpoint/Watchpoint.h +++ b/lldb/include/lldb/Breakpoint/Watchpoint.h @@ -219,8 +219,8 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>, uint32_t m_ignore_count; // Number of times to ignore this watchpoint std::string m_decl_str; // Declaration information, if any. std::string m_watch_spec_str; // Spec for the watchpoint. - lldb::ValueObjectSP m_old_value_sp; - lldb::ValueObjectSP m_new_value_sp; + std::optional<lldb::ValueObjectSP> m_old_value_sp; + std::optional<lldb::ValueObjectSP> m_new_value_sp; CompilerType m_type; Status m_error; // An error object describing errors associated with this // watchpoint. diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h index a158199e7fab1a..06184a5bde0715 100644 --- a/lldb/include/lldb/Core/ValueObject.h +++ b/lldb/include/lldb/Core/ValueObject.h @@ -409,7 +409,7 @@ class ValueObject { Stream &s, GetExpressionPathFormat = eGetExpressionPathFormatDereferencePointers); - lldb::ValueObjectSP GetValueForExpressionPath( + std::optional<lldb::ValueObjectSP> GetValueForExpressionPath( llvm::StringRef expression, ExpressionPathScanEndReason *reason_to_stop = nullptr, ExpressionPathEndResultType *final_value_type = nullptr, @@ -465,22 +465,24 @@ class ValueObject { /// Returns a unique id for this ValueObject. lldb::user_id_t GetID() const { return m_id.GetID(); } - virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, - bool can_create = true); + virtual std::optional<lldb::ValueObjectSP> + GetChildAtIndex(size_t idx, bool can_create = true); - // The method always creates missing children in the path, if necessary. - lldb::ValueObjectSP GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs, - size_t *index_of_error = nullptr); + /// The method always creates missing children in the path, if necessary. + std::optional<lldb::ValueObjectSP> + GetChildAtIndexPath(llvm::ArrayRef<size_t> idxs, + size_t *index_of_error = nullptr); - lldb::ValueObjectSP + std::optional<lldb::ValueObjectSP> GetChildAtIndexPath(llvm::ArrayRef<std::pair<size_t, bool>> idxs, size_t *index_of_error = nullptr); - // The method always creates missing children in the path, if necessary. - lldb::ValueObjectSP GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names); + /// The method always creates missing children in the path, if necessary. + std::optional<lldb::ValueObjectSP> + GetChildAtNamePath(llvm::ArrayRef<llvm::StringRef> names); - virtual lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name, - bool can_create = true); + virtual std::optional<lldb::ValueObjectSP> + GetChildMemberWithName(llvm::StringRef name, bool can_create = true); virtual size_t GetIndexOfChildWithName(llvm::StringRef name); @@ -544,7 +546,12 @@ class ValueObject { bool UpdateFormatsIfNeeded(); - lldb::ValueObjectSP GetSP() { return m_manager->GetSharedPointer(this); } + lldb::ValueObjectSP GetSP() { + std::shared_ptr<ValueObject> shared_pointer = + m_manager->GetSharedPointer(this); + lldb::ValueObjectSP value_object_sp(std::move(shared_pointer)); + return value_object_sp; + } /// Change the name of the current ValueObject. Should *not* be used from a /// synthetic child provider as it would change the name of the non synthetic @@ -556,26 +563,28 @@ class ValueObject { lldb::addr_t GetPointerValue(AddressType *address_type = nullptr); - lldb::ValueObjectSP GetSyntheticChild(ConstString key) const; + std::optional<lldb::ValueObjectSP> GetSyntheticChild(ConstString key) const; - lldb::ValueObjectSP GetSyntheticArrayMember(size_t index, bool can_create); + std::optional<lldb::ValueObjectSP> GetSyntheticArrayMember(size_t index, + bool can_create); - lldb::ValueObjectSP GetSyntheticBitFieldChild(uint32_t from, uint32_t to, - bool can_create); + std::optional<lldb::ValueObjectSP> + GetSyntheticBitFieldChild(uint32_t from, uint32_t to, bool can_create); - lldb::ValueObjectSP GetSyntheticExpressionPathChild(const char *expression, - bool can_create); + std::optional<lldb::ValueObjectSP> + GetSyntheticExpressionPathChild(const char *expression, bool can_create); - virtual lldb::ValueObjectSP + virtual std::optional<lldb::ValueObjectSP> GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()); - virtual lldb::ValueObjectSP + virtual std::optional<lldb::ValueObjectSP> GetSyntheticBase(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()); - virtual lldb::ValueObjectSP GetDynamicValue(lldb::DynamicValueType valueType); + virtual std::optional<lldb::ValueObjectSP> + GetDynamicValue(lldb::DynamicValueType valueType); lldb::DynamicValueType GetDynamicValueType(); @@ -583,7 +592,7 @@ class ValueObject { virtual lldb::ValueObjectSP GetNonSyntheticValue() { return GetSP(); } - lldb::ValueObjectSP GetSyntheticValue(); + std::optional<lldb::ValueObjectSP> GetSyntheticValue(); virtual bool HasSyntheticValue(); @@ -595,7 +604,7 @@ class ValueObject { virtual lldb::ValueObjectSP CreateConstantValue(ConstString name); - virtual lldb::ValueObjectSP Dereference(Status &error); + virtual lldb::ValueObjectSP Dereference(); /// Creates a copy of the ValueObject with a new name and setting the current /// ValueObject as its parent. It should be used when we want to change the @@ -603,7 +612,7 @@ class ValueObject { /// (e.g. sythetic child provider). virtual lldb::ValueObjectSP Clone(ConstString new_name); - virtual lldb::ValueObjectSP AddressOf(Status &error); + virtual lldb::ValueObjectSP AddressOf(); virtual lldb::addr_t GetLiveAddress() { return LLDB_INVALID_ADDRESS; } @@ -614,11 +623,11 @@ class ValueObject { virtual lldb::ValueObjectSP DoCast(const CompilerType &compiler_type); - virtual lldb::ValueObjectSP CastPointerType(const char *name, - CompilerType &ast_type); + virtual std::optional<lldb::ValueObjectSP> + CastPointerType(const char *name, CompilerType &ast_type); - virtual lldb::ValueObjectSP CastPointerType(const char *name, - lldb::TypeSP &type_sp); + virtual std::optional<lldb::ValueObjectSP> + CastPointerType(const char *name, lldb::TypeSP &type_sp); /// If this object represents a C++ class with a vtable, return an object /// that represents the virtual function table. If the object isn't a class @@ -650,18 +659,18 @@ class ValueObject { void Dump(Stream &s, const DumpValueObjectOptions &options); - static lldb::ValueObjectSP + static std::optional<lldb::ValueObjectSP> CreateValueObjectFromExpression(llvm::StringRef name, llvm::StringRef expression, const ExecutionContext &exe_ctx); - static lldb::ValueObjectSP + static std::optional<lldb::ValueObjectSP> CreateValueObjectFromExpression(llvm::StringRef name, llvm::StringRef expression, const ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options); - static lldb::ValueObjectSP + static std::optional<lldb::ValueObjectSP> CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type); @@ -670,7 +679,7 @@ class ValueObject { CreateValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type); - lldb::ValueObjectSP Persist(); + std::optional<lldb::ValueObjectSP> Persist(); /// Returns true if this is a char* or a char[] if it is a char* and /// check_pointer is true, it also checks that the pointer is valid. @@ -882,7 +891,7 @@ class ValueObject { /// We have to hold onto a shared pointer to this one because it is created /// as an independent ValueObjectConstResult, which isn't managed by us. - lldb::ValueObjectSP m_addr_of_valobj_sp; + std::optional<lldb::ValueObjectSP> m_addr_of_valobj_sp; lldb::Format m_format = lldb::eFormatDefault; lldb::Format m_last_format = lldb::eFormatDefault; @@ -1006,7 +1015,7 @@ class ValueObject { GetRoot()->DoUpdateChildrenAddressType(*this); } - lldb::ValueObjectSP GetValueForExpressionPath_Impl( + std::optional<lldb::ValueObjectSP> GetValueForExpressionPath_Impl( llvm::StringRef expression_cstr, ExpressionPathScanEndReason *reason_to_stop, ExpressionPathEndResultType *final_value_type, diff --git a/lldb/include/lldb/Core/ValueObjectConstResult.h b/lldb/include/lldb/Core/ValueObjectConstResult.h index d61df859bebce4..2fedb0f99f0af4 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResult.h +++ b/lldb/include/lldb/Core/ValueObjectConstResult.h @@ -77,16 +77,16 @@ class ValueObjectConstResult : public ValueObject { void SetByteSize(size_t size); - lldb::ValueObjectSP Dereference(Status &error) override; + lldb::ValueObjectSP Dereference() override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; - lldb::ValueObjectSP GetSyntheticChildAtOffset( + std::optional<lldb::ValueObjectSP> GetSyntheticChildAtOffset( uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Status &error) override; + lldb::ValueObjectSP AddressOf() override; lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, AddressType *address_type = nullptr) override; @@ -101,7 +101,7 @@ class ValueObjectConstResult : public ValueObject { m_impl.SetLiveAddress(addr, address_type); } - lldb::ValueObjectSP + std::optional<lldb::ValueObjectSP> GetDynamicValue(lldb::DynamicValueType valueType) override; lldb::LanguageType GetPreferredDisplayLanguage() override; diff --git a/lldb/include/lldb/Core/ValueObjectConstResultCast.h b/lldb/include/lldb/Core/ValueObjectConstResultCast.h index efcbe0dc6a0bd9..8c36320125bbc9 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResultCast.h +++ b/lldb/include/lldb/Core/ValueObjectConstResultCast.h @@ -33,7 +33,7 @@ class ValueObjectConstResultCast : public ValueObjectCast { ~ValueObjectConstResultCast() override; - lldb::ValueObjectSP Dereference(Status &error) override; + lldb::ValueObjectSP Dereference() override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -42,11 +42,11 @@ class ValueObjectConstResultCast : public ValueObjectCast { return ValueObjectCast::GetCompilerType(); } - lldb::ValueObjectSP GetSyntheticChildAtOffset( + std::optional<lldb::ValueObjectSP> GetSyntheticChildAtOffset( uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Status &error) override; + lldb::ValueObjectSP AddressOf() override; size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0, uint32_t item_count = 1) override; diff --git a/lldb/include/lldb/Core/ValueObjectConstResultChild.h b/lldb/include/lldb/Core/ValueObjectConstResultChild.h index 7e9da14e8e97f7..b58e0995086ce6 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResultChild.h +++ b/lldb/include/lldb/Core/ValueObjectConstResultChild.h @@ -39,7 +39,7 @@ class ValueObjectConstResultChild : public ValueObjectChild { ~ValueObjectConstResultChild() override; - lldb::ValueObjectSP Dereference(Status &error) override; + lldb::ValueObjectSP Dereference() override; ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; @@ -48,11 +48,11 @@ class ValueObjectConstResultChild : public ValueObjectChild { return ValueObjectChild::GetCompilerType(); } - lldb::ValueObjectSP GetSyntheticChildAtOffset( + std::optional<lldb::ValueObjectSP> GetSyntheticChildAtOffset( uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()) override; - lldb::ValueObjectSP AddressOf(Status &error) override; + lldb::ValueObjectSP AddressOf() override; lldb::addr_t GetAddressOf(bool scalar_is_load_address = true, AddressType *address_type = nullptr) override; diff --git a/lldb/include/lldb/Core/ValueObjectConstResultImpl.h b/lldb/include/lldb/Core/ValueObjectConstResultImpl.h index 5a7a079d3095c9..19a4c206f7a9b7 100644 --- a/lldb/include/lldb/Core/ValueObjectConstResultImpl.h +++ b/lldb/include/lldb/Core/ValueObjectConstResultImpl.h @@ -36,17 +36,17 @@ class ValueObjectConstResultImpl { virtual ~ValueObjectConstResultImpl() = default; - lldb::ValueObjectSP Dereference(Status &error); + lldb::ValueObjectSP Dereference(); ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index); - lldb::ValueObjectSP + std::optional<lldb::ValueObjectSP> GetSyntheticChildAtOffset(uint32_t offset, const CompilerType &type, bool can_create, ConstString name_const_str = ConstString()); - lldb::ValueObjectSP AddressOf(Status &error); + lldb::ValueObjectSP AddressOf(); lldb::addr_t GetLiveAddress() { return m_live_address; } @@ -68,7 +68,7 @@ class ValueObjectConstResultImpl { ValueObject *m_impl_backend; lldb::addr_t m_live_address; AddressType m_live_address_type; - lldb::ValueObjectSP m_address_of_backend; + std::optional<lldb::ValueObjectSP> m_address_of_backend; ValueObjectConstResultImpl(const ValueObjectConstResultImpl &) = delete; const ValueObjectConstResultImpl & diff --git a/lldb/include/lldb/Core/ValueObjectList.h b/lldb/include/lldb/Core/ValueObjectList.h index fcb358e21a26b4..42b7d64d6a36c8 100644 --- a/lldb/include/lldb/Core/ValueObjectList.h +++ b/lldb/include/lldb/Core/ValueObjectList.h @@ -28,31 +28,34 @@ class ValueObjectList { void Append(const ValueObjectList &valobj_list); - lldb::ValueObjectSP FindValueObjectByPointer(ValueObject *valobj); + std::optional<lldb::ValueObjectSP> + FindValueObjectByPointer(ValueObject *valobj); size_t GetSize() const; void Resize(size_t size); - lldb::ValueObjectSP GetValueObjectAtIndex(size_t idx); + std::optional<lldb::ValueObjectSP> GetValueObjectAtIndex(size_t idx); - lldb::ValueObjectSP RemoveValueObjectAtIndex(size_t idx); + std::optional<lldb::ValueObjectSP> RemoveValueObjectAtIndex(size_t idx); void SetValueObjectAtIndex(size_t idx, const lldb::ValueObjectSP &valobj_sp); - lldb::ValueObjectSP FindValueObjectByValueName(const char *name); + std::optional<lldb::ValueObjectSP> + FindValueObjectByValueName(const char *name); - lldb::ValueObjectSP FindValueObjectByUID(lldb::user_id_t uid); + std::optional<lldb::ValueObjectSP> FindValueObjectByUID(lldb::user_id_t uid); void Swap(ValueObjectList &value_object_list); void Clear() { m_value_objects.clear(); } - const std::vector<lldb::ValueObjectSP> &GetObjects() const { + const std::vector<std::optional<lldb::ValueObjectSP>> &GetObjects() const { return m_value_objects; } + protected: - typedef std::vector<lldb::ValueObjectSP> collection; + typedef std::vector<std::optional<lldb::ValueObjectSP>> collection; // Classes that inherit from ValueObjectList can see and modify these collection m_value_objects; }; diff --git a/lldb/include/lldb/Core/ValueObjectRegister.h b/lldb/include/lldb/Core/ValueObjectRegister.h index 2e47eee3d7f793..b4f6cad3b817f6 100644 --- a/lldb/include/lldb/Core/ValueObjectRegister.h +++ b/lldb/include/lldb/Core/ValueObjectRegister.h @@ -52,8 +52,8 @@ class ValueObjectRegisterSet : public ValueObject { ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member, int32_t synthetic_index) override; - lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name, - bool can_create = true) override; + std::optional<lldb::ValueObjectSP> + GetChildMemberWithName(llvm::StringRef name, bool can_create = true) override; size_t GetIndexOfChildWithName(llvm::StringRef name) override; diff --git a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h index 67596232eafd1e..127db2857f684d 100644 --- a/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -51,15 +51,15 @@ class ValueObjectSynthetic : public ValueObject { lldb::ValueType GetValueType() const override; - lldb::ValueObjectSP GetChildAtIndex(size_t idx, - bool can_create = true) override; + std::optional<lldb::ValueObjectSP> + GetChildAtIndex(size_t idx, bool can_create = true) override; - lldb::ValueObjectSP GetChildMemberWithName(llvm::StringRef name, - bool can_create = true) override; + std::optional<lldb::ValueObjectSP> + GetChildMemberWithName(llvm::StringRef name, bool can_create = true) override; size_t GetIndexOfChildWithName(llvm::StringRef name) override; - lldb::ValueObjectSP + std::optional<lldb::ValueObjectSP> GetDynamicValue(lldb::DynamicValueType valueType) override; bool IsInScope() override; diff --git a/lldb/include/lldb/Core/ValueObjectUpdater.h b/lldb/include/lldb/Core/ValueObjectUpdater.h index 54fcb31076adde..52ccf9416cbe85 100644 --- a/lldb/include/lldb/Core/ValueObjectUpdater.h +++ b/lldb/include/lldb/Core/ValueObjectUpdater.h @@ -20,9 +20,9 @@ namespace lldb_private { /// process' stop ID and will update the user type when needed. class ValueObjectUpdater { /// The root value object is the static typed variable object. - lldb::ValueObjectSP m_root_valobj_sp; + std::optional<lldb::ValueObjectSP> m_root_valobj_sp; /// The user value object is the value object the user wants to see. - lldb::ValueObjectSP m_user_valobj_sp; + std::optional<lldb::ValueObjectSP> m_user_valobj_sp; /// The stop ID that m_user_valobj_sp is valid for. uint32_t m_stop_id = UINT32_MAX; @@ -33,7 +33,7 @@ class ValueObjectUpdater { /// stop ID. If dynamic values are enabled, or if synthetic children are /// enabled, the value object that the user wants to see might change while /// debugging. - lldb::ValueObjectSP GetSP(); + std::optional<lldb::ValueObjectSP> GetSP(); lldb::ProcessSP GetProcessSP() const; }; diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h index 41be9b7efda8fd..be88b44aed962a 100644 --- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -45,7 +45,7 @@ class SyntheticChildrenFrontEnd { return count <= max ? count : max; } - virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx) = 0; + virtual std::optional<lldb::ValueObjectSP> GetChildAtIndex(size_t idx) = 0; virtual size_t GetIndexOfChildWithName(ConstString name) = 0; @@ -68,7 +68,7 @@ class SyntheticChildrenFrontEnd { // if this function returns a non-null ValueObject, then the returned // ValueObject will stand for this ValueObject whenever a "value" request is // made to this ValueObject - virtua... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/74912 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits