[lldb][NFC] Replace some counting loops with std::distance

This commit is contained in:
Vlad Serebrennikov 2023-07-30 19:21:17 +03:00
parent 822c749aec
commit fa2b038cad

View File

@ -5361,11 +5361,8 @@ uint32_t TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
num_children += cxx_record_decl->getNumBases();
}
}
clang::RecordDecl::field_iterator field, field_end;
for (field = record_decl->field_begin(),
field_end = record_decl->field_end();
field != field_end; ++field)
++num_children;
num_children += std::distance(record_decl->field_begin(),
record_decl->field_end());
}
break;
@ -5576,13 +5573,8 @@ uint32_t TypeSystemClang::GetNumFields(lldb::opaque_compiler_type_t type) {
if (record_type) {
clang::RecordDecl *record_decl = record_type->getDecl();
if (record_decl) {
uint32_t field_idx = 0;
clang::RecordDecl::field_iterator field, field_end;
for (field = record_decl->field_begin(),
field_end = record_decl->field_end();
field != field_end; ++field)
++field_idx;
count = field_idx;
count = std::distance(record_decl->field_begin(),
record_decl->field_end());
}
}
}