From 16eaeaded55b047b4bdf5a3ebfe4884fd786f9be Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 30 Jul 2022 10:35:54 -0700 Subject: [PATCH] Use is_contained (NFC) --- clang/include/clang/Basic/JsonSupport.h | 4 +--- clang/lib/Format/Format.cpp | 4 +--- clang/lib/Sema/SemaDeclAttr.cpp | 3 +-- mlir/lib/Analysis/Presburger/Simplex.cpp | 3 +-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/Basic/JsonSupport.h b/clang/include/clang/Basic/JsonSupport.h index 2ccb08e..4b8dff3 100644 --- a/clang/include/clang/Basic/JsonSupport.h +++ b/clang/include/clang/Basic/JsonSupport.h @@ -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. diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 57d796c..7df4a83 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -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; diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 695fedc..9818a86 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1876,8 +1876,7 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const ParsedAttr &AL) { for (const auto *I : D->specific_attrs()) { // 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 && diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp index 6f54136..61e8761 100644 --- a/mlir/lib/Analysis/Presburger/Simplex.cpp +++ b/mlir/lib/Analysis/Presburger/Simplex.cpp @@ -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; -- 2.7.4