[llvm] 79787b9 - [ADT, CSSPGO] Specify set comparer
Harald van Dijk via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 24 16:58:57 PST 2022
Author: Harald van Dijk
Date: 2022-02-25T00:58:50Z
New Revision: 79787b903d159541ab62d8aa61d4059f86ea307d
URL: https://github.com/llvm/llvm-project/commit/79787b903d159541ab62d8aa61d4059f86ea307d
DIFF: https://github.com/llvm/llvm-project/commit/79787b903d159541ab62d8aa61d4059f86ea307d.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/ADT/EquivalenceClasses.h
llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/EquivalenceClasses.h b/llvm/include/llvm/ADT/EquivalenceClasses.h
index f12b683ead2d6..4f98b84cf97d2 100644
--- a/llvm/include/llvm/ADT/EquivalenceClasses.h
+++ b/llvm/include/llvm/ADT/EquivalenceClasses.h
@@ -161,7 +161,8 @@ class EquivalenceClasses {
//
/// 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(); }
diff --git a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
index 893654650caa3..5195d4c89d6ee 100644
--- a/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
+++ b/llvm/include/llvm/Transforms/IPO/ProfiledCallGraph.h
@@ -51,10 +51,10 @@ struct ProfiledCallGraphNode {
}
};
- using iterator = std::set<ProfiledCallGraphEdge>::iterator;
- using const_iterator = std::set<ProfiledCallGraphEdge>::const_iterator;
using edge = ProfiledCallGraphEdge;
- using edges = std::set<ProfiledCallGraphEdge, ProfiledCallGraphEdgeComparer>;
+ using edges = std::set<edge, ProfiledCallGraphEdgeComparer>;
+ using iterator = edges::iterator;
+ using const_iterator = edges::const_iterator;
ProfiledCallGraphNode(StringRef FName = StringRef()) : Name(FName) {}
@@ -64,7 +64,7 @@ struct ProfiledCallGraphNode {
class ProfiledCallGraph {
public:
- using iterator = std::set<ProfiledCallGraphEdge>::iterator;
+ using iterator = ProfiledCallGraphNode::iterator;
// Constructor for non-CS profile.
ProfiledCallGraph(SampleProfileMap &ProfileMap) {
More information about the llvm-commits
mailing list