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_
16 // Other libraries and framework includes
18 #include "lldb/Core/ThreadSafeSTLMap.h"
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 ();
138 DoesProvideSyntheticValue ()
140 return (UpdateValueIfNeeded(), m_provides_value == eLazyBoolYes);
151 CreateSynthFilter ();
153 // we need to hold on to the SyntheticChildren because someone might delete the type binding while we are alive
154 lldb::SyntheticChildrenSP m_synth_sp;
155 std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap;
157 typedef ThreadSafeSTLMap<uint32_t, ValueObject*> ByIndexMap;
158 typedef ThreadSafeSTLMap<const char*, uint32_t> NameToIndexMap;
160 typedef ByIndexMap::iterator ByIndexIterator;
161 typedef NameToIndexMap::iterator NameToIndexIterator;
163 ByIndexMap m_children_byindex;
164 NameToIndexMap m_name_toindex;
165 uint32_t m_synthetic_children_count; // FIXME use the ValueObject's ChildrenManager instead of a special purpose solution
167 ConstString m_parent_type_name;
169 LazyBool m_might_have_children;
171 LazyBool m_provides_value;
174 friend class ValueObject;
175 ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter);
178 CopyValueData (ValueObject *source);
180 //------------------------------------------------------------------
181 // For ValueObject only
182 //------------------------------------------------------------------
183 DISALLOW_COPY_AND_ASSIGN (ValueObjectSynthetic);
186 } // namespace lldb_private
188 #endif // liblldb_ValueObjectSyntheticFilter_h_