diff options
author | Kazu Hirata <kazu@google.com> | 2025-05-21 20:31:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-21 20:31:52 -0700 |
commit | 6d2a7b45466a25865898761ef0793fb847c48a0f (patch) | |
tree | b8106ca6f4581a9fdf8c65cb639033184e6e11d1 /clang/lib | |
parent | 287294d54d7a806e70b0061cf5ccc1fc2bd03eea (diff) | |
download | llvm-6d2a7b45466a25865898761ef0793fb847c48a0f.zip llvm-6d2a7b45466a25865898761ef0793fb847c48a0f.tar.gz llvm-6d2a7b45466a25865898761ef0793fb847c48a0f.tar.bz2 |
[clang] Use llvm::find_if (NFC) (#140983)
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Analysis/ThreadSafety.cpp | 22 | ||||
-rw-r--r-- | clang/lib/Format/MacroCallReconstructor.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 5 | ||||
-rw-r--r-- | clang/lib/Sema/SemaStmtAttr.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 4 |
5 files changed, 17 insertions, 22 deletions
diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index 156df51a..528fd09 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -236,38 +236,34 @@ public: } iterator findLockIter(FactManager &FM, const CapabilityExpr &CapE) { - return std::find_if(begin(), end(), [&](FactID ID) { - return FM[ID].matches(CapE); - }); + return llvm::find_if(*this, + [&](FactID ID) { return FM[ID].matches(CapE); }); } const FactEntry *findLock(FactManager &FM, const CapabilityExpr &CapE) const { - auto I = std::find_if(begin(), end(), [&](FactID ID) { - return FM[ID].matches(CapE); - }); + auto I = + llvm::find_if(*this, [&](FactID ID) { return FM[ID].matches(CapE); }); return I != end() ? &FM[*I] : nullptr; } const FactEntry *findLockUniv(FactManager &FM, const CapabilityExpr &CapE) const { - auto I = std::find_if(begin(), end(), [&](FactID ID) -> bool { - return FM[ID].matchesUniv(CapE); - }); + auto I = llvm::find_if( + *this, [&](FactID ID) -> bool { return FM[ID].matchesUniv(CapE); }); return I != end() ? &FM[*I] : nullptr; } const FactEntry *findPartialMatch(FactManager &FM, const CapabilityExpr &CapE) const { - auto I = std::find_if(begin(), end(), [&](FactID ID) -> bool { + auto I = llvm::find_if(*this, [&](FactID ID) -> bool { return FM[ID].partiallyMatches(CapE); }); return I != end() ? &FM[*I] : nullptr; } bool containsMutexDecl(FactManager &FM, const ValueDecl* Vd) const { - auto I = std::find_if(begin(), end(), [&](FactID ID) -> bool { - return FM[ID].valueDecl() == Vd; - }); + auto I = llvm::find_if( + *this, [&](FactID ID) -> bool { return FM[ID].valueDecl() == Vd; }); return I != end(); } }; diff --git a/clang/lib/Format/MacroCallReconstructor.cpp b/clang/lib/Format/MacroCallReconstructor.cpp index f69a6aa..c9b618c 100644 --- a/clang/lib/Format/MacroCallReconstructor.cpp +++ b/clang/lib/Format/MacroCallReconstructor.cpp @@ -518,9 +518,9 @@ MacroCallReconstructor::createUnwrappedLine(const ReconstructedLine &Line, // If we only have one child, and the child is due to a macro expansion // (either attached to a left parenthesis or comma), merge the child into // the current line to prevent forced breaks for macro arguments. - auto *Child = std::find_if( - N->Children.begin(), N->Children.end(), - [](const auto &Child) { return !Child->Tokens.empty(); }); + auto *Child = llvm::find_if(N->Children, [](const auto &Child) { + return !Child->Tokens.empty(); + }); auto Line = createUnwrappedLine(**Child, Level); Result.Tokens.splice(Result.Tokens.end(), Line.Tokens); } else if (NumChildren > 0) { diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 1bd9056..fe92191 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -970,9 +970,8 @@ static bool CheckBindingsCount(Sema &S, DecompositionDecl *DD, QualType DecompType, ArrayRef<BindingDecl *> Bindings, unsigned MemberCount) { - auto BindingWithPackItr = - std::find_if(Bindings.begin(), Bindings.end(), - [](BindingDecl *D) -> bool { return D->isParameterPack(); }); + auto BindingWithPackItr = llvm::find_if( + Bindings, [](BindingDecl *D) -> bool { return D->isParameterPack(); }); bool HasPack = BindingWithPackItr != Bindings.end(); bool IsValid; if (!HasPack) { diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index cf1c597..17da5fd 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -395,7 +395,7 @@ static Attr *handleCodeAlignAttr(Sema &S, Stmt *St, const ParsedAttr &A) { template <typename LoopAttrT> static void CheckForDuplicateLoopAttrs(Sema &S, ArrayRef<const Attr *> Attrs) { auto FindFunc = [](const Attr *A) { return isa<const LoopAttrT>(A); }; - const auto *FirstItr = std::find_if(Attrs.begin(), Attrs.end(), FindFunc); + const auto *FirstItr = llvm::find_if(Attrs, FindFunc); if (FirstItr == Attrs.end()) // no attributes found return; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 28d4412..3a618fd 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -7689,8 +7689,8 @@ static bool checkMutualExclusion(TypeProcessingState &state, const FunctionProtoType::ExtProtoInfo &EPI, ParsedAttr &Attr, AttributeCommonInfo::Kind OtherKind) { - auto OtherAttr = std::find_if( - state.getCurrentAttributes().begin(), state.getCurrentAttributes().end(), + auto OtherAttr = llvm::find_if( + state.getCurrentAttributes(), [OtherKind](const ParsedAttr &A) { return A.getKind() == OtherKind; }); if (OtherAttr == state.getCurrentAttributes().end() || OtherAttr->isInvalid()) return false; |