[lldb][NFC] Give CompilerType's IsArrayType/IsVectorType/IsBlockPointerType out-parameters default values

We already do this for most functions that have out-parameters, so let's do
the same here and avoid all the `nullptr, nullptr, nullptr` in every call.
This commit is contained in:
Raphael Isemann 2021-02-23 10:38:48 +01:00
parent 16ede0956c
commit 03310c1e95
7 changed files with 18 additions and 17 deletions

View File

@ -71,10 +71,12 @@ public:
bool IsValid() const { return m_type != nullptr && m_type_system != nullptr; }
bool IsArrayType(CompilerType *element_type, uint64_t *size,
bool *is_incomplete) const;
bool IsArrayType(CompilerType *element_type = nullptr,
uint64_t *size = nullptr,
bool *is_incomplete = nullptr) const;
bool IsVectorType(CompilerType *element_type, uint64_t *size) const;
bool IsVectorType(CompilerType *element_type = nullptr,
uint64_t *size = nullptr) const;
bool IsArrayOfScalarType() const;
@ -110,7 +112,8 @@ public:
bool IsFunctionPointerType() const;
bool IsBlockPointerType(CompilerType *function_pointer_type_ptr) const;
bool
IsBlockPointerType(CompilerType *function_pointer_type_ptr = nullptr) const;
bool IsIntegerType(bool &is_signed) const;

View File

@ -914,7 +914,7 @@ ValueObject::ReadPointedString(lldb::DataBufferSP &buffer_sp, Status &error,
if (is_array) {
// We have an array
uint64_t array_size = 0;
if (compiler_type.IsArrayType(nullptr, &array_size, nullptr)) {
if (compiler_type.IsArrayType(nullptr, &array_size)) {
cstr_len = array_size;
if (cstr_len > max_length) {
capped_data = true;
@ -1608,9 +1608,7 @@ ValueObject::GetTypeInfo(CompilerType *pointee_or_element_compiler_type) {
bool ValueObject::IsPointerType() { return GetCompilerType().IsPointerType(); }
bool ValueObject::IsArrayType() {
return GetCompilerType().IsArrayType(nullptr, nullptr, nullptr);
}
bool ValueObject::IsArrayType() { return GetCompilerType().IsArrayType(); }
bool ValueObject::IsScalarType() { return GetCompilerType().IsScalarType(); }

View File

@ -219,7 +219,7 @@ public:
m_parent_format = m_backend.GetFormat();
CompilerType parent_type(m_backend.GetCompilerType());
CompilerType element_type;
parent_type.IsVectorType(&element_type, nullptr);
parent_type.IsVectorType(&element_type);
m_child_type = ::GetCompilerTypeForFormat(m_parent_format, element_type,
parent_type.GetTypeSystem());
m_num_children = ::CalculateNumChildren(parent_type, m_child_type);

View File

@ -1617,7 +1617,7 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl(
thread.GetRegisterContext()->ReadRegisterAsUnsigned(r0_reg_info, 0) &
UINT32_MAX;
value.GetScalar() = ptr;
} else if (compiler_type.IsVectorType(nullptr, nullptr)) {
} else if (compiler_type.IsVectorType()) {
if (IsArmHardFloat(thread) && (*byte_size == 8 || *byte_size == 16)) {
is_vfp_candidate = true;
vfp_byte_size = 8;
@ -1704,7 +1704,7 @@ ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl(
if (homogeneous_count > 0 && homogeneous_count <= 4) {
llvm::Optional<uint64_t> base_byte_size =
base_type.GetByteSize(&thread);
if (base_type.IsVectorType(nullptr, nullptr)) {
if (base_type.IsVectorType()) {
if (base_byte_size &&
(*base_byte_size == 8 || *base_byte_size == 16)) {
is_vfp_candidate = true;

View File

@ -1054,7 +1054,7 @@ CPlusPlusLanguage::GetHardcodedSummaries() {
.SetSkipReferences(false),
lldb_private::formatters::VectorTypeSummaryProvider,
"vector_type pointer summary provider"));
if (valobj.GetCompilerType().IsVectorType(nullptr, nullptr)) {
if (valobj.GetCompilerType().IsVectorType()) {
if (fmt_mgr.GetCategory(g_vectortypes)->IsEnabled())
return formatter_sp;
}
@ -1074,7 +1074,7 @@ CPlusPlusLanguage::GetHardcodedSummaries() {
.SetSkipReferences(false),
lldb_private::formatters::BlockPointerSummaryProvider,
"block pointer summary provider"));
if (valobj.GetCompilerType().IsBlockPointerType(nullptr)) {
if (valobj.GetCompilerType().IsBlockPointerType()) {
return formatter_sp;
}
return nullptr;
@ -1104,7 +1104,7 @@ CPlusPlusLanguage::GetHardcodedSynthetics() {
.SetNonCacheable(true),
"vector_type synthetic children",
lldb_private::formatters::VectorTypeSyntheticFrontEndCreator));
if (valobj.GetCompilerType().IsVectorType(nullptr, nullptr)) {
if (valobj.GetCompilerType().IsVectorType()) {
if (fmt_mgr.GetCategory(g_vectortypes)->IsEnabled())
return formatter_sp;
}
@ -1123,7 +1123,7 @@ CPlusPlusLanguage::GetHardcodedSynthetics() {
.SetNonCacheable(true),
"block pointer synthetic children",
lldb_private::formatters::BlockPointerSyntheticFrontEndCreator));
if (valobj.GetCompilerType().IsBlockPointerType(nullptr)) {
if (valobj.GetCompilerType().IsBlockPointerType()) {
return formatter_sp;
}
return nullptr;

View File

@ -85,7 +85,7 @@ ValueObjectSP BitsetFrontEnd::GetChildAtIndex(size_t idx) {
CompilerType type;
ValueObjectSP chunk;
// For small bitsets __first_ is not an array, but a plain size_t.
if (m_first->GetCompilerType().IsArrayType(&type, nullptr, nullptr)) {
if (m_first->GetCompilerType().IsArrayType(&type)) {
llvm::Optional<uint64_t> bit_size =
type.GetBitSize(ctx.GetBestExecutionContextScope());
if (!bit_size || *bit_size == 0)

View File

@ -248,7 +248,7 @@ bool CompilerType::IsPointerToScalarType() const {
bool CompilerType::IsArrayOfScalarType() const {
CompilerType element_type;
if (IsArrayType(&element_type, nullptr, nullptr))
if (IsArrayType(&element_type))
return element_type.IsScalarType();
return false;
}