[PATCH] D119798: [ADT, CSSPGO] Specify set comparer
Harald van Dijk via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 14 17:20:03 PST 2022
hvdijk created this revision.
hvdijk added reviewers: chandlerc, springerm, wenlei, hoy, ftynse.
Herald added subscribers: ormris, dexonsmith.
hvdijk requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
In _GLIBCXX_DEBUG builds, potentially implicitly enabled by LLVM_ENABLE_EXPENSIVE_CHECKS, std::set<A, B>::iterator and std::set<A, C>::iterator are distinct types that are not interconvertible. This change aligns the iterator types with the set types.
For ADT, this was added by D112052 <https://reviews.llvm.org/D112052>. For CSSPGO, this was added by D99146 <https://reviews.llvm.org/D99146>. Adding the authors/reviewers of those revisions in case they want to suggest a different way of fixing this.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D119798
Files:
llvm/include/llvm/ADT/EquivalenceClasses.h
llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
Index: llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
===================================================================
--- llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
+++ llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
@@ -51,8 +51,11 @@
}
};
- using iterator = std::set<ProfiledCallGraphEdge>::iterator;
- using const_iterator = std::set<ProfiledCallGraphEdge>::const_iterator;
+ using iterator =
+ std::set<ProfiledCallGraphEdge, ProfiledCallGraphEdgeComparer>::iterator;
+ using const_iterator =
+ std::set<ProfiledCallGraphEdge,
+ ProfiledCallGraphEdgeComparer>::const_iterator;
using edge = ProfiledCallGraphEdge;
using edges = std::set<ProfiledCallGraphEdge, ProfiledCallGraphEdgeComparer>;
@@ -64,7 +67,7 @@
class ProfiledCallGraph {
public:
- using iterator = std::set<ProfiledCallGraphEdge>::iterator;
+ using iterator = ProfiledCallGraphNode::iterator;
// Constructor for non-CS profile.
ProfiledCallGraph(SampleProfileMap &ProfileMap) {
Index: llvm/include/llvm/ADT/EquivalenceClasses.h
===================================================================
--- llvm/include/llvm/ADT/EquivalenceClasses.h
+++ llvm/include/llvm/ADT/EquivalenceClasses.h
@@ -161,7 +161,8 @@
//
/// iterator* - Provides a way to iterate over all values in the set.
- using iterator = typename std::set<ECValue>::const_iterator;
+ using iterator =
+ typename std::set<ECValue, ECValueComparator>::const_iterator;
iterator begin() const { return TheMapping.begin(); }
iterator end() const { return TheMapping.end(); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119798.408671.patch
Type: text/x-patch
Size: 1610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220215/bd674c1f/attachment.bin>
More information about the llvm-commits
mailing list