Skip to content

Commit

Permalink
[Clang] Fix Static Code Analysis Concerns with copy without assign
Browse files Browse the repository at this point in the history
This patch adds missing assignment operator to the class which has user-defined copy constructor.

Reviewed By: tahonermann, aaronpuchert

Differential Revision: https://reviews.llvm.org/D150931
  • Loading branch information
smanna12 committed Jun 22, 2023
1 parent 82a6152 commit 11528fc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ class SExpr {
protected:
SExpr(TIL_Opcode Op) : Opcode(Op) {}
SExpr(const SExpr &E) : Opcode(E.Opcode), Flags(E.Flags) {}
SExpr &operator=(const SExpr &) = delete;

const TIL_Opcode Opcode;
unsigned char Reserved = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ class CallEventRef : public IntrusiveRefCntPtr<const T> {
CallEventRef(const T *Call) : IntrusiveRefCntPtr<const T>(Call) {}
CallEventRef(const CallEventRef &Orig) : IntrusiveRefCntPtr<const T>(Orig) {}

// The copy assignment operator is defined as deleted pending further
// motivation.
CallEventRef &operator=(const CallEventRef &) = delete;

CallEventRef<T> cloneWithState(ProgramStateRef State) const {
return this->get()->template cloneWithState<T>(State);
}
Expand Down

0 comments on commit 11528fc

Please sign in to comment.