15#include "llvm/Support/ErrorExtras.h"
36 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name)
override;
38 bool GetSummary(Stream &stream,
const TypeSummaryOptions &options);
46 ValueObject *m_ptr_obj =
nullptr;
47 ValueObject* m_del_obj =
nullptr;
54LibStdcppUniquePtrSyntheticFrontEnd::LibStdcppUniquePtrSyntheticFrontEnd(
60ValueObjectSP LibStdcppUniquePtrSyntheticFrontEnd::GetTuple() {
63 if (!valobj_backend_sp)
66 ValueObjectSP valobj_sp = valobj_backend_sp->GetNonSyntheticValue();
70 ValueObjectSP obj_child_sp = valobj_sp->GetChildMemberWithName(
"_M_t");
74 ValueObjectSP obj_subchild_sp = obj_child_sp->GetChildMemberWithName(
"_M_t");
78 if (obj_subchild_sp) {
79 return obj_subchild_sp;
91 std::unique_ptr<SyntheticChildrenFrontEnd> tuple_frontend(
98 m_ptr_obj = ptr_obj->Clone(ConstString(
"pointer")).get();
106 if (llvm::expectedToOptional(tuple_sp->GetByteSize()).value_or(0) >
107 llvm::expectedToOptional(ptr_obj->GetByteSize()).value_or(0)) {
110 m_del_obj = del_obj->Clone(ConstString(
"deleter")).get();
117LibStdcppUniquePtrSyntheticFrontEnd::GetChildAtIndex(uint32_t idx) {
118 if (idx == 0 && m_ptr_obj)
119 return m_ptr_obj->
GetSP();
120 if (idx == 1 && m_del_obj)
121 return m_del_obj->
GetSP();
134llvm::Expected<uint32_t>
135LibStdcppUniquePtrSyntheticFrontEnd::CalculateNumChildren() {
141llvm::Expected<size_t>
142LibStdcppUniquePtrSyntheticFrontEnd::GetIndexOfChildWithName(ConstString name) {
143 if (name ==
"ptr" || name ==
"pointer")
145 if (name ==
"del" || name ==
"deleter")
147 if (name ==
"obj" || name ==
"object" || name ==
"$$dereference$$")
149 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
152bool LibStdcppUniquePtrSyntheticFrontEnd::GetSummary(
153 Stream &stream,
const TypeSummaryOptions &options) {
162SyntheticChildrenFrontEnd *
165 return (valobj_sp ?
new LibStdcppUniquePtrSyntheticFrontEnd(valobj_sp)
171 LibStdcppUniquePtrSyntheticFrontEnd formatter(valobj.
GetSP());
172 return formatter.GetSummary(stream, options);
static std::optional< size_t > CalculateNumChildren(CompilerType container_elem_type, uint64_t num_elements, CompilerType element_type)
Calculates the number of elements stored in a container (with element type 'container_elem_type') as ...
bool Success() const
Test for success condition.
A stream class that can stream formatted output to a file.
lldb::ValueObjectSP GetSP()
virtual lldb::ValueObjectSP Dereference(Status &error)
A class that represents a running process on the host machine.
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
@ eRefetch
Children need to be recomputed dynamically.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP