Skip to content

[Format] Use llvm::min_element (NFC) #143725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kazutakahirata
Copy link
Contributor

llvm::min_elements allows us to pass a range.

llvm::min_elements allows us to pass a range.
@llvmbot
Copy link
Member

llvmbot commented Jun 11, 2025

@llvm/pr-subscribers-clang-format

Author: Kazu Hirata (kazutakahirata)

Changes

llvm::min_elements allows us to pass a range.


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

1 Files Affected:

  • (modified) clang/lib/Format/MacroCallReconstructor.cpp (+4-4)
diff --git a/clang/lib/Format/MacroCallReconstructor.cpp b/clang/lib/Format/MacroCallReconstructor.cpp
index 116bbad320e1f..895d9f93dfce3 100644
--- a/clang/lib/Format/MacroCallReconstructor.cpp
+++ b/clang/lib/Format/MacroCallReconstructor.cpp
@@ -528,10 +528,10 @@ MacroCallReconstructor::createUnwrappedLine(const ReconstructedLine &Line,
       // 1. One level below the current line's level.
       // 2. At the correct level relative to each other.
       unsigned MinChildLevel =
-          std::min_element(N->Children.begin(), N->Children.end(),
-                           [](const auto &E1, const auto &E2) {
-                             return E1->Level < E2->Level;
-                           })
+          llvm::min_element(N->Children,
+                            [](const auto &E1, const auto &E2) {
+                              return E1->Level < E2->Level;
+                            })
               ->get()
               ->Level;
       for (const auto &Child : N->Children) {

@kazutakahirata kazutakahirata merged commit e266d6a into llvm:main Jun 11, 2025
9 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250611_llvm_min_element_clang branch June 11, 2025 19:50
tomtor pushed a commit to tomtor/llvm-project that referenced this pull request Jun 14, 2025
llvm::min_elements allows us to pass a range.
akuhlens pushed a commit to akuhlens/llvm-project that referenced this pull request Jun 24, 2025
llvm::min_elements allows us to pass a range.
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.

3 participants