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