https://github.com/shafik created 
https://github.com/llvm/llvm-project/pull/137275

Static analysis flagged CGAtomicOptionsRAII as having an explicit destructor 
but not having explicit copy ctor and assignment. Rule of three says we should. 
We are just using this as an RAII object, no need for either so they will be 
specified as deleted.

>From 445b897f5b1626fcf35bb75f219ac6655640c03c Mon Sep 17 00:00:00 2001
From: Shafik Yaghmour <shafik.yaghm...@intel.com>
Date: Thu, 24 Apr 2025 17:23:54 -0700
Subject: [PATCH] [Clang][NFC] Explicitly delete copy ctor and assignment for
 CGAtomicOptionsRAII

Static analysis flagged CGAtomicOptionsRAII as having an explicit destructor
but not having explict copy ctor and assignment. Rule of three says we should.
We are just using this as an RAII object, no need for either so they will be
specified as deleted.
---
 clang/lib/CodeGen/CodeGenFunction.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/CodeGen/CodeGenFunction.h 
b/clang/lib/CodeGen/CodeGenFunction.h
index 4c5e8a8a44926..561f8f6a2a2fb 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -869,6 +869,9 @@ class CodeGenFunction : public CodeGenTypeCache {
       }
       CGM.setAtomicOpts(AO);
     }
+
+    CGAtomicOptionsRAII(const CGAtomicOptionsRAII &) = delete;
+    CGAtomicOptionsRAII &operator=(const CGAtomicOptionsRAII &) = delete;
     ~CGAtomicOptionsRAII() { CGM.setAtomicOpts(SavedAtomicOpts); }
 
   private:

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

Reply via email to