[NFC][Clang] Fix Coverity issues of copy without assign
authorManna, Soumi <soumi.manna@intel.com>
Mon, 15 May 2023 02:49:22 +0000 (19:49 -0700)
committerManna, Soumi <soumi.manna@intel.com>
Mon, 15 May 2023 02:49:28 +0000 (19:49 -0700)
This patch adds missing copy/move assignment operator to the class which has user-defined copy/move constructor.

Reviewed By: tahonermann

Differential Revision: https://reviews.llvm.org/D149718

clang/include/clang/Analysis/BodyFarm.h
clang/include/clang/Sema/ParsedAttr.h
clang/lib/Analysis/UnsafeBufferUsage.cpp
clang/lib/Serialization/ASTWriterStmt.cpp

index eaa6472433dde398d21ba739b82112aed7f6b4a2..52be29cb7885e77b4a4153a46a533dc678243da4 100644 (file)
@@ -40,6 +40,9 @@ public:
   /// Remove copy constructor to avoid accidental copying.
   BodyFarm(const BodyFarm &other) = delete;
 
+  /// Delete copy assignment operator.
+  BodyFarm &operator=(const BodyFarm &other) = delete;
+
 private:
   typedef llvm::DenseMap<const Decl *, std::optional<Stmt *>> BodyMap;
 
index 345c3c89edca724cf91258bbf2ba3ef5dc0260ed..837725c0798075da19259537954c388dc1e00e48 100644 (file)
@@ -696,11 +696,13 @@ public:
   AttributePool(AttributeFactory &factory) : Factory(factory) {}
 
   AttributePool(const AttributePool &) = delete;
+  AttributePool &operator=(const AttributePool &) = delete;
 
   ~AttributePool() { Factory.reclaimPool(*this); }
 
   /// Move the given pool's allocations to this pool.
   AttributePool(AttributePool &&pool) = default;
+  AttributePool &operator=(AttributePool &&pool) = default;
 
   AttributeFactory &getFactory() const { return Factory; }
 
@@ -912,6 +914,7 @@ class ParsedAttributes : public ParsedAttributesView {
 public:
   ParsedAttributes(AttributeFactory &factory) : pool(factory) {}
   ParsedAttributes(const ParsedAttributes &) = delete;
+  ParsedAttributes &operator=(const ParsedAttributes &) = delete;
 
   AttributePool &getPool() const { return pool; }
 
index 7871fed519b98a6c3370c13239da015a9c6bcb72..700a09445b5085304932c9c78afe1a47e84ca519 100644 (file)
@@ -762,7 +762,9 @@ private:
 public:
   Strategy() = default;
   Strategy(const Strategy &) = delete; // Let's avoid copies.
+  Strategy &operator=(const Strategy &) = delete;
   Strategy(Strategy &&) = default;
+  Strategy &operator=(Strategy &&) = default;
 
   void set(const VarDecl *VD, Kind K) { Map[VD] = K; }
 
index 90c30fce0a8e77b22a750d1b1be53a461fdd4e5f..363f7569acd3e48538520eaff82d873af7606fc3 100644 (file)
@@ -42,6 +42,7 @@ namespace clang {
           Code(serialization::STMT_NULL_PTR), AbbrevToUse(0) {}
 
     ASTStmtWriter(const ASTStmtWriter&) = delete;
+    ASTStmtWriter &operator=(const ASTStmtWriter &) = delete;
 
     uint64_t Emit() {
       assert(Code != serialization::STMT_NULL_PTR &&