[llvm] 58ace30 - [NFC][YAML] Replace iterators with simple getter (#130449)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 8 19:16:26 PST 2025
Author: Vitaly Buka
Date: 2025-03-08T19:16:23-08:00
New Revision: 58ace30ebcd2cf2a34272fafe556a99473492b39
URL: https://github.com/llvm/llvm-project/commit/58ace30ebcd2cf2a34272fafe556a99473492b39
DIFF: https://github.com/llvm/llvm-project/commit/58ace30ebcd2cf2a34272fafe556a99473492b39.diff
LOG: [NFC][YAML] Replace iterators with simple getter (#130449)
To simplify #130382.
Added:
Modified:
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
Removed:
################################################################################
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 {
More information about the llvm-commits
mailing list