]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectDynamicValue.h
MFV 354917, 354918, 354919
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Core / ValueObjectDynamicValue.h
1 //===-- ValueObjectDynamicValue.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 liblldb_ValueObjectDynamicValue_h_
10 #define liblldb_ValueObjectDynamicValue_h_
11
12 #include "lldb/Core/Address.h"
13 #include "lldb/Core/ValueObject.h"
14 #include "lldb/Symbol/CompilerType.h"
15 #include "lldb/Symbol/Type.h"
16 #include "lldb/Utility/ConstString.h"
17 #include "lldb/Utility/SharingPtr.h"
18 #include "lldb/lldb-defines.h"
19 #include "lldb/lldb-enumerations.h"
20 #include "lldb/lldb-forward.h"
21 #include "lldb/lldb-private-enumerations.h"
22
23 #include <assert.h>
24 #include <stddef.h>
25 #include <stdint.h>
26
27 namespace lldb_private {
28 class DataExtractor;
29 class Declaration;
30 class Status;
31
32 // A ValueObject that represents memory at a given address, viewed as some
33 // set lldb type.
34 class ValueObjectDynamicValue : public ValueObject {
35 public:
36   ~ValueObjectDynamicValue() override;
37
38   uint64_t GetByteSize() override;
39
40   ConstString GetTypeName() override;
41
42   ConstString GetQualifiedTypeName() override;
43
44   ConstString GetDisplayTypeName() override;
45
46   size_t CalculateNumChildren(uint32_t max) override;
47
48   lldb::ValueType GetValueType() const override;
49
50   bool IsInScope() override;
51
52   bool IsDynamic() override { return true; }
53
54   bool IsBaseClass() override {
55     if (m_parent)
56       return m_parent->IsBaseClass();
57     return false;
58   }
59
60   bool GetIsConstant() const override { return false; }
61
62   ValueObject *GetParent() override {
63     return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
64   }
65
66   const ValueObject *GetParent() const override {
67     return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
68   }
69
70   lldb::ValueObjectSP GetStaticValue() override { return m_parent->GetSP(); }
71
72   void SetOwningSP(lldb::ValueObjectSP &owning_sp) {
73     if (m_owning_valobj_sp == owning_sp)
74       return;
75
76     assert(m_owning_valobj_sp.get() == nullptr);
77     m_owning_valobj_sp = owning_sp;
78   }
79
80   bool SetValueFromCString(const char *value_str, Status &error) override;
81
82   bool SetData(DataExtractor &data, Status &error) override;
83
84   TypeImpl GetTypeImpl() override;
85
86   lldb::VariableSP GetVariable() override {
87     return m_parent ? m_parent->GetVariable() : nullptr;
88   }
89
90   lldb::LanguageType GetPreferredDisplayLanguage() override;
91
92   void SetPreferredDisplayLanguage(lldb::LanguageType);
93
94   bool IsSyntheticChildrenGenerated() override;
95
96   void SetSyntheticChildrenGenerated(bool b) override;
97
98   bool GetDeclaration(Declaration &decl) override;
99
100   uint64_t GetLanguageFlags() override;
101
102   void SetLanguageFlags(uint64_t flags) override;
103
104 protected:
105   bool UpdateValue() override;
106
107   LazyBool CanUpdateWithInvalidExecutionContext() override {
108     return eLazyBoolYes;
109   }
110
111   lldb::DynamicValueType GetDynamicValueTypeImpl() override {
112     return m_use_dynamic;
113   }
114
115   bool HasDynamicValueTypeInfo() override { return true; }
116
117   CompilerType GetCompilerTypeImpl() override;
118
119   Address m_address; ///< The variable that this value object is based upon
120   TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
121   lldb::ValueObjectSP m_owning_valobj_sp;
122   lldb::DynamicValueType m_use_dynamic;
123   TypeImpl m_type_impl;
124
125 private:
126   friend class ValueObject;
127   friend class ValueObjectConstResult;
128   ValueObjectDynamicValue(ValueObject &parent,
129                           lldb::DynamicValueType use_dynamic);
130
131   DISALLOW_COPY_AND_ASSIGN(ValueObjectDynamicValue);
132 };
133
134 } // namespace lldb_private
135
136 #endif // liblldb_ValueObjectDynamicValue_h_