xref: /freebsd/contrib/llvm-project/lldb/include/lldb/Core/ValueObjectConstResultCast.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===-- ValueObjectConstResultCast.h ----------------------------*- C++ -*-===//
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 #ifndef LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
10 #define LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
11 
12 #include "lldb/Core/ValueObjectCast.h"
13 #include "lldb/Core/ValueObjectConstResultImpl.h"
14 #include "lldb/Symbol/CompilerType.h"
15 #include "lldb/Utility/ConstString.h"
16 #include "lldb/lldb-defines.h"
17 #include "lldb/lldb-forward.h"
18 #include "lldb/lldb-types.h"
19 
20 #include <cstddef>
21 #include <cstdint>
22 
23 namespace lldb_private {
24 class DataExtractor;
25 class Status;
26 class ValueObject;
27 
28 class ValueObjectConstResultCast : public ValueObjectCast {
29 public:
30   ValueObjectConstResultCast(ValueObject &parent, ConstString name,
31                              const CompilerType &cast_type,
32                              lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
33 
34   ~ValueObjectConstResultCast() override;
35 
36   lldb::ValueObjectSP Dereference(Status &error) override;
37 
GetCompilerType()38   virtual CompilerType GetCompilerType() {
39     return ValueObjectCast::GetCompilerType();
40   }
41 
42   lldb::ValueObjectSP GetSyntheticChildAtOffset(
43       uint32_t offset, const CompilerType &type, bool can_create,
44       ConstString name_const_str = ConstString()) override;
45 
46   lldb::ValueObjectSP AddressOf(Status &error) override;
47 
48   size_t GetPointeeData(DataExtractor &data, uint32_t item_idx = 0,
49                         uint32_t item_count = 1) override;
50 
51   lldb::ValueObjectSP DoCast(const CompilerType &compiler_type) override;
52 
53 protected:
54   ValueObjectConstResultImpl m_impl;
55 
56 private:
57   friend class ValueObject;
58   friend class ValueObjectConstResult;
59   friend class ValueObjectConstResultImpl;
60 
CreateChildAtIndex(size_t idx)61   ValueObject *CreateChildAtIndex(size_t idx) override {
62     return m_impl.CreateChildAtIndex(idx);
63   }
CreateSyntheticArrayMember(size_t idx)64   ValueObject *CreateSyntheticArrayMember(size_t idx) override {
65     return m_impl.CreateSyntheticArrayMember(idx);
66   }
67 
68   ValueObjectConstResultCast(const ValueObjectConstResultCast &) = delete;
69   const ValueObjectConstResultCast &
70   operator=(const ValueObjectConstResultCast &) = delete;
71 };
72 
73 } // namespace lldb_private
74 
75 #endif // LLDB_CORE_VALUEOBJECTCONSTRESULTCAST_H
76