Skip to content

Commit 7f1e056

Browse files
committed
Revert "Remove the explicit SDNodeIterator::operator= in favor of the implicit default"
Accidentally committed a few more of these cleanup changes than intended. Still breaking these out & tidying them up. This reverts commit r231135. llvm-svn: 231136
1 parent bb8da4c commit 7f1e056

23 files changed

+60
-91
lines changed

llvm/include/llvm/Analysis/CallGraph.h

-6
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,6 @@ class CallGraph {
104104

105105
public:
106106
CallGraph(Module &M);
107-
// Copyable for syntax's sake, but rely on RVO such that this is never called.
108-
// Should really make this type legitimately movable instead, possibly my
109-
// making FunctionMap values and the CallsExternalCode member unique_ptrs,
110-
// then adding some internal helper objects that can call
111-
// "allReferencesDropped" on those elements before their final destruction.
112-
CallGraph(const CallGraph&);
113107
~CallGraph();
114108

115109
void print(raw_ostream &OS) const;

llvm/include/llvm/Analysis/IntervalIterator.h

-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ class IntervalIterator {
104104
llvm_unreachable("ProcessInterval should never fail for first interval!");
105105
}
106106
}
107-
// Declare but don't define, rely on RVO to optimize this away.
108-
IntervalIterator(const IntervalIterator&);
109107

110108
IntervalIterator(IntervalPartition &IP, bool OwnMemory) : IOwnMem(OwnMemory) {
111109
OrigContainer = &IP;

llvm/include/llvm/Analysis/RegionIterator.h

-4
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,6 @@ class RNSuccIterator : public std::iterator<std::forward_iterator_tag,
146146
return tmp;
147147
}
148148

