Skip to content

Conversation

vitalybuka
Copy link
Collaborator

To simplify #130382.

Created using spr 1.3.4
@llvmbot llvmbot added the llvm:ir label Mar 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 9, 2025

@llvm/pr-subscribers-llvm-ir

Author: Vitaly Buka (vitalybuka)

Changes

To simplify #130382.


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

2 Files Affected:

  • (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+2)
  • (modified) llvm/include/llvm/IR/ModuleSummaryIndexYAML.h (+2-4)
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 2183675d84e84..396a3fddf4f6b 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1324,6 +1324,8 @@ class CfiFunctionIndex {
     return Index.end();
   }
 
+  std::vector<StringRef> symbols() const { return {begin(), end()}; }
+
   GUIDIterator guid_begin() const { return GUIDIterator(Index.begin()); }
   GUIDIterator guid_end() const { return GUIDIterator(Index.end()); }
   iterator_range<GUIDIterator> guids() const {
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
index b662013d1f998..d5a91763a981c 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
@@ -347,12 +347,10 @@ template <> struct MappingTraits<ModuleSummaryIndex> {
                    index.WithGlobalValueDeadStripping);
 
     if (io.outputting()) {
-      std::vector<StringRef> CfiFunctionDefs(index.CfiFunctionDefs.begin(),
-                                             index.CfiFunctionDefs.end());
+      auto CfiFunctionDefs = index.CfiFunctionDefs.symbols();
       llvm::sort(CfiFunctionDefs);
       io.mapOptional("CfiFunctionDefs", CfiFunctionDefs);
-      std::vector<StringRef> CfiFunctionDecls(index.CfiFunctionDecls.begin(),
-                                              index.CfiFunctionDecls.end());
+      auto CfiFunctionDecls(index.CfiFunctionDecls.symbols());
       llvm::sort(CfiFunctionDecls);
       io.mapOptional("CfiFunctionDecls", CfiFunctionDecls);
     } else {

Created using spr 1.3.4
Created using spr 1.3.4
@vitalybuka vitalybuka requested a review from thurstond March 9, 2025 02:04
@vitalybuka vitalybuka merged commit 58ace30 into main Mar 9, 2025
11 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/nfcyaml-replace-iterators-with-simple-getter branch March 9, 2025 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants