[llvm] [NFC][YAML] Replace iterators with simple getter (PR #130449)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 8 16:21:57 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
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
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 {
``````````
</details>
https://github.com/llvm/llvm-project/pull/130449
More information about the llvm-commits
mailing list