Use llvm::reverse() instead of pop_back_val() in ImportDeclAndDependencies() (#5831)

This is more explicit and similar to what we do in `MapType()`.
This commit is contained in:
Boaz Brickner
2025-07-18 21:11:12 +00:00
committed by GitHub
parent 977875ec20
commit 68ee3d5021
+7 -4
View File
@@ -1143,10 +1143,13 @@ static auto ImportDeclAndDependencies(Context& context, SemIR::LocId loc_id,
// Import dependencies in reverse order.
auto inst_id = SemIR::InstId::None;
do {
inst_id = ImportDeclAfterDependencies(context, loc_id,
clang_decls.pop_back_val());
} while (inst_id.has_value() && !clang_decls.empty());
for (clang::Decl* clang_decl_to_import : llvm::reverse(clang_decls)) {
inst_id =
ImportDeclAfterDependencies(context, loc_id, clang_decl_to_import);
if (!inst_id.has_value()) {
break;
}
}
return inst_id;
}