Skip to content

Commit 3b672e1

Browse files
[llvm] Use "= delete" to delete constructors (NFC) (#144938)
None of the constructors touched in this patch has a corresponding definition. This patch explicitly deletes them with "= delete" while moving them to the public section of respective classes. Note that "= delete" itself serves as documentation. Identified with modernize-use-equals-delete.
1 parent 7349864 commit 3b672e1

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

llvm/unittests/ADT/TestGraph.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@ namespace llvm {
2424
template <unsigned N>
2525
class Graph {
2626
private:
27-
// Disable copying.
28-
Graph(const Graph&);
29-
Graph& operator=(const Graph&);
30-
3127
static void ValidateIndex(unsigned Idx) {
3228
assert(Idx < N && "Invalid node index!");
3329
}
3430
public:
31+
// Disable copying.
32+
Graph(const Graph &) = delete;
33+
Graph &operator=(const Graph &) = delete;
3534

3635
/// NodeSubset - A subset of the graph's nodes.
3736
class NodeSubset {
@@ -169,11 +168,12 @@ class Graph {
169168
/// yet been visited.
170169
NodeSubset Children;
171170

172-
ChildIterator(); // Disable default constructor.
173171
protected:
174172
ChildIterator(NodeType *F, NodeSubset C) : FirstNode(F), Children(C) {}
175173

176174
public:
175+
ChildIterator() = delete; // Disable default constructor.
176+
177177
/// ChildIterator - Copy constructor.
178178
ChildIterator(const ChildIterator &other) = default;
179179
ChildIterator &operator=(const ChildIterator &other) = default;

llvm/unittests/Support/Casting.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ template <typename T> IllegalCast *cast(...) { return nullptr; }
2424
//
2525
struct bar {
2626
bar() {}
27+
bar(const bar &) = delete;
2728
struct foo *baz();
2829
struct foo *caz();
2930
struct foo *daz();
3031
struct foo *naz();
31-
32-
private:
33-
bar(const bar &);
3432
};
3533
struct foo {
3634
foo(const bar &) {}

0 commit comments

Comments
 (0)