Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

Identified with llvm-use-ranges.

@llvmbot
Copy link
Member

llvmbot commented Nov 8, 2025

@llvm/pr-subscribers-debuginfo
@llvm/pr-subscribers-tablegen

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

Identified with llvm-use-ranges.


Full diff: https://github.com/llvm/llvm-project/pull/167166.diff

5 Files Affected:

  • (modified) llvm/include/llvm/Option/OptTable.h (+3-5)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp (+4-5)
  • (modified) llvm/lib/Option/OptTable.cpp (+2-3)
  • (modified) llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp (+2-3)
  • (modified) llvm/utils/TableGen/OptionParserEmitter.cpp (+3-3)
diff --git a/llvm/include/llvm/Option/OptTable.h b/llvm/include/llvm/Option/OptTable.h
index f641ca4ac08d3..45083b31c11f4 100644
--- a/llvm/include/llvm/Option/OptTable.h
+++ b/llvm/include/llvm/Option/OptTable.h
@@ -148,15 +148,13 @@ class LLVM_ABI OptTable {
                             StringRef SubCommand) const {
     assert(!SubCommand.empty() &&
            "This helper is only for valid registered subcommands.");
-    auto SCIT =
-        std::find_if(SubCommands.begin(), SubCommands.end(),
-                     [&](const auto &C) { return SubCommand == C.Name; });
+    auto SCIT = llvm::find_if(
+        SubCommands, [&](const auto &C) { return SubCommand == C.Name; });
     assert(SCIT != SubCommands.end() &&
            "This helper is only for valid registered subcommands.");
     auto SubCommandIDs = CandidateInfo->getSubCommandIDs(SubCommandIDsTable);
     unsigned CurrentSubCommandID = SCIT - &SubCommands[0];
-    return std::find(SubCommandIDs.begin(), SubCommandIDs.end(),
-                     CurrentSubCommandID) != SubCommandIDs.end();
+    return llvm::is_contained(SubCommandIDs, CurrentSubCommandID);
   }
 
 private:
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 5ab80e339a1ad..693454e249945 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -917,11 +917,10 @@ unsigned DWARFVerifier::verifyDebugInfoAttribute(const DWARFDie &Die,
     }
 
     // Check if the offset matches any of the sequence offset.
-    auto It =
-        std::find_if(LineTable->Sequences.begin(), LineTable->Sequences.end(),
-                     [SectionOffset](const auto &Sequence) {
-                       return Sequence.StmtSeqOffset == *SectionOffset;
-                     });
+    auto It = llvm::find_if(LineTable->Sequences,
+                            [SectionOffset](const auto &Sequence) {
+                              return Sequence.StmtSeqOffset == *SectionOffset;
+                            });
 
     if (It == LineTable->Sequences.end())
       ReportError(
diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp
index 14e3b0d60886d..0450b2fd172ef 100644
--- a/llvm/lib/Option/OptTable.cpp
+++ b/llvm/lib/Option/OptTable.cpp
@@ -756,9 +756,8 @@ void OptTable::internalPrintHelp(
   // pairs.
   std::map<std::string, std::vector<OptionInfo>> GroupedOptionHelp;
 
-  auto ActiveSubCommand =
-      std::find_if(SubCommands.begin(), SubCommands.end(),
-                   [&](const auto &C) { return SubCommand == C.Name; });
+  auto ActiveSubCommand = llvm::find_if(
+      SubCommands, [&](const auto &C) { return SubCommand == C.Name; });
   if (!SubCommand.empty()) {
     assert(ActiveSubCommand != SubCommands.end() &&
            "Not a valid registered subcommand.");
diff --git a/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp b/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp
index 716f5f21302a8..13cfaf3a0345e 100644
--- a/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp
+++ b/llvm/unittests/Transforms/Utils/SSAUpdaterBulkTest.cpp
@@ -393,9 +393,8 @@ static void RunEliminateNewDuplicatePHINode(
   }
 
   Function *F = M->getFunction("main");
-  auto BBIt = std::find_if(F->begin(), F->end(), [](const BasicBlock &Block) {
-    return Block.getName() == "testbb";
-  });
+  auto BBIt = llvm::find_if(
+      *F, [](const BasicBlock &Block) { return Block.getName() == "testbb"; });
   ASSERT_NE(BBIt, F->end());
   Check(*BBIt, EliminateNewDuplicatePHINodes);
 }
diff --git a/llvm/utils/TableGen/OptionParserEmitter.cpp b/llvm/utils/TableGen/OptionParserEmitter.cpp
index 48ae1a0a92b1c..04fb720b0504b 100644
--- a/llvm/utils/TableGen/OptionParserEmitter.cpp
+++ b/llvm/utils/TableGen/OptionParserEmitter.cpp
@@ -378,9 +378,9 @@ static void emitOptionParser(const RecordKeeper &Records, raw_ostream &OS) {
       assert((CurIndex == 0 || !SubCommand.empty()) &&
              "Only first subcommand set should be empty!");
       for (const auto &SubCommandKey : SubCommand) {
-        auto It = std::find_if(
-            SubCommands.begin(), SubCommands.end(),
-            [&](const Record *R) { return R->getName() == SubCommandKey; });
+        auto It = llvm::find_if(SubCommands, [&](const Record *R) {
+          return R->getName() == SubCommandKey;
+        });
         assert(It != SubCommands.end() && "SubCommand not found");
         OS << ", " << std::distance(SubCommands.begin(), It) << " /* '"
            << SubCommandKey << "' */";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants