diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h --- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -228,9 +228,9 @@ uint32_t m_flags = lldb::eTypeOptionCascade; }; - SyntheticChildren(const Flags &flags) : m_flags(flags) {} + SyntheticChildren(const Flags &flags); - virtual ~SyntheticChildren() = default; + virtual ~SyntheticChildren(); bool Cascades() const { return m_flags.GetCascades(); } @@ -239,8 +239,8 @@ bool SkipsReferences() const { return m_flags.GetSkipReferences(); } bool NonCacheable() const { return m_flags.GetNonCacheable(); } - - bool WantsDereference() const { return m_flags.GetFrontEndWantsDereference();} + + bool WantsDereference() const { return m_flags.GetFrontEndWantsDereference();} void SetCascades(bool value) { m_flags.SetCascades(value); } @@ -361,9 +361,9 @@ lldb::ValueObjectSP)> CreateFrontEndCallback; CXXSyntheticChildren(const SyntheticChildren::Flags &flags, - const char *description, CreateFrontEndCallback callback) - : SyntheticChildren(flags), m_create_callback(std::move(callback)), - m_description(description ? description : "") {} + const char *description, CreateFrontEndCallback callback); + + virtual ~CXXSyntheticChildren(); bool IsScripted() override { return false; } diff --git a/lldb/source/Commands/CommandObjectType.cpp b/lldb/source/Commands/CommandObjectType.cpp --- a/lldb/source/Commands/CommandObjectType.cpp +++ b/lldb/source/Commands/CommandObjectType.cpp @@ -2171,8 +2171,6 @@ "Show a list of current filters.") {} }; -#if LLDB_ENABLE_PYTHON - // CommandObjectTypeSynthList class CommandObjectTypeSynthList @@ -2184,8 +2182,6 @@ "Show a list of current synthetic providers.") {} }; -#endif - // CommandObjectTypeFilterDelete class CommandObjectTypeFilterDelete : public CommandObjectTypeFormatterDelete { @@ -2197,8 +2193,6 @@ ~CommandObjectTypeFilterDelete() override = default; }; -#if LLDB_ENABLE_PYTHON - // CommandObjectTypeSynthDelete class CommandObjectTypeSynthDelete : public CommandObjectTypeFormatterDelete { @@ -2210,7 +2204,6 @@ ~CommandObjectTypeSynthDelete() override = default; }; -#endif // CommandObjectTypeFilterClear @@ -2222,7 +2215,6 @@ "Delete all existing filter.") {} }; -#if LLDB_ENABLE_PYTHON // CommandObjectTypeSynthClear class CommandObjectTypeSynthClear : public CommandObjectTypeFormatterClear { @@ -2393,7 +2385,6 @@ return true; } -#endif #define LLDB_OPTIONS_type_filter_add #include "CommandOptions.inc" @@ -2941,8 +2932,6 @@ ~CommandObjectTypeFormat() override = default; }; -#if LLDB_ENABLE_PYTHON - class CommandObjectTypeSynth : public CommandObjectMultiword { public: CommandObjectTypeSynth(CommandInterpreter &interpreter) @@ -2970,8 +2959,6 @@ ~CommandObjectTypeSynth() override = default; }; -#endif - class CommandObjectTypeFilter : public CommandObjectMultiword { public: CommandObjectTypeFilter(CommandInterpreter &interpreter) @@ -3056,10 +3043,8 @@ CommandObjectSP(new CommandObjectTypeFormat(interpreter))); LoadSubCommand("summary", CommandObjectSP(new CommandObjectTypeSummary(interpreter))); -#if LLDB_ENABLE_PYTHON LoadSubCommand("synthetic", CommandObjectSP(new CommandObjectTypeSynth(interpreter))); -#endif LoadSubCommand("lookup", CommandObjectSP(new CommandObjectTypeLookup(interpreter))); } diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -218,10 +218,8 @@ SetValueFormat(DataVisualization::GetFormat(*this, eNoDynamicValues)); SetSummaryFormat( DataVisualization::GetSummaryFormat(*this, GetDynamicValueType())); -#if LLDB_ENABLE_PYTHON SetSyntheticChildren( DataVisualization::GetSyntheticChildren(*this, GetDynamicValueType())); -#endif } return any_change; @@ -1153,7 +1151,7 @@ Stream &s, ValueObjectRepresentationStyle val_obj_display, Format custom_format, PrintableRepresentationSpecialCases special, bool do_dump_error) { - + // If the ValueObject has an error, we might end up dumping the type, which // is useful, but if we don't even have a type, then don't examine the object // further as that's not meaningful, only the error is. @@ -2766,15 +2764,15 @@ ValueObjectSP ValueObject::Cast(const CompilerType &compiler_type) { // Only allow casts if the original type is equal or larger than the cast - // type. We don't know how to fetch more data for all the ConstResult types, + // type. We don't know how to fetch more data for all the ConstResult types, // so we can't guarantee this will work: Status error; CompilerType my_type = GetCompilerType(); - ExecutionContextScope *exe_scope + ExecutionContextScope *exe_scope = ExecutionContext(GetExecutionContextRef()) .GetBestExecutionContextScope(); - if (compiler_type.GetByteSize(exe_scope) + if (compiler_type.GetByteSize(exe_scope) <= GetCompilerType().GetByteSize(exe_scope)) { return DoCast(compiler_type); } diff --git a/lldb/source/DataFormatters/TypeSynthetic.cpp b/lldb/source/DataFormatters/TypeSynthetic.cpp --- a/lldb/source/DataFormatters/TypeSynthetic.cpp +++ b/lldb/source/DataFormatters/TypeSynthetic.cpp @@ -84,6 +84,27 @@ return std::string(sstr.GetString()); } +SyntheticChildren::SyntheticChildren(const Flags &flags) : m_flags(flags) {} + +SyntheticChildren::~SyntheticChildren() = default; + +CXXSyntheticChildren::CXXSyntheticChildren( + const SyntheticChildren::Flags &flags, const char *description, + CreateFrontEndCallback callback) + : SyntheticChildren(flags), m_create_callback(std::move(callback)), + m_description(description ? description : "") {} + +CXXSyntheticChildren::~CXXSyntheticChildren() = default; + +bool SyntheticChildren::IsScripted() { return false; } + +std::string SyntheticChildren::GetDescription() { return ""; } + +SyntheticChildrenFrontEnd::AutoPointer +SyntheticChildren::GetFrontEnd(ValueObject &backend) { + return nullptr; +} + std::string CXXSyntheticChildren::GetDescription() { StreamString sstr; sstr.Printf("%s%s%s %s", Cascades() ? "" : " (not cascading)",