Skip to content

[Basic] Use llvm::erase_if (NFC) #140309

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

No description provided.

@kazutakahirata kazutakahirata requested review from arsenm and shiltian May 16, 2025 21:20
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels May 16, 2025
@llvmbot
Copy link
Member

llvmbot commented May 16, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) clang/lib/Basic/Diagnostic.cpp (+1-4)
diff --git a/clang/lib/Basic/Diagnostic.cpp b/clang/lib/Basic/Diagnostic.cpp
index 586273ab88bd3..a23ac7794d86c 100644
--- a/clang/lib/Basic/Diagnostic.cpp
+++ b/clang/lib/Basic/Diagnostic.cpp
@@ -535,10 +535,7 @@ void WarningsSpecialCaseList::processSections(DiagnosticsEngine &Diags) {
   // FIXME: We should make this configurable in the parser instead.
   // FIXME: C++20 can use std::erase_if(Sections, [](Section &sec) { return
   // sec.SectionStr == "*"; });
-  Sections.erase(
-      std::remove_if(Sections.begin(), Sections.end(),
-                     [](Section &sec) { return sec.SectionStr == "*"; }),
-      Sections.end());
+  llvm::erase_if(Sections, [](Section &sec) { return sec.SectionStr == "*"; });
   // Make sure we iterate sections by their line numbers.
   std::vector<std::pair<unsigned, const Section *>> LineAndSectionEntry;
   LineAndSectionEntry.reserve(Sections.size());

@kazutakahirata kazutakahirata merged commit dd4b69f into llvm:main May 16, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_std_erase_if_clang_Basic branch May 16, 2025 22:08
ajaden-codes pushed a commit to Jaddyen/llvm-project that referenced this pull request Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants