[clang] [Clang][Codegen][NFC] Apply rule of three to some classes (PR #154671)

via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 20 22:31:55 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-debuginfo

Author: Shafik Yaghmour (shafik)

<details>
<summary>Changes</summary>

Static analysis flagged these classes as having implemented the destructor but not applying rule of three. This could lead to accidental misuse and so it makes sense to apply it.

---
Full diff: https://github.com/llvm/llvm-project/pull/154671.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGDebugInfo.h (+4) 


``````````diff
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index 497d3a6ab17b1..ff9c3cd2d1136 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -977,6 +977,8 @@ class ApplyInlineDebugLocation {
   ApplyInlineDebugLocation(CodeGenFunction &CGF, GlobalDecl InlinedFn);
   /// Restore everything back to the original state.
   ~ApplyInlineDebugLocation();
+  ApplyInlineDebugLocation(const ApplyInlineDebugLocation &) = delete;
+  ApplyInlineDebugLocation &operator=(ApplyInlineDebugLocation &) = delete;
 };
 
 class SanitizerDebugLocation {
@@ -988,6 +990,8 @@ class SanitizerDebugLocation {
                          ArrayRef<SanitizerKind::SanitizerOrdinal> Ordinals,
                          SanitizerHandler Handler);
   ~SanitizerDebugLocation();
+  SanitizerDebugLocation(const SanitizerDebugLocation &) = delete;
+  SanitizerDebugLocation &operator=(SanitizerDebugLocation &) = delete;
 };
 
 } // namespace CodeGen

``````````

</details>


https://github.com/llvm/llvm-project/pull/154671


More information about the cfe-commits mailing list