Skip to content

Commit

Permalink
Use is_contained (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Jul 30, 2022
1 parent 5bc0e7b commit 16eaead
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
4 changes: 1 addition & 3 deletions clang/include/clang/Basic/JsonSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 1 addition & 3 deletions clang/lib/Format/Format.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/Analysis/Presburger/Simplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 16eaead

Please sign in to comment.