Skip to content

Commit 133ac3a

Browse files
[ADT] Achieve the "Rule of Zero" in DGNode (#165190)
This patch achieves the "Rule of Zero" in DGNode by removing the copy/move constructors and copy/move assignment operators. Note that the code being deleted does a couple of unusual things that are most likely oversight: - The copy constructor with "explicit" is highly unusual. This means that we allow "DGNode<N, E> A(B);" but disallow "DGNode<N, E> A = B;". - The move assignment operator with const r-value reference is also unusual, especially given that the move constructor is correctly implemented.
1 parent 0e28c9b commit 133ac3a

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

llvm/include/llvm/ADT/DirectedGraph.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,6 @@ template <class NodeType, class EdgeType> class DGNode {
8080
explicit DGNode(EdgeType &E) : Edges() { Edges.insert(&E); }
8181
DGNode() = default;
8282

83-
explicit DGNode(const DGNode<NodeType, EdgeType> &N) : Edges(N.Edges) {}
84-
DGNode(DGNode<NodeType, EdgeType> &&N) : Edges(std::move(N.Edges)) {}
85-
86-
DGNode<NodeType, EdgeType> &operator=(const DGNode<NodeType, EdgeType> &N) {
87-
Edges = N.Edges;
88-
return *this;
89-
}
90-
DGNode<NodeType, EdgeType> &operator=(const DGNode<NodeType, EdgeType> &&N) {
91-
Edges = std::move(N.Edges);
92-
return *this;
93-
}
94-
9583
/// Static polymorphism: delegate implementation (via isEqualTo) to the
9684
/// derived class.
9785
friend bool operator==(const NodeType &M, const NodeType &N) {

0 commit comments

Comments
 (0)