diff options
author | Enrico Granata <egranata@apple.com> | 2015-10-19 22:04:25 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-10-19 22:04:25 +0000 |
commit | 0e162ab20043376d32a032c7540258ed14a28551 (patch) | |
tree | ae20ccc9e0df08fdc7db1ed3604ee459e183e0e5 /include/lldb/DataFormatters/ValueObjectPrinter.h | |
parent | 1eb35ee588bb0eea9edd8549604fe7d2899903d5 (diff) |
Let Language plugins vend a default DeclPrintingHelper in case a custom one is not specified for the specific invocation
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@250744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/lldb/DataFormatters/ValueObjectPrinter.h')
-rw-r--r-- | include/lldb/DataFormatters/ValueObjectPrinter.h | 290 |
1 files changed, 3 insertions, 287 deletions
diff --git a/include/lldb/DataFormatters/ValueObjectPrinter.h b/include/lldb/DataFormatters/ValueObjectPrinter.h index 612556368..a1834459c 100644 --- a/include/lldb/DataFormatters/ValueObjectPrinter.h +++ b/include/lldb/DataFormatters/ValueObjectPrinter.h @@ -18,296 +18,12 @@ #include "lldb/lldb-private.h" #include "lldb/lldb-public.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/ValueObject.h" -#include "lldb/DataFormatters/TypeSummary.h" - -#include <functional> +#include "lldb/Core/Flags.h" +#include "lldb/DataFormatters/DumpValueObjectOptions.h" +#include "lldb/Symbol/CompilerType.h" namespace lldb_private { -struct DumpValueObjectOptions -{ - struct PointerDepth - { - enum class Mode - { - Always, - Formatters, - Default, - Never - } m_mode; - uint32_t m_count; - - PointerDepth - operator --() const - { - if (m_count > 0) - return PointerDepth {m_mode,m_count-1}; - return PointerDepth {m_mode,m_count}; - } - - bool - CanAllowExpansion () const; - - bool - CanAllowExpansion (bool is_root, - TypeSummaryImpl* entry, - ValueObject *valobj, - const std::string& summary); - }; - - typedef std::function<bool(ConstString, - ConstString, - const DumpValueObjectOptions &, - Stream&)> DeclPrintingHelper; - - uint32_t m_max_depth = UINT32_MAX; - lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues; - uint32_t m_omit_summary_depth = 0; - lldb::Format m_format = lldb::eFormatDefault; - lldb::TypeSummaryImplSP m_summary_sp; - std::string m_root_valobj_name; - lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown; - PointerDepth m_max_ptr_depth; - DeclPrintingHelper m_decl_printing_helper; - bool m_use_synthetic : 1; - bool m_scope_already_checked : 1; - bool m_flat_output : 1; - bool m_ignore_cap : 1; - bool m_show_types : 1; - bool m_show_location : 1; - bool m_use_objc : 1; - bool m_hide_root_type : 1; - bool m_hide_name : 1; - bool m_hide_value : 1; - bool m_run_validator : 1; - bool m_use_type_display_name : 1; - bool m_allow_oneliner_mode : 1; - bool m_hide_pointer_value : 1; - - DumpValueObjectOptions() : - m_summary_sp(), - m_root_valobj_name(), - m_max_ptr_depth(PointerDepth{PointerDepth::Mode::Default,0}), - m_decl_printing_helper(), - m_use_synthetic(true), - m_scope_already_checked(false), - m_flat_output(false), - m_ignore_cap(false), - m_show_types(false), - m_show_location(false), - m_use_objc(false), - m_hide_root_type(false), - m_hide_name(false), - m_hide_value(false), - m_run_validator(false), - m_use_type_display_name(true), - m_allow_oneliner_mode(true), - m_hide_pointer_value(false) - {} - - static const DumpValueObjectOptions - DefaultOptions() - { - static DumpValueObjectOptions g_default_options; - - return g_default_options; - } - - DumpValueObjectOptions (const DumpValueObjectOptions& rhs) = default; - - DumpValueObjectOptions (ValueObject& valobj); - - DumpValueObjectOptions& - SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never,0}) - { - m_max_ptr_depth = depth; - return *this; - } - - DumpValueObjectOptions& - SetMaximumDepth(uint32_t depth = 0) - { - m_max_depth = depth; - return *this; - } - - DumpValueObjectOptions& - SetDeclPrintingHelper(DeclPrintingHelper helper) - { - m_decl_printing_helper = helper; - return *this; - } - - DumpValueObjectOptions& - SetShowTypes(bool show = false) - { - m_show_types = show; - return *this; - } - - DumpValueObjectOptions& - SetShowLocation(bool show = false) - { - m_show_location = show; - return *this; - } - - DumpValueObjectOptions& - SetUseObjectiveC(bool use = false) - { - m_use_objc = use; - return *this; - } - - DumpValueObjectOptions& - SetShowSummary(bool show = true) - { - if (show == false) - SetOmitSummaryDepth(UINT32_MAX); - else - SetOmitSummaryDepth(0); - return *this; - } - - DumpValueObjectOptions& - SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues) - { - m_use_dynamic = dyn; - return *this; - } - - DumpValueObjectOptions& - SetUseSyntheticValue(bool use_synthetic = true) - { - m_use_synthetic = use_synthetic; - return *this; - } - - DumpValueObjectOptions& - SetScopeChecked(bool check = true) - { - m_scope_already_checked = check; - return *this; - } - - DumpValueObjectOptions& - SetFlatOutput(bool flat = false) - { - m_flat_output = flat; - return *this; - } - - DumpValueObjectOptions& - SetOmitSummaryDepth(uint32_t depth = 0) - { - m_omit_summary_depth = depth; - return *this; - } - - DumpValueObjectOptions& - SetIgnoreCap(bool ignore = false) - { - m_ignore_cap = ignore; - return *this; - } - - DumpValueObjectOptions& - SetRawDisplay() - { - SetUseSyntheticValue(false); - SetOmitSummaryDepth(UINT32_MAX); - SetIgnoreCap(true); - SetHideName(false); - SetHideValue(false); - SetUseTypeDisplayName(false); - SetAllowOnelinerMode(false); - return *this; - } - - DumpValueObjectOptions& - SetFormat (lldb::Format format = lldb::eFormatDefault) - { - m_format = format; - return *this; - } - - DumpValueObjectOptions& - SetSummary (lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP()) - { - m_summary_sp = summary; - return *this; - } - - DumpValueObjectOptions& - SetRootValueObjectName (const char* name = NULL) - { - if (name) - m_root_valobj_name.assign(name); - else - m_root_valobj_name.clear(); - return *this; - } - - DumpValueObjectOptions& - SetHideRootType (bool hide_root_type = false) - { - m_hide_root_type = hide_root_type; - return *this; - } - - DumpValueObjectOptions& - SetHideName (bool hide_name = false) - { - m_hide_name = hide_name; - return *this; - } - - DumpValueObjectOptions& - SetHideValue (bool hide_value = false) - { - m_hide_value = hide_value; - return *this; - } - - DumpValueObjectOptions& - SetHidePointerValue (bool hide = false) - { - m_hide_pointer_value = hide; - return *this; - } - - DumpValueObjectOptions& - SetVariableFormatDisplayLanguage (lldb::LanguageType lang = lldb::eLanguageTypeUnknown) - { - m_varformat_language = lang; - return *this; - } - - DumpValueObjectOptions& - SetRunValidator (bool run = true) - { - m_run_validator = run; - return *this; - } - - DumpValueObjectOptions& - SetUseTypeDisplayName (bool dis = false) - { - m_use_type_display_name = dis; - return *this; - } - - DumpValueObjectOptions& - SetAllowOnelinerMode (bool oneliner = false) - { - m_allow_oneliner_mode = oneliner; - return *this; - } - -}; - class ValueObjectPrinter { public: |