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);
144 GetIsConstant () const
150 SetValueFromCString (const char *value_str, Error& error);
153 SetFormat (lldb::Format format);
160 CanUpdateWithInvalidExecutionContext ()
169 CreateSynthFilter ();
171 // we need to hold on to the SyntheticChildren because someone might delete the type binding while we are alive
172 lldb::SyntheticChildrenSP m_synth_sp;
173 std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap;
175 typedef ThreadSafeSTLMap<uint32_t, ValueObject*> ByIndexMap;
176 typedef ThreadSafeSTLMap<const char*, uint32_t> NameToIndexMap;
178 typedef ByIndexMap::iterator ByIndexIterator;
179 typedef NameToIndexMap::iterator NameToIndexIterator;
181 ByIndexMap m_children_byindex;
182 NameToIndexMap m_name_toindex;
183 uint32_t m_synthetic_children_count; // FIXME use the ValueObject's ChildrenManager instead of a special purpose solution
185 ConstString m_parent_type_name;
187 LazyBool m_might_have_children;
189 LazyBool m_provides_value;
192 friend class ValueObject;
193 ValueObjectSynthetic (ValueObject &parent, lldb::SyntheticChildrenSP filter);
196 CopyValueData (ValueObject *source);
198 //------------------------------------------------------------------
199 // For ValueObject only
200 //------------------------------------------------------------------
201 DISALLOW_COPY_AND_ASSIGN (ValueObjectSynthetic);
204 } // namespace lldb_private
206 #endif // liblldb_ValueObjectSyntheticFilter_h_