From 8bdf38785888ddc7f2428918193b3f371ebea5cf Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Wed, 15 Mar 2023 08:46:32 -0700 Subject: [PATCH] Use *{Map,Set}::contains (NFC) Differential Revision: https://reviews.llvm.org/D146104 --- bolt/include/bolt/Core/BinaryFunction.h | 2 +- .../clang-tidy/bugprone/EasilySwappableParametersCheck.cpp | 2 +- clang/lib/AST/ASTContext.cpp | 2 +- clang/lib/Lex/Lexer.cpp | 2 +- clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp | 3 +-- llvm/include/llvm/Support/CommandLine.h | 2 +- llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp | 2 +- llvm/lib/IR/DebugInfoMetadata.cpp | 2 +- llvm/lib/Support/CommandLine.cpp | 2 +- llvm/lib/Transforms/Scalar/GVNSink.cpp | 4 ++-- llvm/tools/llvm-exegesis/lib/Analysis.cpp | 2 +- llvm/utils/UnicodeData/UnicodeNameMappingGenerator.cpp | 5 ++--- mlir/lib/AsmParser/Parser.cpp | 2 +- mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp | 2 +- mlir/lib/Dialect/SCF/Utils/AffineCanonicalizationUtils.cpp | 2 +- 15 files changed, 17 insertions(+), 19 deletions(-) diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h index 036a4c5..7a99ce2 100644 --- a/bolt/include/bolt/Core/BinaryFunction.h +++ b/bolt/include/bolt/Core/BinaryFunction.h @@ -1754,7 +1754,7 @@ public: /// Returns if this function is a child of \p Other function. bool isChildOf(const BinaryFunction &Other) const { - return llvm::is_contained(ParentFragments, &Other); + return ParentFragments.contains(&Other); } /// Set the profile data for the number of times the function was called. diff --git a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp index 0e21453..fa72857 100644 --- a/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp @@ -1581,7 +1581,7 @@ bool lazyMapOfSetsIntersectionExists(const MapTy &Map, const ElemTy &E1, return false; for (const auto &E1SetElem : E1Iterator->second) - if (llvm::is_contained(E2Iterator->second, E1SetElem)) + if (E2Iterator->second.contains(E1SetElem)) return true; return false; diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 14c9ab9..5196f1e 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -11961,7 +11961,7 @@ void ASTContext::forEachMultiversionedFunctionVersion( FD->getDeclContext()->getRedeclContext()->lookup(FD->getDeclName())) { FunctionDecl *CurFD = CurDecl->getAsFunction()->getMostRecentDecl(); if (CurFD && hasSameType(CurFD->getType(), FD->getType()) && - !llvm::is_contained(SeenDecls, CurFD)) { + !SeenDecls.contains(CurFD)) { SeenDecls.insert(CurFD); Pred(CurFD); } diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index b9b1372..bc97ca1 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2279,7 +2279,7 @@ void Lexer::codeCompleteIncludedFile(const char *PathStart, ++CompletionPoint; if (Next == (IsAngled ? '>' : '"')) break; - if (llvm::is_contained(SlashChars, Next)) + if (SlashChars.contains(Next)) break; } diff --git a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp index 4618d17..f0d3f43 100644 --- a/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp +++ b/clang/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp @@ -233,7 +233,7 @@ void CheckerRegistry::initializeRegistry(const CheckerManager &Mgr) { // done recursively, its arguably cheaper, but for sure less error prone to // recalculate from scratch. auto IsEnabled = [&](const CheckerInfo *Checker) { - return llvm::is_contained(Tmp, Checker); + return Tmp.contains(Checker); }; for (const CheckerInfo &Checker : Data.Checkers) { if (!Checker.isEnabled(Mgr)) @@ -525,4 +525,3 @@ void CheckerRegistry::validateCheckerOptions() const { << SuppliedCheckerOrPackage; } } - diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 43c769c..408853a 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -315,7 +315,7 @@ public: } bool isInAllSubCommands() const { - return llvm::is_contained(Subs, &SubCommand::getAll()); + return Subs.contains(&SubCommand::getAll()); } //-------------------------------------------------------------------------=== diff --git a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp index 55d939d..0b32d69 100644 --- a/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp +++ b/llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp @@ -388,7 +388,7 @@ public: Register Reg = MO.getReg(); assert(Reg.isPhysical() && "Only physical regs are expected"); - if (isCalleeSaved(Reg) && (AllowGCPtrInCSR || !is_contained(GCRegs, Reg))) + if (isCalleeSaved(Reg) && (AllowGCPtrInCSR || !GCRegs.contains(Reg))) continue; LLVM_DEBUG(dbgs() << "Will spill " << printReg(Reg, &TRI) << " at index " diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp index a5d9317..479a51e 100644 --- a/llvm/lib/IR/DebugInfoMetadata.cpp +++ b/llvm/lib/IR/DebugInfoMetadata.cpp @@ -1667,7 +1667,7 @@ bool DIExpression::hasAllLocationOps(unsigned N) const { if (ExprOp.getOp() == dwarf::DW_OP_LLVM_arg) SeenOps.insert(ExprOp.getArg(0)); for (uint64_t Idx = 0; Idx < N; ++Idx) - if (!is_contained(SeenOps, Idx)) + if (!SeenOps.contains(Idx)) return false; return true; } diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 92e69db..d3efb8b 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -2757,7 +2757,7 @@ StringMap