]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Core/ValueObjectDynamicValue.h
MFV r308989: 6428 set canmount=off on unmounted filesystem tries to
[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 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Core/ValueObject.h"
18 #include "lldb/Symbol/Type.h"
19
20 namespace lldb_private {
21
22 //----------------------------------------------------------------------
23 // A ValueObject that represents memory at a given address, viewed as some 
24 // set lldb type.
25 //----------------------------------------------------------------------
26 class ValueObjectDynamicValue : public ValueObject
27 {
28 public:
29     ~ValueObjectDynamicValue() override;
30
31     uint64_t
32     GetByteSize() override;
33
34     ConstString
35     GetTypeName() override;
36
37     ConstString
38     GetQualifiedTypeName() override;
39
40     ConstString
41     GetDisplayTypeName() override;
42     
43     size_t
44     CalculateNumChildren(uint32_t max) override;
45
46     lldb::ValueType
47     GetValueType() const override;
48
49     bool
50     IsInScope() override;
51     
52     bool
53     IsDynamic() override
54     {
55         return true;
56     }
57     
58     bool
59     IsBaseClass () override
60     {
61         if (m_parent)
62             return m_parent->IsBaseClass();
63         return false;
64     }
65     
66     bool
67     GetIsConstant() const override
68     {
69         return false;
70     }
71     
72     ValueObject *
73     GetParent() override
74     {
75         return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
76     }
77
78     const ValueObject *
79     GetParent() const override
80     {
81         return ((m_parent != nullptr) ? m_parent->GetParent() : nullptr);
82     }
83
84     lldb::ValueObjectSP
85     GetStaticValue() override
86     {
87         return m_parent->GetSP();
88     }
89
90     void
91     SetOwningSP (lldb::ValueObjectSP &owning_sp)
92     {
93         if (m_owning_valobj_sp == owning_sp)
94             return;
95             
96         assert (m_owning_valobj_sp.get() == nullptr);
97         m_owning_valobj_sp = owning_sp;
98     }
99     
100     bool
101     SetValueFromCString(const char *value_str, Error& error) override;
102     
103     bool
104     SetData(DataExtractor &data, Error &error) override;
105     
106     TypeImpl
107     GetTypeImpl() override;
108     
109     lldb::VariableSP
110     GetVariable () override
111     {
112         return m_parent ? m_parent->GetVariable() : nullptr;
113     }
114     
115     lldb::LanguageType
116     GetPreferredDisplayLanguage() override;
117     
118     void
119     SetPreferredDisplayLanguage (lldb::LanguageType);
120     
121     bool
122     GetDeclaration(Declaration &decl) override;
123     
124     uint64_t
125     GetLanguageFlags () override;
126     
127     void
128     SetLanguageFlags (uint64_t flags) override;
129
130 protected:
131     bool
132     UpdateValue() override;
133     
134     LazyBool
135     CanUpdateWithInvalidExecutionContext() override
136     {
137         return eLazyBoolYes;
138     }
139     
140     lldb::DynamicValueType
141     GetDynamicValueTypeImpl() override
142     {
143         return m_use_dynamic;
144     }
145     
146     bool
147     HasDynamicValueTypeInfo() override
148     {
149         return true;
150     }
151     
152     CompilerType
153     GetCompilerTypeImpl() override;
154
155     Address  m_address;  ///< The variable that this value object is based upon
156     TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
157     lldb::ValueObjectSP m_owning_valobj_sp;
158     lldb::DynamicValueType m_use_dynamic;
159     TypeImpl m_type_impl;
160
161 private:
162     friend class ValueObject;
163     friend class ValueObjectConstResult;
164     ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic);
165
166     DISALLOW_COPY_AND_ASSIGN (ValueObjectDynamicValue);
167 };
168
169 } // namespace lldb_private
170
171 #endif // liblldb_ValueObjectDynamicValue_h_