ValueObjectDynamicValue.h revision 36da2aa6dc5ad9994b638ed09eb81c44cc05540b
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
20namespace lldb_private {
21
22//----------------------------------------------------------------------
23// A ValueObject that represents memory at a given address, viewed as some
24// set lldb type.
25//----------------------------------------------------------------------
26class ValueObjectDynamicValue : public ValueObject
27{
28public:
29    virtual
30    ~ValueObjectDynamicValue();
31
32    virtual size_t
33    GetByteSize();
34
35    virtual ConstString
36    GetTypeName();
37
38    virtual ConstString
39    GetQualifiedTypeName();
40
41    virtual size_t
42    CalculateNumChildren();
43
44    virtual lldb::ValueType
45    GetValueType() const;
46
47    virtual bool
48    IsInScope ();
49
50    virtual bool
51    IsDynamic ()
52    {
53        return true;
54    }
55
56    virtual ValueObject *
57    GetParent()
58    {
59        if (m_parent)
60            return m_parent->GetParent();
61        else
62            return NULL;
63    }
64
65    virtual const ValueObject *
66    GetParent() const
67    {
68        if (m_parent)
69            return m_parent->GetParent();
70        else
71            return NULL;
72    }
73
74    virtual lldb::ValueObjectSP
75    GetStaticValue ()
76    {
77        return m_parent->GetSP();
78    }
79
80    void
81    SetOwningSP (lldb::ValueObjectSP &owning_sp)
82    {
83        if (m_owning_valobj_sp == owning_sp)
84            return;
85
86        assert (m_owning_valobj_sp.get() == NULL);
87        m_owning_valobj_sp = owning_sp;
88    }
89
90    virtual bool
91    SetValueFromCString (const char *value_str, Error& error);
92
93protected:
94    virtual bool
95    UpdateValue ();
96
97    virtual clang::ASTContext *
98    GetClangASTImpl ();
99
100    virtual lldb::clang_type_t
101    GetClangTypeImpl ();
102
103    Address  m_address;  ///< The variable that this value object is based upon
104    TypeAndOrName m_dynamic_type_info; // We can have a type_sp or just a name
105    lldb::ValueObjectSP m_owning_valobj_sp;
106    lldb::DynamicValueType m_use_dynamic;
107
108private:
109    friend class ValueObject;
110    friend class ValueObjectConstResult;
111    ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic);
112
113    //------------------------------------------------------------------
114    // For ValueObject only
115    //------------------------------------------------------------------
116    DISALLOW_COPY_AND_ASSIGN (ValueObjectDynamicValue);
117};
118
119} // namespace lldb_private
120
121#endif  // liblldb_ValueObjectDynamicValue_h_
122