ValueObjectDynamicValue.h revision 4e6640ee7975a9b9b0854aaa1f4d2d0f08702110
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/ClangASTType.h" 19 20namespace lldb_private { 21 22 class ValueObjectCast : public ValueObject 23 { 24 public: 25 virtual 26 ~ValueObjectCast(); 27 28 virtual size_t 29 GetByteSize(); 30 31 virtual clang::ASTContext * 32 GetClangAST (); 33 34 virtual lldb::clang_type_t 35 GetClangType (); 36 37 virtual ConstString 38 GetTypeName(); 39 40 virtual uint32_t 41 CalculateNumChildren(); 42 43 virtual lldb::ValueType 44 GetValueType() const; 45 46 virtual bool 47 IsInScope (); 48 49 virtual bool 50 IsDynamic () 51 { 52 return true; 53 } 54 55 virtual ValueObject * 56 GetParent() 57 { 58 if (m_parent) 59 return m_parent->GetParent(); 60 else 61 return NULL; 62 } 63 64 virtual const ValueObject * 65 GetParent() const 66 { 67 if (m_parent) 68 return m_parent->GetParent(); 69 else 70 return NULL; 71 } 72 73 virtual lldb::ValueObjectSP 74 GetStaticValue () 75 { 76 return m_parent->GetSP(); 77 } 78 79 protected: 80 virtual bool 81 UpdateValue (); 82 83 ClangASTType m_cast_type; 84 85 private: 86 friend class ValueObject; 87 ValueObjectCast (ValueObject &parent, 88 const ConstString &name, 89 const ClangASTType &cast_type); 90 91 //------------------------------------------------------------------ 92 // For ValueObject only 93 //------------------------------------------------------------------ 94 DISALLOW_COPY_AND_ASSIGN (ValueObjectCast); 95 }; 96 97//---------------------------------------------------------------------- 98// A ValueObject that represents memory at a given address, viewed as some 99// set lldb type. 100//---------------------------------------------------------------------- 101class ValueObjectDynamicValue : public ValueObject 102{ 103public: 104 virtual 105 ~ValueObjectDynamicValue(); 106 107 virtual size_t 108 GetByteSize(); 109 110 virtual clang::ASTContext * 111 GetClangAST (); 112 113 virtual lldb::clang_type_t 114 GetClangType (); 115 116 virtual ConstString 117 GetTypeName(); 118 119 virtual uint32_t 120 CalculateNumChildren(); 121 122 virtual lldb::ValueType 123 GetValueType() const; 124 125 virtual bool 126 IsInScope (); 127 128 virtual bool 129 IsDynamic () 130 { 131 return true; 132 } 133 134 virtual ValueObject * 135 GetParent() 136 { 137 if (m_parent) 138 return m_parent->GetParent(); 139 else 140 return NULL; 141 } 142 143 virtual const ValueObject * 144 GetParent() const 145 { 146 if (m_parent) 147 return m_parent->GetParent(); 148 else 149 return NULL; 150 } 151 152 virtual lldb::ValueObjectSP 153 GetStaticValue () 154 { 155 return m_parent->GetSP(); 156 } 157 158 void 159 SetOwningSP (lldb::ValueObjectSP &owning_sp) 160 { 161 if (m_owning_valobj_sp == owning_sp) 162 return; 163 164 assert (m_owning_valobj_sp.get() == NULL); 165 m_owning_valobj_sp = owning_sp; 166 } 167 168protected: 169 virtual bool 170 UpdateValue (); 171 172 Address m_address; ///< The variable that this value object is based upon 173 lldb::TypeSP m_type_sp; 174 lldb::ValueObjectSP m_owning_valobj_sp; 175 lldb::DynamicValueType m_use_dynamic; 176 177private: 178 friend class ValueObject; 179 ValueObjectDynamicValue (ValueObject &parent, lldb::DynamicValueType use_dynamic); 180 181 //------------------------------------------------------------------ 182 // For ValueObject only 183 //------------------------------------------------------------------ 184 DISALLOW_COPY_AND_ASSIGN (ValueObjectDynamicValue); 185}; 186 187} // namespace lldb_private 188 189#endif // liblldb_ValueObjectDynamicValue_h_ 190