1 //===-- ValueObjectVariable.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_ValueObjectVariable_h_
11 #define liblldb_ValueObjectVariable_h_
12 
13 // C Includes
14 // C++ Includes
15 // Other libraries and framework includes
16 // Project includes
17 #include "lldb/Core/ValueObject.h"
18 
19 namespace lldb_private {
20 
21 //----------------------------------------------------------------------
22 // A ValueObject that contains a root variable that may or may not
23 // have children.
24 //----------------------------------------------------------------------
25 class ValueObjectVariable : public ValueObject
26 {
27 public:
28     ~ValueObjectVariable() override;
29 
30     static lldb::ValueObjectSP
31     Create (ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp);
32 
33     uint64_t
34     GetByteSize() override;
35 
36     ConstString
37     GetTypeName() override;
38 
39     ConstString
40     GetQualifiedTypeName() override;
41 
42     ConstString
43     GetDisplayTypeName() override;
44 
45     size_t
46     CalculateNumChildren(uint32_t max) override;
47 
48     lldb::ValueType
49     GetValueType() const override;
50 
51     bool
52     IsInScope() override;
53 
54     lldb::ModuleSP
55     GetModule() override;
56 
57     SymbolContextScope *
58     GetSymbolContextScope() override;
59 
60     bool
61     GetDeclaration(Declaration &decl) override;
62 
63     const char *
64     GetLocationAsCString() override;
65 
66     bool
67     SetValueFromCString(const char *value_str, Error& error) override;
68 
69     bool
70     SetData(DataExtractor &data, Error &error) override;
71 
72     virtual lldb::VariableSP
73     GetVariable () override
74     {
75         return m_variable_sp;
76     }
77 
78 protected:
79     bool
80     UpdateValue() override;
81 
82     CompilerType
83     GetCompilerTypeImpl() override;
84 
85     lldb::VariableSP  m_variable_sp;  ///< The variable that this value object is based upon
86     Value m_resolved_value;           ///< The value that DWARFExpression resolves this variable to before we patch it up
87 
88 private:
89     ValueObjectVariable (ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp);
90     //------------------------------------------------------------------
91     // For ValueObject only
92     //------------------------------------------------------------------
93     DISALLOW_COPY_AND_ASSIGN (ValueObjectVariable);
94 };
95 
96 } // namespace lldb_private
97 
98 #endif // liblldb_ValueObjectVariable_h_
99