9#ifndef LLDB_DATAFORMATTERS_TYPESYNTHETIC_H
10#define LLDB_DATAFORMATTERS_TYPESYNTHETIC_H
15#include <initializer_list>
26#include "llvm/Support/ErrorExtras.h"
44 return *count <= max ? *count : max;
56 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
94 llvm::StringRef expression,
123 llvm::Expected<size_t>
125 return llvm::createStringErrorV(
"type has no child named '{0}'", name);
171 return (
m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
176 m_flags |= lldb::eTypeOptionCascade;
183 return (
m_flags & lldb::eTypeOptionSkipPointers) ==
184 lldb::eTypeOptionSkipPointers;
189 m_flags |= lldb::eTypeOptionSkipPointers;
196 return (
m_flags & lldb::eTypeOptionSkipReferences) ==
197 lldb::eTypeOptionSkipReferences;
202 m_flags |= lldb::eTypeOptionSkipReferences;
209 return (
m_flags & lldb::eTypeOptionNonCacheable) ==
210 lldb::eTypeOptionNonCacheable;
215 m_flags |= lldb::eTypeOptionNonCacheable;
222 return (
m_flags & lldb::eTypeOptionFrontEndWantsDereference) ==
223 lldb::eTypeOptionFrontEndWantsDereference;
228 m_flags |= lldb::eTypeOptionFrontEndWantsDereference;
235 return m_flags & lldb::eTypeOptionCustomSubscripting;
240 m_flags |= lldb::eTypeOptionCustomSubscripting;
315 const std::initializer_list<const char *> items)
317 for (
auto path : items)
343 return filter->GetCount();
347 if (idx >=
filter->GetCount())
349 return m_backend.GetSyntheticExpressionPathChild(
350 filter->GetExpressionPathAtIndex(idx),
true);
359 llvm::Expected<size_t>
419 const char *pclass,
const char *pcode =
nullptr)
460 llvm::Expected<size_t>
483 if (synth_ptr && ((
FrontEnd *)synth_ptr.get())->IsValid())
505 std::unique_ptr<llvm::MemoryBuffer>
init;
506 std::unique_ptr<llvm::MemoryBuffer>
update;
520 llvm::Expected<size_t>
FrontEnd(ValueObject &backend, SyntheticBytecodeImplementation &impl)
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
llvm::Expected< uint32_t > CalculateNumChildren() override
const SyntheticBytecodeImplementation & m_impl
FormatterBytecode::DataStack m_init_results
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
FormatterBytecode::DataStack m_self
llvm::Expected< size_t > GetIndexOfChildWithName(llvm::StringRef name) override
Determine the index of a named child.
SyntheticChildrenFrontEnd::UniquePointer GetFrontEnd(ValueObject &backend) override
bool IsScripted() override
std::string GetDescription() override
BytecodeSyntheticChildren(SyntheticBytecodeImplementation &&impl)
SyntheticBytecodeImplementation m_impl
bool IsScripted() override
CXXSyntheticChildren(const CXXSyntheticChildren &)=delete
const CXXSyntheticChildren & operator=(const CXXSyntheticChildren &)=delete
CreateFrontEndCallback m_create_callback
virtual ~CXXSyntheticChildren()
std::string m_description
std::string GetDescription() override
SyntheticChildrenFrontEnd::UniquePointer GetFrontEnd(ValueObject &backend) override
CXXSyntheticChildren(const SyntheticChildren::Flags &flags, const char *description, CreateFrontEndCallback callback)
std::function< SyntheticChildrenFrontEnd *(CXXSyntheticChildren *, lldb::ValueObjectSP)> CreateFrontEndCallback
Generic representation of a type in a programming language.
A uniqued constant string class.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
llvm::Expected< size_t > GetIndexOfChildWithName(llvm::StringRef name) override
Determine the index of a named child.
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
std::string m_python_class
lldb::ScriptedSyntheticChildrenInterfaceSP m_interface_sp
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
std::shared_ptr< SyntheticChildrenFrontEnd > SharedPointer
FrontEnd(std::string pclass, ValueObject &backend)
void * GetImplementation() override
lldb::ValueObjectSP GetSyntheticValue() override
llvm::Expected< uint32_t > CalculateNumChildren() override
ConstString GetSyntheticTypeName() override
FrontEnd(const FrontEnd &)=delete
const FrontEnd & operator=(const FrontEnd &)=delete
bool MightHaveChildren() override
bool IsScripted() override
std::string GetDescription() override
SyntheticChildrenFrontEnd::UniquePointer GetFrontEnd(ValueObject &backend) override
std::string m_python_class
const char * GetPythonClassName()
void SetPythonClassName(const char *fname)
std::string m_python_code
ScriptedSyntheticChildren(const SyntheticChildren::Flags &flags, const char *pclass, const char *pcode=nullptr)
const ScriptedSyntheticChildren & operator=(const ScriptedSyntheticChildren &)=delete
void SetPythonCode(const char *script)
const char * GetPythonCode()
ScriptedSyntheticChildren(const ScriptedSyntheticChildren &)=delete
uint32_t CalculateNumChildrenIgnoringErrors(uint32_t max=UINT32_MAX)
virtual lldb::ValueObjectSP GetChildAtIndex(uint32_t idx)=0
virtual lldb::ChildCacheState Update()=0
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
virtual ~SyntheticChildrenFrontEnd()=default
lldb::ValueObjectSP CreateChildValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type, bool do_deref=true)
std::unique_ptr< SyntheticChildrenFrontEnd > UniquePointer
virtual lldb::ValueObjectSP GetSyntheticValue()
virtual llvm::Expected< uint32_t > CalculateNumChildren(uint32_t max)
virtual llvm::Expected< size_t > GetIndexOfChildWithName(llvm::StringRef name)
Determine the index of a named child.
std::shared_ptr< SyntheticChildrenFrontEnd > SharedPointer
lldb::ValueObjectSP CreateChildValueObjectFromExpression(llvm::StringRef name, llvm::StringRef expression, const ExecutionContext &exe_ctx)
virtual llvm::Expected< uint32_t > CalculateNumChildren()=0
virtual ConstString GetSyntheticTypeName()
virtual bool MightHaveChildren()
SyntheticChildrenFrontEnd(const SyntheticChildrenFrontEnd &)=delete
SyntheticChildrenFrontEnd(ValueObject &backend)
const SyntheticChildrenFrontEnd & operator=(const SyntheticChildrenFrontEnd &)=delete
lldb::ValueObjectSP CreateChildValueObjectFromData(llvm::StringRef name, const DataExtractor &data, const ExecutionContext &exe_ctx, CompilerType type)
virtual void * GetImplementation()
Flags & SetSkipReferences(bool value=true)
Flags & SetFrontEndWantsDereference(bool value=true)
bool GetNonCacheable() const
bool GetSkipReferences() const
void SetValue(uint32_t value)
bool GetFrontEndWantsDereference() const
bool GetCustomSubscripting() const
Flags & operator=(const uint32_t &rhs)
Flags(const Flags &other)
Flags & SetSkipPointers(bool value=true)
Flags & SetCascades(bool value=true)
bool GetSkipPointers() const
Flags & SetCustomSubscripting(bool value=true)
Flags & SetNonCacheable(bool value=true)
Flags & operator=(const Flags &rhs)
void SetSkipsPointers(bool value)
const SyntheticChildren & operator=(const SyntheticChildren &)=delete
virtual std::string GetDescription()=0
virtual SyntheticChildrenFrontEnd::UniquePointer GetFrontEnd(ValueObject &backend)=0
bool SkipsPointers() const
void SetCascades(bool value)
bool NonCacheable() const
void SetSkipsReferences(bool value)
void SetPtrMatchDepth(uint32_t value)
uint32_t m_ptr_match_depth
SyntheticChildren(const Flags &flags)
void SetOptions(uint32_t value)
bool WantsDereference() const
uint32_t GetPtrMatchDepth()
void SetNonCacheable(bool value)
SyntheticChildren(const SyntheticChildren &)=delete
bool CustomSubscripting() const
bool SkipsReferences() const
std::shared_ptr< SyntheticChildren > SharedPointer
virtual ~SyntheticChildren()
virtual bool IsScripted()=0
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
~SyntheticValueProviderFrontEnd() override=default
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
llvm::Expected< size_t > GetIndexOfChildWithName(llvm::StringRef name) override
Determine the index of a named child.
bool MightHaveChildren() override
SyntheticValueProviderFrontEnd(ValueObject &backend)
llvm::Expected< uint32_t > CalculateNumChildren() override
SyntheticValueProviderFrontEnd(const SyntheticValueProviderFrontEnd &)=delete
lldb::ValueObjectSP GetSyntheticValue() override=0
const SyntheticValueProviderFrontEnd & operator=(const SyntheticValueProviderFrontEnd &)=delete
lldb::ChildCacheState Update() override
This function is assumed to always succeed and if it fails, the front-end should know to deal with it...
FrontEnd(const FrontEnd &)=delete
~FrontEnd() override=default
llvm::Expected< uint32_t > CalculateNumChildren() override
llvm::Expected< size_t > GetIndexOfChildWithName(llvm::StringRef name) override
Determine the index of a named child.
FrontEnd(TypeFilterImpl *flt, ValueObject &backend)
const FrontEnd & operator=(const FrontEnd &)=delete
bool MightHaveChildren() override
std::shared_ptr< SyntheticChildrenFrontEnd > SharedPointer
lldb::ValueObjectSP GetChildAtIndex(uint32_t idx) override
std::shared_ptr< TypeFilterImpl > SharedPointer
bool SetExpressionPathAtIndex(size_t i, llvm::StringRef path)
void AddExpressionPath(llvm::StringRef path)
TypeFilterImpl(const SyntheticChildren::Flags &flags, const std::initializer_list< const char * > items)
std::string GetDescription() override
bool IsScripted() override
TypeFilterImpl(const SyntheticChildren::Flags &flags)
SyntheticChildrenFrontEnd::UniquePointer GetFrontEnd(ValueObject &backend) override
std::vector< std::string > m_expression_paths
const TypeFilterImpl & operator=(const TypeFilterImpl &)=delete
llvm::StringRef GetExpressionPathAtIndex(size_t i) const
TypeFilterImpl(const TypeFilterImpl &)=delete
lldb::ValueObjectSP GetSP()
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::ScriptedSyntheticChildrenInterface > ScriptedSyntheticChildrenInterfaceSP
ChildCacheState
Specifies if children need to be re-computed after a call to SyntheticChildrenFrontEnd::Update.
@ eRefetch
Children need to be recomputed dynamically.
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
std::unique_ptr< llvm::MemoryBuffer > update
uint32_t version
The version of this record. Specs are found in formatterbytecode.md.
std::unique_ptr< llvm::MemoryBuffer > get_child_index
std::unique_ptr< llvm::MemoryBuffer > init
std::unique_ptr< llvm::MemoryBuffer > num_children
std::unique_ptr< llvm::MemoryBuffer > get_child_at_index