[llvm] 252cea0 - [Hexagon] Add defaulted operator= to classes with defaulted copy ctor

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 18 14:00:55 PDT 2022


Author: Krzysztof Parzyszek
Date: 2022-08-18T14:00:41-07:00
New Revision: 252cea037bcad6e1e7236756bcbb4e4ed73e328d

URL: https://github.com/llvm/llvm-project/commit/252cea037bcad6e1e7236756bcbb4e4ed73e328d
DIFF: https://github.com/llvm/llvm-project/commit/252cea037bcad6e1e7236756bcbb4e4ed73e328d.diff

LOG: [Hexagon] Add defaulted operator= to classes with defaulted copy ctor

This avoids deprecation warning:
```
warning: definition of implicit copy assignment operator for 'AddrInfo'
is deprecated because it has a user-declared copy constructor
[-Wdeprecated-copy]
```

This fixes https://github.com/llvm/llvm-project/issues/57229

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
index bd0232c71d48b..f37c50900adb4 100644
--- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
@@ -149,6 +149,7 @@ class AlignVectors {
              Align H)
         : Inst(I), Addr(A), ValTy(T), HaveAlign(H),
           NeedAlign(HVC.getTypeAlignment(ValTy)) {}
+    AddrInfo &operator=(const AddrInfo &) = default;
 
     // XXX: add Size member?
     Instruction *Inst;
@@ -185,6 +186,7 @@ class AlignVectors {
       Segment(Value *Val, int Begin, int Len)
           : Val(Val), Start(Begin), Size(Len) {}
       Segment(const Segment &Seg) = default;
+      Segment &operator=(const Segment &Seg) = default;
       Value *Val; // Value representable as a sequence of bytes.
       int Start;  // First byte of the value that belongs to the segment.
       int Size;   // Number of bytes in the segment.
@@ -195,6 +197,7 @@ class AlignVectors {
       Block(Value *Val, int Off, int Len, int Pos)
           : Seg(Val, Off, Len), Pos(Pos) {}
       Block(const Block &Blk) = default;
+      Block &operator=(const Block &Blk) = default;
       Segment Seg; // Value segment.
       int Pos;     // Position (offset) of the segment in the Block.
     };


        


More information about the llvm-commits mailing list