1 //===-- LibCxxQueue.cpp -----------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 #include "lldb/DataFormatters/FormattersHelpers.h"
13 using namespace lldb_private;
17 class QueueFrontEnd : public SyntheticChildrenFrontEnd {
19 QueueFrontEnd(ValueObject &valobj) : SyntheticChildrenFrontEnd(valobj) {
23 size_t GetIndexOfChildWithName(ConstString name) override {
24 return m_container_sp ? m_container_sp->GetIndexOfChildWithName(name)
28 bool MightHaveChildren() override { return true; }
29 bool Update() override;
31 size_t CalculateNumChildren() override {
32 return m_container_sp ? m_container_sp->GetNumChildren() : 0;
35 ValueObjectSP GetChildAtIndex(size_t idx) override {
36 return m_container_sp ? m_container_sp->GetChildAtIndex(idx, true)
41 ValueObjectSP m_container_sp;
45 bool QueueFrontEnd::Update() {
46 m_container_sp.reset();
47 ValueObjectSP c_sp = m_backend.GetChildMemberWithName(ConstString("c"), true);
50 m_container_sp = c_sp->GetSyntheticValue();
54 SyntheticChildrenFrontEnd *
55 formatters::LibcxxQueueFrontEndCreator(CXXSyntheticChildren *,
56 lldb::ValueObjectSP valobj_sp) {
58 return new QueueFrontEnd(*valobj_sp);