[llvm] r203563 - Remove copy ctors that did the same thing as the default one.

David Blaikie dblaikie at gmail.com
Tue Mar 11 09:35:55 PDT 2014


On Tue, Mar 11, 2014 at 7:27 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
> Would it be possible to have a warning for this?

I'd love there to be a warning for this, personally.

Benjamin - how did you find all these instances? Any particular
tool/technique/approach?

>
> On 11 March 2014 07:32, Benjamin Kramer <benny.kra at googlemail.com> wrote:
>> Author: d0k
>> Date: Tue Mar 11 06:32:49 2014
>> New Revision: 203563
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=203563&view=rev
>> Log:
>> Remove copy ctors that did the same thing as the default one.
>>
>> The code added nothing but potentially disabled move semantics and made
>> types non-trivially copyable.
>>
>> Modified:
>>     llvm/trunk/include/llvm/ADT/EquivalenceClasses.h
>>     llvm/trunk/include/llvm/ADT/STLExtras.h
>>     llvm/trunk/include/llvm/ADT/SparseMultiSet.h
>>     llvm/trunk/include/llvm/Analysis/Interval.h
>>     llvm/trunk/include/llvm/IR/Attributes.h
>>     llvm/trunk/include/llvm/IR/InlineAsm.h
>>     llvm/trunk/include/llvm/IR/Metadata.h
>>     llvm/trunk/include/llvm/Object/RelocVisitor.h
>>     llvm/trunk/include/llvm/Support/TargetRegistry.h
>>     llvm/trunk/include/llvm/Target/TargetLowering.h
>>     llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
>>     llvm/trunk/lib/IR/InlineAsm.cpp
>>     llvm/trunk/utils/TableGen/CodeGenRegisters.h
>>
>> Modified: llvm/trunk/include/llvm/ADT/EquivalenceClasses.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/EquivalenceClasses.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/EquivalenceClasses.h (original)
>> +++ llvm/trunk/include/llvm/ADT/EquivalenceClasses.h Tue Mar 11 06:32:49 2014
>> @@ -249,7 +249,6 @@ public:
>>
>>      explicit member_iterator() {}
>>      explicit member_iterator(const ECValue *N) : Node(N) {}
>> -    member_iterator(const member_iterator &I) : Node(I.Node) {}
>>
>>      reference operator*() const {
>>        assert(Node != 0 && "Dereferencing end()!");
>>
>> Modified: llvm/trunk/include/llvm/ADT/STLExtras.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/STLExtras.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/STLExtras.h (original)
>> +++ llvm/trunk/include/llvm/ADT/STLExtras.h Tue Mar 11 06:32:49 2014
>> @@ -97,8 +97,6 @@ public:
>>
>>    inline explicit mapped_iterator(const RootIt &I, UnaryFunc F)
>>      : current(I), Fn(F) {}
>> -  inline mapped_iterator(const mapped_iterator &It)
>> -    : current(It.current), Fn(It.Fn) {}
>>
>>    inline value_type operator*() const {   // All this work to do this
>>      return Fn(*current);         // little change
>>
>> Modified: llvm/trunk/include/llvm/ADT/SparseMultiSet.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseMultiSet.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/SparseMultiSet.h (original)
>> +++ llvm/trunk/include/llvm/ADT/SparseMultiSet.h Tue Mar 11 06:32:49 2014
>> @@ -245,16 +245,6 @@ public:
>>      typedef typename super::pointer pointer;
>>      typedef typename super::reference reference;
>>
>> -    iterator_base(const iterator_base &RHS)
>> -      : SMS(RHS.SMS), Idx(RHS.Idx), SparseIdx(RHS.SparseIdx) { }
>> -
>> -    const iterator_base &operator=(const iterator_base &RHS) {
>> -      SMS = RHS.SMS;
>> -      Idx = RHS.Idx;
>> -      SparseIdx = RHS.SparseIdx;
>> -      return *this;
>> -    }
>> -
>>      reference operator*() const {
>>        assert(isKeyed() && SMS->sparseIndex(SMS->Dense[Idx].Data) == SparseIdx &&
>>               "Dereferencing iterator of invalid key or index");
>>
>> Modified: llvm/trunk/include/llvm/Analysis/Interval.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Interval.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Analysis/Interval.h (original)
>> +++ llvm/trunk/include/llvm/Analysis/Interval.h Tue Mar 11 06:32:49 2014
>> @@ -48,9 +48,6 @@ public:
>>      Nodes.push_back(Header);
>>    }
>>
>> -  inline Interval(const Interval &I) // copy ctor
>> -    : HeaderNode(I.HeaderNode), Nodes(I.Nodes), Successors(I.Successors) {}
>> -
>>    inline BasicBlock *getHeaderNode() const { return HeaderNode; }
>>
>>    /// Nodes - The basic blocks in this interval.
>>
>> Modified: llvm/trunk/include/llvm/IR/Attributes.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Attributes.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/IR/Attributes.h (original)
>> +++ llvm/trunk/include/llvm/IR/Attributes.h Tue Mar 11 06:32:49 2014
>> @@ -403,10 +403,6 @@ public:
>>      addAttribute(A);
>>    }
>>    AttrBuilder(AttributeSet AS, unsigned Idx);
>> -  AttrBuilder(const AttrBuilder &B)
>> -    : Attrs(B.Attrs),
>> -      TargetDepAttrs(B.TargetDepAttrs.begin(), B.TargetDepAttrs.end()),
>> -      Alignment(B.Alignment), StackAlignment(B.StackAlignment) {}
>>
>>    void clear();
>>
>>
>> Modified: llvm/trunk/include/llvm/IR/InlineAsm.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/InlineAsm.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/IR/InlineAsm.h (original)
>> +++ llvm/trunk/include/llvm/IR/InlineAsm.h Tue Mar 11 06:32:49 2014
>> @@ -164,9 +164,6 @@ public:
>>      ///Default constructor.
>>      ConstraintInfo();
>>
>> -    /// Copy constructor.
>> -    ConstraintInfo(const ConstraintInfo &other);
>> -
>>      /// Parse - Analyze the specified string (e.g. "=*&{eax}") and fill in the
>>      /// fields in this structure.  If the constraint string is not understood,
>>      /// return true, otherwise return false.
>>
>> Modified: llvm/trunk/include/llvm/IR/Metadata.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/IR/Metadata.h (original)
>> +++ llvm/trunk/include/llvm/IR/Metadata.h Tue Mar 11 06:32:49 2014
>> @@ -219,7 +219,6 @@ class NamedMDNode : public ilist_node<Na
>>
>>    public:
>>      op_iterator_impl() : Node(0), Idx(0) { }
>> -    op_iterator_impl(const op_iterator_impl &o) : Node(o.Node), Idx(o.Idx) { }
>>
>>      bool operator==(const op_iterator_impl &o) const { return Idx == o.Idx; }
>>      bool operator!=(const op_iterator_impl &o) const { return Idx != o.Idx; }
>> @@ -242,11 +241,6 @@ class NamedMDNode : public ilist_node<Na
>>        return tmp;
>>      }
>>
>> -    op_iterator_impl &operator=(const op_iterator_impl &o) {
>> -      Node = o.Node;
>> -      Idx = o.Idx;
>> -      return *this;
>> -    }
>>      T1 operator*() const { return Node->getOperand(Idx); }
>>    };
>>
>>
>> Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)
>> +++ llvm/trunk/include/llvm/Object/RelocVisitor.h Tue Mar 11 06:32:49 2014
>> @@ -33,7 +33,6 @@ struct RelocToApply {
>>    // The width of the value; how many bytes to touch when applying the
>>    // relocation.
>>    char Width;
>> -  RelocToApply(const RelocToApply &In) : Value(In.Value), Width(In.Width) {}
>>    RelocToApply(int64_t Value, char Width) : Value(Value), Width(Width) {}
>>    RelocToApply() : Value(0), Width(0) {}
>>  };
>>
>> Modified: llvm/trunk/include/llvm/Support/TargetRegistry.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TargetRegistry.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Support/TargetRegistry.h (original)
>> +++ llvm/trunk/include/llvm/Support/TargetRegistry.h Tue Mar 11 06:32:49 2014
>> @@ -486,7 +486,6 @@ namespace llvm {
>>        explicit iterator(Target *T) : Current(T) {}
>>        friend struct TargetRegistry;
>>      public:
>> -      iterator(const iterator &I) : Current(I.Current) {}
>>        iterator() : Current(0) {}
>>
>>        bool operator==(const iterator &x) const {
>>
>> Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
>> +++ llvm/trunk/include/llvm/Target/TargetLowering.h Tue Mar 11 06:32:49 2014
>> @@ -2254,15 +2254,6 @@ public:
>>      /// operand it matches.
>>      unsigned getMatchedOperand() const;
>>
>> -    /// Copy constructor for copying from an AsmOperandInfo.
>> -    AsmOperandInfo(const AsmOperandInfo &info)
>> -      : InlineAsm::ConstraintInfo(info),
>> -        ConstraintCode(info.ConstraintCode),
>> -        ConstraintType(info.ConstraintType),
>> -        CallOperandVal(info.CallOperandVal),
>> -        ConstraintVT(info.ConstraintVT) {
>> -    }
>> -
>>      /// Copy constructor for copying from a ConstraintInfo.
>>      AsmOperandInfo(const InlineAsm::ConstraintInfo &info)
>>        : InlineAsm::ConstraintInfo(info),
>>
>> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Mar 11 06:32:49 2014
>> @@ -1539,7 +1539,6 @@ template<class SF>
>>  struct reverse_sort : public queue_sort {
>>    SF &SortFunc;
>>    reverse_sort(SF &sf) : SortFunc(sf) {}
>> -  reverse_sort(const reverse_sort &RHS) : SortFunc(RHS.SortFunc) {}
>>
>>    bool operator()(SUnit* left, SUnit* right) const {
>>      // reverse left/right rather than simply !SortFunc(left, right)
>> @@ -1559,7 +1558,6 @@ struct bu_ls_rr_sort : public queue_sort
>>
>>    RegReductionPQBase *SPQ;
>>    bu_ls_rr_sort(RegReductionPQBase *spq) : SPQ(spq) {}
>> -  bu_ls_rr_sort(const bu_ls_rr_sort &RHS) : SPQ(RHS.SPQ) {}
>>
>>    bool operator()(SUnit* left, SUnit* right) const;
>>  };
>> @@ -1574,8 +1572,6 @@ struct src_ls_rr_sort : public queue_sor
>>    RegReductionPQBase *SPQ;
>>    src_ls_rr_sort(RegReductionPQBase *spq)
>>      : SPQ(spq) {}
>> -  src_ls_rr_sort(const src_ls_rr_sort &RHS)
>> -    : SPQ(RHS.SPQ) {}
>>
>>    bool operator()(SUnit* left, SUnit* right) const;
>>  };
>> @@ -1590,8 +1586,6 @@ struct hybrid_ls_rr_sort : public queue_
>>    RegReductionPQBase *SPQ;
>>    hybrid_ls_rr_sort(RegReductionPQBase *spq)
>>      : SPQ(spq) {}
>> -  hybrid_ls_rr_sort(const hybrid_ls_rr_sort &RHS)
>> -    : SPQ(RHS.SPQ) {}
>>
>>    bool isReady(SUnit *SU, unsigned CurCycle) const;
>>
>> @@ -1609,8 +1603,6 @@ struct ilp_ls_rr_sort : public queue_sor
>>    RegReductionPQBase *SPQ;
>>    ilp_ls_rr_sort(RegReductionPQBase *spq)
>>      : SPQ(spq) {}
>> -  ilp_ls_rr_sort(const ilp_ls_rr_sort &RHS)
>> -    : SPQ(RHS.SPQ) {}
>>
>>    bool isReady(SUnit *SU, unsigned CurCycle) const;
>>
>>
>> Modified: llvm/trunk/lib/IR/InlineAsm.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/InlineAsm.cpp?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/IR/InlineAsm.cpp (original)
>> +++ llvm/trunk/lib/IR/InlineAsm.cpp Tue Mar 11 06:32:49 2014
>> @@ -64,16 +64,6 @@ InlineAsm::ConstraintInfo::ConstraintInf
>>    currentAlternativeIndex(0) {
>>  }
>>
>> -/// Copy constructor.
>> -InlineAsm::ConstraintInfo::ConstraintInfo(const ConstraintInfo &other) :
>> -  Type(other.Type), isEarlyClobber(other.isEarlyClobber),
>> -  MatchingInput(other.MatchingInput), isCommutative(other.isCommutative),
>> -  isIndirect(other.isIndirect), Codes(other.Codes),
>> -  isMultipleAlternative(other.isMultipleAlternative),
>> -  multipleAlternatives(other.multipleAlternatives),
>> -  currentAlternativeIndex(other.currentAlternativeIndex) {
>> -}
>> -
>>  /// Parse - Analyze the specified string (e.g. "==&{eax}") and fill in the
>>  /// fields in this structure.  If the constraint string is not understood,
>>  /// return true, otherwise return false.
>>
>> Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.h?rev=203563&r1=203562&r2=203563&view=diff
>> ==============================================================================
>> --- llvm/trunk/utils/TableGen/CodeGenRegisters.h (original)
>> +++ llvm/trunk/utils/TableGen/CodeGenRegisters.h Tue Mar 11 06:32:49 2014
>> @@ -374,11 +374,6 @@ namespace llvm {
>>        unsigned SpillSize;
>>        unsigned SpillAlignment;
>>
>> -      Key(const Key &O)
>> -        : Members(O.Members),
>> -          SpillSize(O.SpillSize),
>> -          SpillAlignment(O.SpillAlignment) {}
>> -
>>        Key(const CodeGenRegister::Set *M, unsigned S = 0, unsigned A = 0)
>>          : Members(M), SpillSize(S), SpillAlignment(A) {}
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list