Skip to content

Commit c527b0f

Browse files
authored
Merge pull request swiftlang#71259 from rintaro/ide-ccoperatorkind-rdar120909147
[CodeCompletion] Use std::begin/std::end to get C-array iterators
2 parents c2716e4 + ea733c2 commit c527b0f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/IDE/CodeCompletionResult.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ ContextFreeCodeCompletionResult::getCodeCompletionOperatorKind(
236236
using CCOK = CodeCompletionOperatorKind;
237237
using OpPair = std::pair<StringRef, CCOK>;
238238

239-
// This list must be kept in alphabetical order.
239+
// This list must be kept in lexicographic order.
240240
static OpPair ops[] = {
241241
std::make_pair("!", CCOK::Bang),
242242
std::make_pair("!=", CCOK::NotEq),
@@ -280,13 +280,12 @@ ContextFreeCodeCompletionResult::getCodeCompletionOperatorKind(
280280
std::make_pair("||", CCOK::PipePipe),
281281
std::make_pair("~=", CCOK::TildeEq),
282282
};
283-
static auto opsSize = sizeof(ops) / sizeof(ops[0]);
284283

285284
auto I = std::lower_bound(
286-
ops, &ops[opsSize], std::make_pair(name, CCOK::None),
285+
std::begin(ops), std::end(ops), std::make_pair(name, CCOK::None),
287286
[](const OpPair &a, const OpPair &b) { return a.first < b.first; });
288287

289-
if (I == &ops[opsSize] || I->first != name)
288+
if (I == std::end(ops) || I->first != name)
290289
return CCOK::Unknown;
291290
return I->second;
292291
}

0 commit comments

Comments
 (0)