149-
RNSuccIterator(const RNSuccIterator&) = default;
150-
151149
inline const Self &operator=(const Self &I) {
152150
if (this != &I) {
153151
assert(getNode()->getParent() == I.getNode()->getParent()
@@ -243,8 +241,6 @@ class RNSuccIterator<FlatIt<NodeType>, BlockT, RegionT>
243241
return tmp;
244242
}
245243

246-
RNSuccIterator(const RNSuccIterator&) = default;
247-
248244
inline const Self &operator=(const Self &I) {
249245
if (this != &I) {
250246
assert(Node->getParent() == I.Node->getParent()

llvm/include/llvm/CodeGen/LiveInterval.h

+11-5
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ namespace llvm {
199199
// of live ranges of physical registers in computeRegUnitRange.
200200
// After that the set is flushed to the segment vector and deleted.
201201
typedef std::set<Segment> SegmentSet;
202-
std::unique_ptr<SegmentSet> segmentSet;
202+
SegmentSet *segmentSet;
203203

204204
typedef Segments::iterator iterator;
205205
iterator begin() { return segments.begin(); }
@@ -218,13 +218,15 @@ namespace llvm {
218218
const_vni_iterator vni_end() const { return valnos.end(); }
219219

220220
/// Constructs a new LiveRange object.
221-
LiveRange(bool UseSegmentSet = false)
222-
: segmentSet(UseSegmentSet ? llvm::make_unique<SegmentSet>()
223-
: nullptr) {}
221+
LiveRange(bool UseSegmentSet = false) : segmentSet(nullptr) {
222+
if (UseSegmentSet)
223+
segmentSet = new SegmentSet();
224+
}
224225

225226
/// Constructs a new LiveRange object by copying segments and valnos from
226227
/// another LiveRange.
227-
LiveRange(const LiveRange &Other, BumpPtrAllocator &Allocator) {
228+
LiveRange(const LiveRange &Other, BumpPtrAllocator &Allocator)
229+
: segmentSet(nullptr) {
228230
assert(Other.segmentSet == nullptr &&
229231
"Copying of LiveRanges with active SegmentSets is not supported");
230232

@@ -238,6 +240,8 @@ namespace llvm {
238240
}
239241
}
240242

243+
~LiveRange() { delete segmentSet; }
244+
241245
/// advanceTo - Advance the specified iterator to point to the Segment
242246
/// containing the specified position, or end() if the position is past the
243247
/// end of the range. If no Segment contains this position, but the
@@ -741,6 +745,8 @@ namespace llvm {
741745
#endif
742746

743747
private:
748+
LiveInterval& operator=(const LiveInterval& rhs) = delete;
749+
744750
/// Appends @p Range to SubRanges list.
745751
void appendSubRange(SubRange *Range) {
746752
Range->Next = SubRanges;

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

+6
Original file line numberDiff line numberDiff line change
@@ -2063,6 +2063,12 @@ class SDNodeIterator : public std::iterator<std::forward_iterator_tag,
20632063
}
20642064
bool operator!=(const SDNodeIterator& x) const { return !operator==(x); }
20652065

2066+
const SDNodeIterator &operator=(const SDNodeIterator &I) {
2067+
assert(I.Node == Node && "Cannot assign iterators to two different nodes!");
2068+
Operand = I.Operand;
2069+
return *this;
2070+
}
2071+
20662072
pointer operator*() const {
20672073
return Node->getOperand(Operand).getNode();
20682074
}

llvm/include/llvm/IR/CFG.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,11 @@ class SuccIterator : public std::iterator<std::random_access_iterator_tag, BB_,
132132
/// \brief Proxy object to allow write access in operator[]
133133
class SuccessorProxy {
134134
Self it;
135-
friend class SuccIterator;
136-
SuccessorProxy(const SuccessorProxy&) = default;
137135

138136
public:
139137
explicit SuccessorProxy(const Self &it) : it(it) {}
140138

141-
SuccessorProxy &operator=(const SuccessorProxy &r) {
139+
SuccessorProxy &operator=(SuccessorProxy r) {
142140
*this = reference(r);
143141
return *this;
144142
}
@@ -167,8 +165,6 @@ class SuccIterator : public std::iterator<std::random_access_iterator_tag, BB_,
167165
idx = 0;
168166
}
169167

170-
SuccIterator(const SuccIterator&) = default;
171-
172168
inline const Self &operator=(const Self &I) {
173169
assert(Term == I.Term &&"Cannot assign iterators to two different blocks!");
174170
idx = I.idx;

llvm/include/llvm/IR/ValueHandle.h

+2-7
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ class ValueHandleBase {
5151
Tracking,
5252
Weak
5353
};
54-
ValueHandleBase(const ValueHandleBase&) = default;
5554

5655
private:
5756
PointerIntPair<ValueHandleBase**, 2, HandleBaseKind> PrevPair;
5857
ValueHandleBase *Next;
5958

6059
Value* V;
6160

61+
ValueHandleBase(const ValueHandleBase&) = delete;
6262
public:
6363
explicit ValueHandleBase(HandleBaseKind Kind)
6464
: PrevPair(nullptr, Kind), Next(nullptr), V(nullptr) {}
@@ -144,10 +144,6 @@ class WeakVH : public ValueHandleBase {
144144
WeakVH(Value *P) : ValueHandleBase(Weak, P) {}
145145
WeakVH(const WeakVH &RHS)
146146
: ValueHandleBase(Weak, RHS) {}
147-
// Questionable - these are stored in a vector in AssumptionCache (perhaps
148-
// other copies too) and need to be copied. When copied, how would they
149-
// properly insert into the use list?
150-
WeakVH&operator=(const WeakVH &RHS) = default;
151147

152148
Value *operator=(Value *RHS) {
153149
return ValueHandleBase::operator=(RHS);
@@ -349,8 +345,7 @@ class CallbackVH : public ValueHandleBase {
349345
CallbackVH(const CallbackVH &RHS)
350346
: ValueHandleBase(Callback, RHS) {}
351347

352-
virtual ~CallbackVH() = default;
353-
CallbackVH &operator=(const CallbackVH &) = default;
348+
virtual ~CallbackVH() {}
354349

355350
void setValPtr(Value *P) {
356351
ValueHandleBase::operator=(P);

llvm/include/llvm/MC/MCContext.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ namespace llvm {
477477
/// allocator supports it).
478478
/// @return The allocated memory. Could be NULL.
479479
inline void *operator new(size_t Bytes, llvm::MCContext &C,
480-
size_t Alignment = 16) LLVM_NOEXCEPT {
480+
size_t Alignment = 16) throw () {
481481
return C.Allocate(Bytes, Alignment);
482482
}
483483
/// @brief Placement delete companion to the new above.
@@ -487,7 +487,7 @@ inline void *operator new(size_t Bytes, llvm::MCContext &C,
487487
/// is called implicitly by the compiler if a placement new expression using
488488
/// the MCContext throws in the object constructor.
489489
inline void operator delete(void *Ptr, llvm::MCContext &C, size_t)
490-
LLVM_NOEXCEPT {
490+
throw () {
491491
C.Deallocate(Ptr);
492492
}
493493

@@ -511,7 +511,7 @@ inline void operator delete(void *Ptr, llvm::MCContext &C, size_t)
511511
/// allocator supports it).
512512
/// @return The allocated memory. Could be NULL.
513513
inline void *operator new[](size_t Bytes, llvm::MCContext& C,
514-
size_t Alignment = 16) LLVM_NOEXCEPT {
514+
size_t Alignment = 16) throw () {
515515
return C.Allocate(Bytes, Alignment);
516516
}
517517

@@ -521,7 +521,7 @@ inline void *operator new[](size_t Bytes, llvm::MCContext& C,
521521
/// invoking it directly; see the new[] operator for more details. This operator
522522
/// is called implicitly by the compiler if a placement new[] expression using
523523
/// the MCContext throws in the object constructor.
524-
inline void operator delete[](void *Ptr, llvm::MCContext &C) LLVM_NOEXCEPT {
524+
inline void operator delete[](void *Ptr, llvm::MCContext &C) throw () {
525525
C.Deallocate(Ptr);
526526
}
527527

llvm/include/llvm/Support/CommandLine.h

+10-26
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,9 @@ struct cat {
352352

353353
// Support value comparison outside the template.
354354
struct GenericOptionValue {
355-
virtual ~GenericOptionValue() = default;
355+
virtual ~GenericOptionValue() {}
356356
virtual bool compare(const GenericOptionValue &V) const = 0;
357357

358-
protected:
359-
GenericOptionValue() = default;
360-
GenericOptionValue(const GenericOptionValue&) = default;
361-
GenericOptionValue &operator=(const GenericOptionValue &) = default;
362358
private:
363359
virtual void anchor();
364360
};
@@ -390,9 +386,6 @@ struct OptionValueBase : public GenericOptionValue {
390386
template <class DataType> class OptionValueCopy : public GenericOptionValue {
391387
DataType Value;
392388
bool Valid;
393-
protected:
394-
OptionValueCopy(const OptionValueCopy&) = default;
395-
OptionValueCopy &operator=(const OptionValueCopy&) = default;
396389

397390
public:
398391
OptionValueCopy() : Valid(false) {}
@@ -424,10 +417,6 @@ template <class DataType> class OptionValueCopy : public GenericOptionValue {
424417
template <class DataType>
425418
struct OptionValueBase<DataType, false> : OptionValueCopy<DataType> {
426419
typedef DataType WrapperType;
427-
protected:
428-
OptionValueBase() = default;
429-
OptionValueBase(const OptionValueBase&) = default;
430-
OptionValueBase &operator=(const OptionValueBase&) = default;
431420
};
432421

433422
// Top-level option class.
@@ -732,8 +721,6 @@ class basic_parser_impl { // non-template implementation of basic_parser<t>
732721
virtual void anchor();
733722

734723
protected:
735-
basic_parser_impl(const basic_parser_impl&) = default;
736-
737724
// A helper for basic_parser::printOptionDiff.
738725
void printOptionName(const Option &O, size_t GlobalWidth) const;
739726
};
@@ -742,9 +729,6 @@ class basic_parser_impl { // non-template implementation of basic_parser<t>
742729
// a typedef for the provided data type.
743730
//
744731
template <class DataType> class basic_parser : public basic_parser_impl {
745-
protected:
746-
// Workaround PR22763
747-
basic_parser(const basic_parser& RHS) : basic_parser_impl(RHS) {}
748732
public:
749733
basic_parser(Option &O) : basic_parser_impl(O) {}
750734
typedef DataType parser_data_type;
@@ -754,7 +738,7 @@ template <class DataType> class basic_parser : public basic_parser_impl {
754738
//--------------------------------------------------
755739
// parser<bool>
756740
//
757-
template <> class parser<bool> final : public basic_parser<bool> {
741+
template <> class parser<bool> : public basic_parser<bool> {
758742
public:
759743
parser(Option &O) : basic_parser(O) {}
760744

@@ -781,7 +765,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<bool>);
781765

782766
//--------------------------------------------------
783767
// parser<boolOrDefault>
784-
template <> class parser<boolOrDefault> final : public basic_parser<boolOrDefault> {
768+
template <> class parser<boolOrDefault> : public basic_parser<boolOrDefault> {
785769
public:
786770
parser(Option &O) : basic_parser(O) {}
787771

@@ -807,7 +791,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<boolOrDefault>);
807791
//--------------------------------------------------
808792
// parser<int>
809793
//
810-
template <> class parser<int> final : public basic_parser<int> {
794+
template <> class parser<int> : public basic_parser<int> {
811795
public:
812796
parser(Option &O) : basic_parser(O) {}
813797

@@ -829,7 +813,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<int>);
829813
//--------------------------------------------------
830814
// parser<unsigned>
831815
//
832-
template <> class parser<unsigned> final : public basic_parser<unsigned> {
816+
template <> class parser<unsigned> : public basic_parser<unsigned> {
833817
public:
834818
parser(Option &O) : basic_parser(O) {}
835819

@@ -852,7 +836,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<unsigned>);
852836
// parser<unsigned long long>
853837
//
854838
template <>
855-
class parser<unsigned long long> final : public basic_parser<unsigned long long> {
839+
class parser<unsigned long long> : public basic_parser<unsigned long long> {
856840
public:
857841
parser(Option &O) : basic_parser(O) {}
858842

@@ -875,7 +859,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<unsigned long long>);
875859
//--------------------------------------------------
876860
// parser<double>
877861
//
878-
template <> class parser<double> final : public basic_parser<double> {
862+
template <> class parser<double> : public basic_parser<double> {
879863
public:
880864
parser(Option &O) : basic_parser(O) {}
881865

@@ -897,7 +881,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<double>);
897881
//--------------------------------------------------
898882
// parser<float>
899883
//
900-
template <> class parser<float> final : public basic_parser<float> {
884+
template <> class parser<float> : public basic_parser<float> {
901885
public:
902886
parser(Option &O) : basic_parser(O) {}
903887

@@ -919,7 +903,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<float>);
919903
//--------------------------------------------------
920904
// parser<std::string>
921905
//
922-
template <> class parser<std::string> final : public basic_parser<std::string> {
906+
template <> class parser<std::string> : public basic_parser<std::string> {
923907
public:
924908
parser(Option &O) : basic_parser(O) {}
925909

@@ -944,7 +928,7 @@ EXTERN_TEMPLATE_INSTANTIATION(class basic_parser<std::string>);
944928
//--------------------------------------------------
945929
// parser<char>
946930
//
947-
template <> class parser<char> final : public basic_parser<char> {
931+
template <> class parser<char> : public basic_parser<char> {
948932
public:
949933
parser(Option &O) : basic_parser(O) {}
950934

llvm/include/llvm/Support/Format.h

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class format_object_base {
3838
protected:
3939
const char *Fmt;
4040
~format_object_base() {} // Disallow polymorphic deletion.
41-
format_object_base(const format_object_base&) = default;
4241
virtual void home(); // Out of line virtual method.
4342

4443
/// Call snprintf() for this object, on the given buffer and size.

llvm/include/llvm/Support/YAMLParser.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,19 @@ class Node {
145145
unsigned int getType() const { return TypeID; }
146146

147147
void *operator new(size_t Size, BumpPtrAllocator &Alloc,
148-
size_t Alignment = 16) LLVM_NOEXCEPT {
148+
size_t Alignment = 16) throw() {
149149
return Alloc.Allocate(Size, Alignment);
150150
}
151151

152-
void operator delete(void *Ptr, BumpPtrAllocator &Alloc, size_t Size) LLVM_NOEXCEPT {
152+
void operator delete(void *Ptr, BumpPtrAllocator &Alloc, size_t Size) throw() {
153153
Alloc.Deallocate(Ptr, Size);
154154
}
155155

156156
protected:
157157
std::unique_ptr<Document> &Doc;
158158
SMRange SourceRange;
159159

160-
void operator delete(void *) LLVM_NOEXCEPT {}
160+
void operator delete(void *) throw() {}
161161

162162
virtual ~Node() {}
163163

llvm/lib/Analysis/CFLAliasAnalysis.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,15 @@ struct FunctionInfo {
151151

152152
struct CFLAliasAnalysis;
153153

154-
struct FunctionHandle final : public CallbackVH {
154+
struct FunctionHandle : public CallbackVH {
155155
FunctionHandle(Function *Fn, CFLAliasAnalysis *CFLAA)
156156
: CallbackVH(Fn), CFLAA(CFLAA) {
157157
assert(Fn != nullptr);
158158
assert(CFLAA != nullptr);
159159
}
160160

161+
virtual ~FunctionHandle() {}
162+
161163
void deleted() override { removeSelfFromCache(); }
162164
void allUsesReplacedWith(Value *) override { removeSelfFromCache(); }
163165

0 commit comments

Comments
 (0)