Author: Manna, Soumi
Date: 2023-06-22T12:36:26-07:00
New Revision: 11528fceac6bb8a8d11749fb5ec5ea1baf27b1d1

URL: 
https://github.com/llvm/llvm-project/commit/11528fceac6bb8a8d11749fb5ec5ea1baf27b1d1
DIFF: 
https://github.com/llvm/llvm-project/commit/11528fceac6bb8a8d11749fb5ec5ea1baf27b1d1.diff

LOG: [Clang] Fix Static Code Analysis Concerns with copy without assign

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

Added: 
    

Modified: 
    clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
    clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h 
b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
index 9e03b4badd121..65dd66ee093fe 100644
--- a/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
+++ b/clang/include/clang/Analysis/Analyses/ThreadSafetyTIL.h
@@ -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;

diff  --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
index ffd6af528b8f4..a44ca660cd07d 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
@@ -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);
   }


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to