Use is_contained (NFC)

This commit is contained in:
Kazu Hirata 2022-07-30 10:35:54 -07:00
parent 5bc0e7b73c
commit 16eaeaded5
4 changed files with 4 additions and 10 deletions

View File

@ -104,9 +104,7 @@ inline void printSourceLocationAsJson(raw_ostream &Out, SourceLocation Loc,
auto RemoveIt =
std::remove_if(filename.begin(), filename.end(), [](auto Char) {
static const char ForbiddenChars[] = "<>*?\"|";
return std::find(std::begin(ForbiddenChars),
std::end(ForbiddenChars),
Char) != std::end(ForbiddenChars);
return llvm::is_contained(ForbiddenChars, Char);
});
filename.erase(RemoveIt, filename.end());
// Handle windows-specific path delimiters.

View File

@ -1719,9 +1719,7 @@ ParseError validateQualifierOrder(FormatStyle *Style) {
}
// Ensure the list has 'type' in it.
auto type = std::find(Style->QualifierOrder.begin(),
Style->QualifierOrder.end(), "type");
if (type == Style->QualifierOrder.end())
if (!llvm::is_contained(Style->QualifierOrder, "type"))
return ParseError::MissingQualifierType;
return ParseError::Success;

View File

@ -1876,8 +1876,7 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
for (const auto *I : D->specific_attrs<OwnershipAttr>()) {
// Cannot have two ownership attributes of different kinds for the same
// index.
if (I->getOwnKind() != K && I->args_end() !=
std::find(I->args_begin(), I->args_end(), Idx)) {
if (I->getOwnKind() != K && llvm::is_contained(I->args(), Idx)) {
S.Diag(AL.getLoc(), diag::err_attributes_are_not_compatible) << AL << I;
return;
} else if (K == OwnershipAttr::Returns &&

View File

@ -1237,8 +1237,7 @@ void SimplexBase::undo(UndoLogEntry entry) {
col++) {
assert(colUnknown[col] != nullIndex &&
"Column should not be a fixed column!");
if (std::find(basis.begin(), basis.end(), colUnknown[col]) !=
basis.end())
if (llvm::is_contained(basis, colUnknown[col]))
continue;
if (tableau(u.pos, col) == 0)
continue;