1 //===-- ValueObjectSyntheticFilter.h -------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ValueObjectSyntheticFilter_h_
11 #define liblldb_ValueObjectSyntheticFilter_h_
17 // Other libraries and framework includes
19 #include "lldb/Core/ValueObject.h"
21 namespace lldb_private {
23 //----------------------------------------------------------------------
24 // A ValueObject that obtains its children from some source other than
26 // This is currently used to implement Python-based children and filters
27 // but you can bind it to any source of synthetic information and have
28 // it behave accordingly
29 //----------------------------------------------------------------------
30 class ValueObjectSynthetic : public ValueObject
34 ~ValueObjectSynthetic();
43 GetQualifiedTypeName();
52 CalculateNumChildren();
54 virtual lldb::ValueType
57 virtual lldb::ValueObjectSP
58 GetChildAtIndex (size_t idx, bool can_create);
60 virtual lldb::ValueObjectSP
61 GetChildMemberWithName (const ConstString &name, bool can_create);
64 GetIndexOfChildWithName (const ConstString &name);
66 virtual lldb::ValueObjectSP
67 GetDynamicValue (lldb::DynamicValueType valueType);
79 IsSynthetic() { return true; }
82 CalculateSyntheticValue (bool use_synthetic)
90 return m_parent->IsDynamic();
95 virtual lldb::ValueObjectSP
99 return m_parent->GetStaticValue();
104 virtual lldb::DynamicValueType
105 GetDynamicValueType ()
108 return m_parent->GetDynamicValueType();
110 return lldb::eNoDynamicValues;
113 virtual ValueObject *
117 return m_parent->GetParent();
122 virtual const ValueObject *
126 return m_parent->GetParent();
131 virtual lldb::ValueObjectSP
132 GetNonSyntheticValue ();
135 ResolveValue (Scalar &scalar)
138 return m_parent->ResolveValue(scalar);
150 CreateSynthFilter ();
152 // we need to hold on to the SyntheticChildren because someone might delete the type binding while we are alive
153 lldb::SyntheticChildrenSP m_synth_sp;
154 std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap;
156 typedef std::map<uint32_t, ValueObject*> ByIndexMap;
157 typedef std::map<const char*, uint32_t> NameToIndexMap;
159 typedef ByIndexMap::iterator ByIndexIterator;
160 typedef NameToIndexMap::iterator NameToIndexIterator;
162 ByIndexMap m_children_byindex;
163 NameToIndexMap m_name_toindex;
164 uint32_t m_synthetic_children_count; // FIXME use the ValueObject's ChildrenManager instead of a special purpose solution
166 ConstString m_parent_type_name;
168 LazyBool m_might_have_children;
171 friend class ValueObject;
172 ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter);
177 //------------------------------------------------------------------
178 // For ValueObject only
179 //------------------------------------------------------------------
180 DISALLOW_COPY_AND_ASSIGN (ValueObjectSynthetic);
183 } // namespace lldb_private
185 #endif // liblldb_ValueObjectSyntheticFilter_h_