Skip to content

Commit 79787b9

Browse files
committed
[ADT, CSSPGO] Specify set comparer
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. Reviewed By: hoy Differential Revision: https://reviews.llvm.org/D119798
1 parent 48f8a7c commit 79787b9

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

llvm/include/llvm/ADT/EquivalenceClasses.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ class EquivalenceClasses {
161161
//
162162

163163
/// iterator* - Provides a way to iterate over all values in the set.
164-
using iterator = typename std::set<ECValue>::const_iterator;
164+
using iterator =
165+
typename std::set<ECValue, ECValueComparator>::const_iterator;
165166

166167
iterator begin() const { return TheMapping.begin(); }
167168
iterator end() const { return TheMapping.end(); }

llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ struct ProfiledCallGraphNode {
5151
}
5252
};
5353

54-
using iterator = std::set<ProfiledCallGraphEdge>::iterator;
55-
using const_iterator = std::set<ProfiledCallGraphEdge>::const_iterator;
5654
using edge = ProfiledCallGraphEdge;
57-
using edges = std::set<ProfiledCallGraphEdge, ProfiledCallGraphEdgeComparer>;
55+
using edges = std::set<edge, ProfiledCallGraphEdgeComparer>;
56+
using iterator = edges::iterator;
57+
using const_iterator = edges::const_iterator;
5858

5959
ProfiledCallGraphNode(StringRef FName = StringRef()) : Name(FName) {}
6060

@@ -64,7 +64,7 @@ struct ProfiledCallGraphNode {
6464

6565
class ProfiledCallGraph {
6666
public:
67-
using iterator = std::set<ProfiledCallGraphEdge>::iterator;
67+
using iterator = ProfiledCallGraphNode::iterator;
6868

6969
// Constructor for non-CS profile.
7070
ProfiledCallGraph(SampleProfileMap &ProfileMap) {

0 commit comments

Comments
 (0)