Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
source/DataFormatters/VectorType.cpp
Show All 9 Lines | |||||
#include "lldb/Core/ValueObject.h" | #include "lldb/Core/ValueObject.h" | ||||
#include "lldb/DataFormatters/FormattersHelpers.h" | #include "lldb/DataFormatters/FormattersHelpers.h" | ||||
#include "lldb/Symbol/CompilerType.h" | #include "lldb/Symbol/CompilerType.h" | ||||
#include "lldb/Symbol/TypeSystem.h" | #include "lldb/Symbol/TypeSystem.h" | ||||
#include "lldb/Target/Target.h" | #include "lldb/Target/Target.h" | ||||
#include "lldb/Utility/LLDBAssert.h" | #include "lldb/Utility/LLDBAssert.h" | ||||
#include "lldb/Utility/Log.h" | |||||
using namespace lldb; | using namespace lldb; | ||||
using namespace lldb_private; | using namespace lldb_private; | ||||
using namespace lldb_private::formatters; | using namespace lldb_private::formatters; | ||||
static CompilerType GetCompilerTypeForFormat(lldb::Format format, | static CompilerType GetCompilerTypeForFormat(lldb::Format format, | ||||
CompilerType element_type, | CompilerType element_type, | ||||
TypeSystem *type_system) { | TypeSystem *type_system) { | ||||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { | ||||
return child_sp; | return child_sp; | ||||
} | } | ||||
bool Update() override { | bool Update() override { | ||||
m_parent_format = m_backend.GetFormat(); | m_parent_format = m_backend.GetFormat(); | ||||
CompilerType parent_type(m_backend.GetCompilerType()); | CompilerType parent_type(m_backend.GetCompilerType()); | ||||
CompilerType element_type; | CompilerType element_type; | ||||
parent_type.IsVectorType(&element_type, nullptr); | parent_type.IsVectorType(&element_type, nullptr); | ||||
TargetSP target_sp(m_backend.GetTargetSP()); | TypeSystem *type_system = nullptr; | ||||
m_child_type = ::GetCompilerTypeForFormat( | if (auto target_sp = m_backend.GetTargetSP()) { | ||||
m_parent_format, element_type, | auto type_system_or_err = | ||||
target_sp | target_sp->GetScratchTypeSystemForLanguage(lldb::eLanguageTypeC); | ||||
? target_sp->GetScratchTypeSystemForLanguage(nullptr, | if (auto err = type_system_or_err.takeError()) { | ||||
lldb::eLanguageTypeC) | LLDB_LOG_ERROR( | ||||
: nullptr); | lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS), | ||||
std::move(err), "Unable to update from scratch TypeSystem"); | |||||
} else { | |||||
type_system = &type_system_or_err.get(); | |||||
} | |||||
} | |||||
m_child_type = | |||||
::GetCompilerTypeForFormat(m_parent_format, element_type, type_system); | |||||
m_num_children = ::CalculateNumChildren(parent_type, m_child_type); | m_num_children = ::CalculateNumChildren(parent_type, m_child_type); | ||||
m_item_format = GetItemFormatForFormat(m_parent_format, m_child_type); | m_item_format = GetItemFormatForFormat(m_parent_format, m_child_type); | ||||
return false; | return false; | ||||
} | } | ||||
bool MightHaveChildren() override { return true; } | bool MightHaveChildren() override { return true; } | ||||
size_t GetIndexOfChildWithName(ConstString name) override { | size_t GetIndexOfChildWithName(ConstString name) override { | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |