mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
[lldb][NFC] Replace some counting loops with std::distance
This commit is contained in:
parent
822c749aec
commit
fa2b038cad
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user