Skip to content

Commit 4567c11

Browse files
[clang] Use llvm::binary_search (NFC) (#140216)
1 parent 7d63306 commit 4567c11

File tree

6 files changed

+7
-12
lines changed

6 files changed

+7
-12
lines changed

clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,7 @@ class AnalyzerOptions {
311311
return AnalyzerConfigCmdFlags;
312312
}();
313313

314-
return !std::binary_search(AnalyzerConfigCmdFlags.begin(),
315-
AnalyzerConfigCmdFlags.end(), Name);
314+
return !llvm::binary_search(AnalyzerConfigCmdFlags, Name);
316315
}
317316

318317
AnalyzerOptions()

clang/lib/Format/Format.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -3091,9 +3091,8 @@ class ObjCHeaderStyleGuesser : public TokenAnalyzer {
30913091
FormatTok->isOneOf(tok::numeric_constant, tok::l_square,
30923092
tok::l_brace))) ||
30933093
(FormatTok->Tok.isAnyIdentifier() &&
3094-
std::binary_search(std::begin(FoundationIdentifiers),
3095-
std::end(FoundationIdentifiers),
3096-
FormatTok->TokenText)) ||
3094+
llvm::binary_search(FoundationIdentifiers,
3095+
FormatTok->TokenText)) ||
30973096
FormatTok->is(TT_ObjCStringLiteral) ||
30983097
FormatTok->isOneOf(Keywords.kw_NS_CLOSED_ENUM, Keywords.kw_NS_ENUM,
30993098
Keywords.kw_NS_ERROR_ENUM,

clang/lib/Format/FormatToken.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ bool FormatToken::isTypeName(const LangOptions &LangOpts) const {
4545
if (is(TT_TypeName) || Tok.isSimpleTypeSpecifier(LangOpts))
4646
return true;
4747
return (LangOpts.CXXOperatorNames || LangOpts.C11) && is(tok::identifier) &&
48-
std::binary_search(CppNonKeywordTypes.begin(),
49-
CppNonKeywordTypes.end(), TokenText);
48+
llvm::binary_search(CppNonKeywordTypes, TokenText);
5049
}
5150

5251
bool FormatToken::isTypeOrIdentifier(const LangOptions &LangOpts) const {

clang/lib/Frontend/DiagnosticRenderer.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,7 @@ retrieveMacroLocation(SourceLocation Loc, FileID MacroFileID,
272272
if (SM->isMacroArgExpansion(Loc)) {
273273
// Only look at the immediate spelling location of this macro argument if
274274
// the other location in the source range is also present in that expansion.
275-
if (std::binary_search(CommonArgExpansions.begin(),
276-
CommonArgExpansions.end(), MacroFileID))
275+
if (llvm::binary_search(CommonArgExpansions, MacroFileID))
277276
MacroRange =
278277
CharSourceRange(SM->getImmediateSpellingLoc(Loc), IsTokenRange);
279278
MacroArgRange = SM->getImmediateExpansionRange(Loc);

clang/lib/Frontend/VerifyDiagnosticConsumer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ static bool ParseDirective(StringRef S, ExpectedData *ED, SourceManager &SM,
482482
// What's left in DToken is the actual prefix. That might not be a -verify
483483
// prefix even if there is only one -verify prefix (for example, the full
484484
// DToken is foo-bar-warning, but foo is the only -verify prefix).
485-
if (!std::binary_search(Prefixes.begin(), Prefixes.end(), DToken))
485+
if (!llvm::binary_search(Prefixes, DToken))
486486
continue;
487487

488488
if (NoDiag) {

clang/lib/Lex/PPDirectives.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,7 @@ static bool isFeatureTestMacro(StringRef MacroName) {
148148
"__STDCPP_WANT_MATH_SPEC_FUNCS__",
149149
"__STDC_FORMAT_MACROS",
150150
};
151-
return std::binary_search(std::begin(ReservedMacro), std::end(ReservedMacro),
152-
MacroName);
151+
return llvm::binary_search(ReservedMacro, MacroName);
153152
}
154153

155154
static bool isLanguageDefinedBuiltin(const SourceManager &SourceMgr,

0 commit comments

Comments
 (0)