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 public:
27   ~ValueObjectVariable() override;
28 
29   static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
30                                     const lldb::VariableSP &var_sp);
31 
32   uint64_t GetByteSize() override;
33 
34   ConstString GetTypeName() override;
35 
36   ConstString GetQualifiedTypeName() override;
37 
38   ConstString GetDisplayTypeName() override;
39 
40   size_t CalculateNumChildren(uint32_t max) override;
41 
42   lldb::ValueType GetValueType() const override;
43 
44   bool IsInScope() override;
45 
46   lldb::ModuleSP GetModule() override;
47 
48   SymbolContextScope *GetSymbolContextScope() override;
49 
50   bool GetDeclaration(Declaration &decl) override;
51 
52   const char *GetLocationAsCString() override;
53 
54   bool SetValueFromCString(const char *value_str, Error &error) override;
55 
56   bool SetData(DataExtractor &data, Error &error) override;
57 
58   virtual lldb::VariableSP GetVariable() override { return m_variable_sp; }
59 
60 protected:
61   bool UpdateValue() override;
62 
63   CompilerType GetCompilerTypeImpl() override;
64 
65   lldb::VariableSP
66       m_variable_sp;      ///< The variable that this value object is based upon
67   Value m_resolved_value; ///< The value that DWARFExpression resolves this
68                           ///variable to before we patch it up
69 
70 private:
71   ValueObjectVariable(ExecutionContextScope *exe_scope,
72                       const lldb::VariableSP &var_sp);
73   //------------------------------------------------------------------
74   // For ValueObject only
75   //------------------------------------------------------------------
76   DISALLOW_COPY_AND_ASSIGN(ValueObjectVariable);
77 };
78 
79 } // namespace lldb_private
80 
81 #endif // liblldb_ValueObjectVariable_h_
82