[clang] 4768173 - [Clang][NFC] Explicitly delete copy ctor and assignment for CGAtomicOptionsRAII (#137275)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 1 07:52:02 PDT 2025


Author: Shafik Yaghmour
Date: 2025-05-01T07:51:58-07:00
New Revision: 47681736cbf6f32a70ca0aaf5d2671bc9c76112d

URL: https://github.com/llvm/llvm-project/commit/47681736cbf6f32a70ca0aaf5d2671bc9c76112d
DIFF: https://github.com/llvm/llvm-project/commit/47681736cbf6f32a70ca0aaf5d2671bc9c76112d.diff

LOG: [Clang][NFC] Explicitly delete copy ctor and assignment for CGAtomicOptionsRAII (#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.

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenFunction.h

Removed: 
    


################################################################################
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:


        


More information about the cfe-commits mailing list