Skip to content

Commit 4388f38

Browse files
[clang] Use llvm::max_element (NFC) (llvm#140435)
1 parent 013c7ba commit 4388f38

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10532,8 +10532,7 @@ getNDSWDS(const FunctionDecl *FD, ArrayRef<ParamAttrTy> ParamAttrs) {
1053210532
}) &&
1053310533
"Invalid size");
1053410534

10535-
return std::make_tuple(*std::min_element(std::begin(Sizes), std::end(Sizes)),
10536-
*std::max_element(std::begin(Sizes), std::end(Sizes)),
10535+
return std::make_tuple(*llvm::min_element(Sizes), *llvm::max_element(Sizes),
1053710536
OutputBecomesInput);
1053810537
}
1053910538

clang/lib/CodeGen/CodeGenPGO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ CodeGenFunction::createProfileWeights(ArrayRef<uint64_t> Weights) const {
14861486
return nullptr;
14871487

14881488
// Check for empty weights.
1489-
uint64_t MaxWeight = *std::max_element(Weights.begin(), Weights.end());
1489+
uint64_t MaxWeight = *llvm::max_element(Weights);
14901490
if (MaxWeight == 0)
14911491
return nullptr;
14921492

clang/lib/Sema/SemaCUDA.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,10 @@ void SemaCUDA::EraseUnwantedMatches(
330330
};
331331

332332
// Find the best call preference among the functions in Matches.
333-
CUDAFunctionPreference BestCFP = GetCFP(*std::max_element(
334-
Matches.begin(), Matches.end(),
335-
[&](const Pair &M1, const Pair &M2) { return GetCFP(M1) < GetCFP(M2); }));
333+
CUDAFunctionPreference BestCFP =
334+
GetCFP(*llvm::max_element(Matches, [&](const Pair &M1, const Pair &M2) {
335+
return GetCFP(M1) < GetCFP(M2);
336+
}));
336337

337338
// Erase all functions with lower priority.
338339
llvm::erase_if(Matches,

clang/utils/TableGen/ClangOptionDocEmitter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,8 @@ void emitOption(const DocumentedOption &Option, const Record *DocInfo,
336336
});
337337
assert(!SphinxOptionIDs.empty() && "no flags for option");
338338
static std::map<std::string, int> NextSuffix;
339-
int SphinxWorkaroundSuffix = NextSuffix[*std::max_element(
340-
SphinxOptionIDs.begin(), SphinxOptionIDs.end(),
341-
[&](const std::string &A, const std::string &B) {
339+
int SphinxWorkaroundSuffix = NextSuffix[*llvm::max_element(
340+
SphinxOptionIDs, [&](const std::string &A, const std::string &B) {
342341
return NextSuffix[A] < NextSuffix[B];
343342
})];
344343
for (auto &S : SphinxOptionIDs)

0 commit comments

Comments
 (0)