[llvm] 52360d1 - [NFC] Use `llvm::includes` instead of `std::includes` (#143542)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 11 18:27:32 PDT 2025
Author: Longsheng Mou
Date: 2025-06-12T09:27:27+08:00
New Revision: 52360d195b85608c677d781272534dfa61e9a1c3
URL: https://github.com/llvm/llvm-project/commit/52360d195b85608c677d781272534dfa61e9a1c3
DIFF: https://github.com/llvm/llvm-project/commit/52360d195b85608c677d781272534dfa61e9a1c3.diff
LOG: [NFC] Use `llvm::includes` instead of `std::includes` (#143542)
This PR follows up #143297.
Added:
Modified:
clang-tools-extra/clangd/refactor/Rename.cpp
llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
llvm/tools/sancov/sancov.cpp
llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
llvm/unittests/ADT/DeltaAlgorithmTest.cpp
llvm/utils/TableGen/AsmMatcherEmitter.cpp
llvm/utils/TableGen/Common/CodeGenRegisters.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index d9b73b83e902a..c56375b1a98d3 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -1308,7 +1308,7 @@ getMappedRanges(ArrayRef<Range> Indexed, ArrayRef<SymbolRange> Lexed) {
return std::nullopt;
}
// Fast check for the special subset case.
- if (std::includes(Indexed.begin(), Indexed.end(), Lexed.begin(), Lexed.end()))
+ if (llvm::includes(Indexed, Lexed))
return Lexed.vec();
std::vector<size_t> Best;
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index d94a2fbb23d23..61fef1387d82a 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -1975,12 +1975,10 @@ Value *DFSanFunction::combineShadows(Value *V1, Value *V2,
auto V1Elems = ShadowElements.find(V1);
auto V2Elems = ShadowElements.find(V2);
if (V1Elems != ShadowElements.end() && V2Elems != ShadowElements.end()) {
- if (std::includes(V1Elems->second.begin(), V1Elems->second.end(),
- V2Elems->second.begin(), V2Elems->second.end())) {
+ if (llvm::includes(V1Elems->second, V2Elems->second)) {
return collapseToPrimitiveShadow(V1, Pos);
}
- if (std::includes(V2Elems->second.begin(), V2Elems->second.end(),
- V1Elems->second.begin(), V1Elems->second.end())) {
+ if (llvm::includes(V2Elems->second, V1Elems->second)) {
return collapseToPrimitiveShadow(V2, Pos);
}
} else if (V1Elems != ShadowElements.end()) {
diff --git a/llvm/tools/sancov/sancov.cpp b/llvm/tools/sancov/sancov.cpp
index 2cc84b47de6b9..aebb5effd0be7 100644
--- a/llvm/tools/sancov/sancov.cpp
+++ b/llvm/tools/sancov/sancov.cpp
@@ -889,8 +889,7 @@ symbolize(const RawCoverage &Data, const std::string ObjectFile) {
}
std::set<uint64_t> AllAddrs = findCoveragePointAddrs(ObjectFile);
- if (!std::includes(AllAddrs.begin(), AllAddrs.end(), Data.Addrs->begin(),
- Data.Addrs->end())) {
+ if (!llvm::includes(AllAddrs, *Data.Addrs)) {
fail("Coverage points in binary and .sancov file do not match.");
}
Coverage->Points = getCoveragePoints(ObjectFile, AllAddrs, *Data.Addrs);
diff --git a/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp b/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
index 66a67d96d1532..f543947899393 100644
--- a/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
+++ b/llvm/unittests/ADT/DAGDeltaAlgorithmTest.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/DAGDeltaAlgorithm.h"
+#include "llvm/ADT/STLExtras.h"
#include "gtest/gtest.h"
#include <algorithm>
#include <cstdarg>
@@ -23,8 +24,7 @@ class FixedDAGDeltaAlgorithm : public DAGDeltaAlgorithm {
protected:
bool ExecuteOneTest(const changeset_ty &Changes) override {
++NumTests;
- return std::includes(Changes.begin(), Changes.end(),
- FailingSet.begin(), FailingSet.end());
+ return llvm::includes(Changes, FailingSet);
}
public:
diff --git a/llvm/unittests/ADT/DeltaAlgorithmTest.cpp b/llvm/unittests/ADT/DeltaAlgorithmTest.cpp
index 5e284129180a0..24e18f42eb33c 100644
--- a/llvm/unittests/ADT/DeltaAlgorithmTest.cpp
+++ b/llvm/unittests/ADT/DeltaAlgorithmTest.cpp
@@ -7,6 +7,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/DeltaAlgorithm.h"
+#include "llvm/ADT/STLExtras.h"
#include "gtest/gtest.h"
#include <algorithm>
#include <cstdarg>
@@ -38,8 +39,7 @@ class FixedDeltaAlgorithm final : public DeltaAlgorithm {
protected:
bool ExecuteOneTest(const changeset_ty &Changes) override {
++NumTests;
- return std::includes(Changes.begin(), Changes.end(),
- FailingSet.begin(), FailingSet.end());
+ return llvm::includes(Changes, FailingSet);
}
public:
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
index 9792eb41ea5d7..32098e96ce721 100644
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
@@ -1330,8 +1330,7 @@ void AsmMatcherInfo::buildRegisterClasses(
for (const RegisterSet &RS : RegisterSets) {
ClassInfo *CI = RegisterSetClasses[RS];
for (const RegisterSet &RS2 : RegisterSets)
- if (RS != RS2 && std::includes(RS2.begin(), RS2.end(), RS.begin(),
- RS.end(), LessRecordByID()))
+ if (RS != RS2 && llvm::includes(RS2, RS, LessRecordByID()))
CI->SuperClasses.push_back(RegisterSetClasses[RS2]);
}
diff --git a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
index 4d24eb3de1ed9..f52c21e97f9c8 100644
--- a/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
+++ b/llvm/utils/TableGen/Common/CodeGenRegisters.cpp
@@ -933,9 +933,7 @@ bool CodeGenRegisterClass::Key::operator<(
static bool testSubClass(const CodeGenRegisterClass *A,
const CodeGenRegisterClass *B) {
return A->RSI.isSubClassOf(B->RSI) &&
- std::includes(A->getMembers().begin(), A->getMembers().end(),
- B->getMembers().begin(), B->getMembers().end(),
- deref<std::less<>>());
+ llvm::includes(A->getMembers(), B->getMembers(), deref<std::less<>>());
}
/// Sorting predicate for register classes. This provides a topological
@@ -1990,8 +1988,7 @@ findRegUnitSet(const std::vector<RegUnitSet> &UniqueSets,
// Return true if the RUSubSet is a subset of RUSuperSet.
static bool isRegUnitSubSet(const std::vector<unsigned> &RUSubSet,
const std::vector<unsigned> &RUSuperSet) {
- return std::includes(RUSuperSet.begin(), RUSuperSet.end(), RUSubSet.begin(),
- RUSubSet.end());
+ return llvm::includes(RUSuperSet, RUSubSet);
}
/// Iteratively prune unit sets. Prune subsets that are close to the superset,
More information about the llvm-commits
mailing list