[llvm-branch-commits] [llvm] a26ef3c - [Hexagon] Add defaulted operator= to classes with defaulted copy ctor

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Sep 25 22:56:15 PDT 2022


Author: Krzysztof Parzyszek
Date: 2022-09-26T07:53:55+02:00
New Revision: a26ef3c19ede6596de4010e2884f60842a2cdbdc

URL: https://github.com/llvm/llvm-project/commit/a26ef3c19ede6596de4010e2884f60842a2cdbdc
DIFF: https://github.com/llvm/llvm-project/commit/a26ef3c19ede6596de4010e2884f60842a2cdbdc.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

(cherry picked from commit 252cea037bcad6e1e7236756bcbb4e4ed73e328d)

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-branch-commits mailing list