aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-05-18 07:33:35 -0700
committerGitHub <noreply@github.com>2025-05-18 07:33:35 -0700
commit4388f38fbd9a0e6e55d5233cefa3e4ac3d8815d9 (patch)
tree1d474f4de627dae0fcbc61995213d4aca991fb53
parent013c7ba78590badf20d769a2de13bddabcfb1c5d (diff)
downloadllvm-4388f38fbd9a0e6e55d5233cefa3e4ac3d8815d9.zip
llvm-4388f38fbd9a0e6e55d5233cefa3e4ac3d8815d9.tar.gz
llvm-4388f38fbd9a0e6e55d5233cefa3e4ac3d8815d9.tar.bz2
[clang] Use llvm::max_element (NFC) (#140435)
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp3
-rw-r--r--clang/lib/CodeGen/CodeGenPGO.cpp2
-rw-r--r--clang/lib/Sema/SemaCUDA.cpp7
-rw-r--r--clang/utils/TableGen/ClangOptionDocEmitter.cpp5
4 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 918b064..df6edee 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -10532,8 +10532,7 @@ getNDSWDS(const FunctionDecl *FD, ArrayRef<ParamAttrTy> ParamAttrs) {
}) &&
"Invalid size");
- return std::make_tuple(*std::min_element(std::begin(Sizes), std::end(Sizes)),
- *std::max_element(std::begin(Sizes), std::end(Sizes)),
+ return std::make_tuple(*llvm::min_element(Sizes), *llvm::max_element(Sizes),
OutputBecomesInput);
}
diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp
index afa1d88..8197c5f 100644
--- a/clang/lib/CodeGen/CodeGenPGO.cpp
+++ b/clang/lib/CodeGen/CodeGenPGO.cpp
@@ -1486,7 +1486,7 @@ CodeGenFunction::createProfileWeights(ArrayRef<uint64_t> Weights) const {
return nullptr;
// Check for empty weights.
- uint64_t MaxWeight = *std::max_element(Weights.begin(), Weights.end());
+ uint64_t MaxWeight = *llvm::max_element(Weights);
if (MaxWeight == 0)
return nullptr;
diff --git a/clang/lib/Sema/SemaCUDA.cpp b/clang/lib/Sema/SemaCUDA.cpp
index 4559506..176d932 100644
--- a/clang/lib/Sema/SemaCUDA.cpp
+++ b/clang/lib/Sema/SemaCUDA.cpp
@@ -330,9 +330,10 @@ void SemaCUDA::EraseUnwantedMatches(
};
// Find the best call preference among the functions in Matches.
- CUDAFunctionPreference BestCFP = GetCFP(*std::max_element(
- Matches.begin(), Matches.end(),
- [&](const Pair &M1, const Pair &M2) { return GetCFP(M1) < GetCFP(M2); }));
+ CUDAFunctionPreference BestCFP =
+ GetCFP(*llvm::max_element(Matches, [&](const Pair &M1, const Pair &M2) {
+ return GetCFP(M1) < GetCFP(M2);
+ }));
// Erase all functions with lower priority.
llvm::erase_if(Matches,
diff --git a/clang/utils/TableGen/ClangOptionDocEmitter.cpp b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
index b651820..e39b8c9 100644
--- a/clang/utils/TableGen/ClangOptionDocEmitter.cpp
+++ b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
@@ -336,9 +336,8 @@ void emitOption(const DocumentedOption &Option, const Record *DocInfo,
});
assert(!SphinxOptionIDs.empty() && "no flags for option");
static std::map<std::string, int> NextSuffix;
- int SphinxWorkaroundSuffix = NextSuffix[*std::max_element(
- SphinxOptionIDs.begin(), SphinxOptionIDs.end(),
- [&](const std::string &A, const std::string &B) {
+ int SphinxWorkaroundSuffix = NextSuffix[*llvm::max_element(
+ SphinxOptionIDs, [&](const std::string &A, const std::string &B) {
return NextSuffix[A] < NextSuffix[B];
})];
for (auto &S : SphinxOptionIDs)