Make more use of llvm STLExtras (#4668)

This is essentially the result of looking at `.begin()` uses. We also
frequently do `std::shuffle`, but unfortunately STLExtras doesn't
provide a wrapper for that.
This commit is contained in:
Jon Ross-Perkins
2024-12-11 18:16:38 +00:00
committed by GitHub
parent 47285b6207
commit 61c0a8b676
15 changed files with 52 additions and 64 deletions
+2 -3
View File
@@ -129,9 +129,8 @@ auto ScopeStack::LookupInLexicalScopes(SemIR::NameId name_id)
// Find the first non-lexical scope that is within the scope of the lexical
// lookup result.
auto* first_non_lexical_scope = std::lower_bound(
non_lexical_scope_stack_.begin(), non_lexical_scope_stack_.end(),
lexical_results.back().scope_index,
auto* first_non_lexical_scope = llvm::lower_bound(
non_lexical_scope_stack_, lexical_results.back().scope_index,
[](const NonLexicalScope& scope, ScopeIndex index) {
return scope.scope_index < index;
});