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();
49 CalculateNumChildren();
51 virtual lldb::ValueType
54 virtual lldb::ValueObjectSP
55 GetChildAtIndex (size_t idx, bool can_create);
57 virtual lldb::ValueObjectSP
58 GetChildMemberWithName (const ConstString &name, bool can_create);
61 GetIndexOfChildWithName (const ConstString &name);
63 virtual lldb::ValueObjectSP
64 GetDynamicValue (lldb::DynamicValueType valueType);
76 IsSynthetic() { return true; }
79 CalculateSyntheticValue (bool use_synthetic)
87 return m_parent->IsDynamic();
92 virtual lldb::ValueObjectSP
96 return m_parent->GetStaticValue();
101 virtual lldb::DynamicValueType
102 GetDynamicValueType ()
105 return m_parent->GetDynamicValueType();
107 return lldb::eNoDynamicValues;
110 virtual ValueObject *
114 return m_parent->GetParent();
119 virtual const ValueObject *
123 return m_parent->GetParent();
128 virtual lldb::ValueObjectSP
129 GetNonSyntheticValue ();
132 ResolveValue (Scalar &scalar)
135 return m_parent->ResolveValue(scalar);
147 CreateSynthFilter ();
149 // we need to hold on to the SyntheticChildren because someone might delete the type binding while we are alive
150 lldb::SyntheticChildrenSP m_synth_sp;
151 std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap;
153 typedef std::map<uint32_t, ValueObject*> ByIndexMap;
154 typedef std::map<const char*, uint32_t> NameToIndexMap;
156 typedef ByIndexMap::iterator ByIndexIterator;
157 typedef NameToIndexMap::iterator NameToIndexIterator;
159 ByIndexMap m_children_byindex;
160 NameToIndexMap m_name_toindex;
161 uint32_t m_synthetic_children_count; // FIXME use the ValueObject's ChildrenManager instead of a special purpose solution
163 ConstString m_parent_type_name;
165 LazyBool m_might_have_children;
168 friend class ValueObject;
169 ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter);
174 //------------------------------------------------------------------
175 // For ValueObject only
176 //------------------------------------------------------------------
177 DISALLOW_COPY_AND_ASSIGN (ValueObjectSynthetic);
180 } // namespace lldb_private
182 #endif // liblldb_ValueObjectSyntheticFilter_h_