//===-- VectorType.cpp ----------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "lldb/DataFormatters/VectorType.h" #include "lldb/Core/ValueObject.h" #include "lldb/Core/ValueObjectConstResult.h" #include "lldb/DataFormatters/FormattersHelpers.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/Target.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" #include <optional> usingnamespacelldb; usingnamespacelldb_private; usingnamespacelldb_private::formatters; static CompilerType GetCompilerTypeForFormat(lldb::Format format, CompilerType element_type, TypeSystemSP type_system) { … } static lldb::Format GetItemFormatForFormat(lldb::Format format, CompilerType element_type) { … } /// Calculates the number of elements stored in a container (with /// element type 'container_elem_type') as if it had elements of type /// 'element_type'. /// /// For example, a container of type /// `uint8_t __attribute__((vector_size(16)))` has 16 elements. /// But calling `CalculateNumChildren` with an 'element_type' /// of `float` (4-bytes) will return `4` because we are interpreting /// the byte-array as a `float32[]`. /// /// \param[in] container_elem_type The type of the elements stored /// in the container we are calculating the children of. /// /// \param[in] num_elements Number of 'container_elem_type's our /// container stores. /// /// \param[in] element_type The type of elements we interpret /// container_type to contain for the purposes of calculating /// the number of children. /// /// \returns The number of elements stored in a container of /// type 'element_type'. Returns a std::nullopt if the /// size of the container is not a multiple of 'element_type' /// or if an error occurs. static std::optional<size_t> CalculateNumChildren(CompilerType container_elem_type, uint64_t num_elements, CompilerType element_type) { … } namespace lldb_private { namespace formatters { class VectorTypeSyntheticFrontEnd : public SyntheticChildrenFrontEnd { … }; } // namespace formatters } // namespace lldb_private bool lldb_private::formatters::VectorTypeSummaryProvider( ValueObject &valobj, Stream &s, const TypeSummaryOptions &) { … } lldb_private::SyntheticChildrenFrontEnd * lldb_private::formatters::VectorTypeSyntheticFrontEndCreator( CXXSyntheticChildren *, lldb::ValueObjectSP valobj_sp) { … }