From 7124b45beeede0065dc504ae7f210160f5c9cc21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?D=C3=A1vid=20Bolvansk=C3=BD?= Date: Sat, 23 Nov 2019 21:01:56 +0100 Subject: [PATCH] Fixed -Wdeprecated-copy warnings. NFCI. --- clang/include/clang/AST/ASTImporter.h | 8 ++++++-- clang/include/clang/Sema/ObjCMethodList.h | 6 ++++++ llvm/include/llvm/ADT/STLExtras.h | 3 +++ .../llvm/DebugInfo/PDB/Native/DbiModuleList.h | 1 + llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h | 1 + llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h | 1 + llvm/include/llvm/Support/BinaryStreamArray.h | 3 +++ llvm/include/llvm/Support/Timer.h | 1 + .../lib/Target/Hexagon/HexagonConstPropagation.cpp | 14 ++++++++++++-- llvm/lib/Target/Hexagon/HexagonGenInsert.cpp | 4 ++++ llvm/utils/TableGen/CodeGenDAGPatterns.h | 1 + 11 files changed, 39 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/AST/ASTImporter.h b/clang/include/clang/AST/ASTImporter.h index c82dcab35db5..50eda635bf83 100644 --- a/clang/include/clang/AST/ASTImporter.h +++ b/clang/include/clang/AST/ASTImporter.h @@ -60,8 +60,12 @@ class TypeSourceInfo; static char ID; - ImportError() : Error(Unknown) { } - ImportError(const ImportError &Other) : Error(Other.Error) { } + ImportError() : Error(Unknown) {} + ImportError(const ImportError &Other) : Error(Other.Error) {} + ImportError &operator=(const ImportError &Other) { + Error = Other.Error; + return *this, + } ImportError(ErrorKind Error) : Error(Error) { } std::string toString() const; diff --git a/clang/include/clang/Sema/ObjCMethodList.h b/clang/include/clang/Sema/ObjCMethodList.h index bd2ce2a9f016..9e65e0d8e00a 100644 --- a/clang/include/clang/Sema/ObjCMethodList.h +++ b/clang/include/clang/Sema/ObjCMethodList.h @@ -36,6 +36,12 @@ struct ObjCMethodList { : MethodAndHasMoreThanOneDecl(L.MethodAndHasMoreThanOneDecl), NextAndExtraBits(L.NextAndExtraBits) {} + ObjCMethodList &operator=(const ObjCMethodList &L) { + MethodAndHasMoreThanOneDecl = L.MethodAndHasMoreThanOneDecl; + NextAndExtraBits = L.NextAndExtraBits; + return *this; + } + ObjCMethodList *getNext() const { return NextAndExtraBits.getPointer(); } unsigned getBits() const { return NextAndExtraBits.getInt(); } void setNext(ObjCMethodList *L) { NextAndExtraBits.setPointer(L); } diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index f0fe4fd94380..b61dab2459d1 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -1415,6 +1415,8 @@ template struct result_pair { result_pair(std::size_t Index, IterOfRange Iter) : Index(Index), Iter(Iter) {} + result_pair(const result_pair &Other) + : Index(Other.Index), Iter(Other.Iter) {} result_pair &operator=(const result_pair &Other) { Index = Other.Index; Iter = Other.Iter; @@ -1463,6 +1465,7 @@ public: return Result.Iter == RHS.Result.Iter; } + enumerator_iter(const enumerator_iter &Other) : Result(Other.Result) {} enumerator_iter &operator=(const enumerator_iter &Other) { Result = Other.Result; return *this; diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h b/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h index 14223273c898..5fb13ad30e91 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/DbiModuleList.h @@ -39,6 +39,7 @@ public: DbiModuleSourceFilesIterator(const DbiModuleList &Modules, uint32_t Modi, uint16_t Filei); DbiModuleSourceFilesIterator() = default; + DbiModuleSourceFilesIterator(const DbiModuleSourceFilesIterator &R) = default; DbiModuleSourceFilesIterator & operator=(const DbiModuleSourceFilesIterator &R) = default; diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h b/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h index aa38417bcf4c..01bb7aff44b0 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h @@ -56,6 +56,7 @@ public: } } + HashTableIterator(const HashTableIterator &R) : Map(R.Map) {} HashTableIterator &operator=(const HashTableIterator &R) { Map = R.Map; return *this; diff --git a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h index 849dbd57f1aa..e64ab9cdc6f5 100644 --- a/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h +++ b/llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h @@ -174,6 +174,7 @@ struct DiagnosticPredicate { : DiagnosticPredicateTy::NearMatch) {} DiagnosticPredicate(DiagnosticPredicateTy T) : Type(T) {} DiagnosticPredicate(const DiagnosticPredicate &) = default; + DiagnosticPredicate& operator=(const DiagnosticPredicate &) = default; operator bool() const { return Type == DiagnosticPredicateTy::Match; } bool isMatch() const { return Type == DiagnosticPredicateTy::Match; } diff --git a/llvm/include/llvm/Support/BinaryStreamArray.h b/llvm/include/llvm/Support/BinaryStreamArray.h index e490389c8ec4..1634983d26ce 100644 --- a/llvm/include/llvm/Support/BinaryStreamArray.h +++ b/llvm/include/llvm/Support/BinaryStreamArray.h @@ -274,6 +274,7 @@ public: return !(*this == Other); } + FixedStreamArray(const FixedStreamArray &) = default; FixedStreamArray &operator=(const FixedStreamArray &) = default; const T &operator[](uint32_t Index) const { @@ -323,6 +324,8 @@ public: FixedStreamArrayIterator(const FixedStreamArray &Array, uint32_t Index) : Array(Array), Index(Index) {} + FixedStreamArrayIterator(const FixedStreamArrayIterator &Other) + : Array(Other.Array), Index(Other.Index) {} FixedStreamArrayIterator & operator=(const FixedStreamArrayIterator &Other) { Array = Other.Array; diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h index 06a2f9e6dc9d..a298ecd90404 100644 --- a/llvm/include/llvm/Support/Timer.h +++ b/llvm/include/llvm/Support/Timer.h @@ -174,6 +174,7 @@ class TimerGroup { std::string Description; PrintRecord(const PrintRecord &Other) = default; + PrintRecord &operator=(const PrintRecord &Other) = default; PrintRecord(const TimeRecord &Time, const std::string &Name, const std::string &Description) : Time(Time), Name(Name), Description(Description) {} diff --git a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp index 3f759cdd57c0..5b61d1084e08 100644 --- a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp +++ b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp @@ -134,11 +134,21 @@ namespace { uint32_t properties() const; unsigned size() const { return Size; } - LatticeCell &operator= (const LatticeCell &L) { + LatticeCell(const LatticeCell &L) { + // This memcpy also copies Properties (when L.Size == 0). + uint32_t N = + L.IsSpecial ? sizeof L.Properties : L.Size * sizeof(const Constant *); + memcpy(Values, L.Values, N); + Kind = L.Kind; + Size = L.Size; + IsSpecial = L.IsSpecial; + } + + LatticeCell &operator=(const LatticeCell &L) { if (this != &L) { // This memcpy also copies Properties (when L.Size == 0). uint32_t N = L.IsSpecial ? sizeof L.Properties - : L.Size*sizeof(const Constant*); + : L.Size * sizeof(const Constant *); memcpy(Values, L.Values, N); Kind = L.Kind; Size = L.Size; diff --git a/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp b/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp index 5a1d04c57975..2f29e88bc989 100644 --- a/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp +++ b/llvm/lib/Target/Hexagon/HexagonGenInsert.cpp @@ -93,6 +93,10 @@ namespace { RegisterSet() = default; explicit RegisterSet(unsigned s, bool t = false) : BitVector(s, t) {} RegisterSet(const RegisterSet &RS) : BitVector(RS) {} + RegisterSet &operator=(const RegisterSet &RS) { + BitVector::operator=(RS); + return *this; + } using BitVector::clear; diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h index 80fc932a7a50..6732db5dfb6d 100644 --- a/llvm/utils/TableGen/CodeGenDAGPatterns.h +++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h @@ -194,6 +194,7 @@ struct TypeSetByHwMode : public InfoByHwMode { TypeSetByHwMode() = default; TypeSetByHwMode(const TypeSetByHwMode &VTS) = default; + TypeSetByHwMode &operator=(const TypeSetByHwMode &) = default; TypeSetByHwMode(MVT::SimpleValueType VT) : TypeSetByHwMode(ValueTypeByHwMode(VT)) {} TypeSetByHwMode(ValueTypeByHwMode VT) -- 2.34.1