Skip to content

Commit

Permalink
[NFC][Clang] Fix Coverity issues of copy without assign
Browse files Browse the repository at this point in the history
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
  • Loading branch information
smanna12 committed May 15, 2023
1 parent 1ba9ec0 commit 5ebff1a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions clang/include/clang/Analysis/BodyFarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class BodyFarm {
/// 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;

Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Sema/ParsedAttr.h
Original file line number Diff line number Diff line change
Expand Up @@ -696,11 +696,13 @@ class AttributePool {
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; }

Expand Down Expand Up @@ -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; }

Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Analysis/UnsafeBufferUsage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,9 @@ class Strategy {
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; }

Expand Down
1 change: 1 addition & 0 deletions clang/lib/Serialization/ASTWriterStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down

0 comments on commit 5ebff1a

Please sign in to comment.