LLDB mainline
LibCxxRangesRefView.cpp
Go to the documentation of this file.
1//===-- LibCxxRangesRefView.cpp -------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#include "LibCxx.h"
10
14#include "llvm/ADT/APSInt.h"
15
16using namespace lldb;
17using namespace lldb_private;
18using namespace lldb_private::formatters;
19
20namespace lldb_private {
21namespace formatters {
22
25public:
27
29
30 llvm::Expected<uint32_t> CalculateNumChildren() override {
31 // __range_ will be the sole child of this type
32 return 1;
33 }
34
35 lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override {
36 // Since we only have a single child, return it
37 assert(idx == 0);
38 return m_range_sp;
39 }
40
42
43 llvm::Expected<size_t> GetIndexOfChildWithName(ConstString name) override {
44 // We only have a single child
45 return 0;
46 }
47
48private:
49 /// Pointer to the dereferenced __range_ member
51};
52
59
73
76 lldb::ValueObjectSP valobj_sp) {
77 if (!valobj_sp)
78 return nullptr;
79 CompilerType type = valobj_sp->GetCompilerType();
80 if (!type.IsValid())
81 return nullptr;
82 return new LibcxxStdRangesRefViewSyntheticFrontEnd(valobj_sp);
83}
84
85} // namespace formatters
86} // namespace lldb_private
static llvm::raw_ostream & error(Stream &strm)
Generic representation of a type in a programming language.
A uniqued constant string class.
Definition ConstString.h:40
An error handling class.
Definition Status.h:118
SyntheticChildrenFrontEnd(ValueObject &backend)
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
llvm::Expected< size_t > GetIndexOfChildWithName(ConstString name) override
lldb::ValueObjectSP m_range_sp
Pointer to the dereferenced __range_ member.
lldb::ValueObjectSP GetChildMemberWithName(ValueObject &obj, llvm::ArrayRef< ConstString > alternative_names)
Find a child member of obj_sp, trying all alternative names in order.
Definition LibCxx.cpp:63
SyntheticChildrenFrontEnd * LibcxxStdRangesRefViewSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP)
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.
@ eReuse
Children did not change and don't need to be recomputed; re-use what we computed the last time we cal...
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP