Skip to content

[Serialization] Use llvm::map_range (NFC) #135990

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 a review from kuhar April 16, 2025 16:55
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:modules C++20 modules and Clang Header Modules labels Apr 16, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 16, 2025

@llvm/pr-subscribers-clang-modules

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) clang/lib/Serialization/MultiOnDiskHashTable.h (+3-5)
diff --git a/clang/lib/Serialization/MultiOnDiskHashTable.h b/clang/lib/Serialization/MultiOnDiskHashTable.h
index fa18a29a9a98e..6378f1607d334 100644
--- a/clang/lib/Serialization/MultiOnDiskHashTable.h
+++ b/clang/lib/Serialization/MultiOnDiskHashTable.h
@@ -103,11 +103,9 @@ template<typename Info> class MultiOnDiskHashTable {
 
   /// The current set of on-disk tables.
   table_range tables() {
-    auto Begin = Tables.begin(), End = Tables.end();
-    if (getMergedTable())
-      ++Begin;
-    return llvm::make_range(llvm::map_iterator(Begin, AsOnDiskTable()),
-                            llvm::map_iterator(End, AsOnDiskTable()));
+    bool DropBegin = getMergedTable();
+    return llvm::map_range(llvm::drop_begin(Tables, DropBegin),
+                           AsOnDiskTable());
   }
 
   MergedTable *getMergedTable() const {

@kazutakahirata kazutakahirata merged commit 4863d1f into llvm:main Apr 16, 2025
9 of 11 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_map_range_clang_Serialization branch April 16, 2025 19:30
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:modules C++20 modules and Clang Header Modules clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants