Skip to content

Conversation

@shafik
Copy link
Collaborator

@shafik shafik commented Aug 21, 2025

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.

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.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. debuginfo labels Aug 21, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 21, 2025

@llvm/pr-subscribers-clang-codegen

@llvm/pr-subscribers-debuginfo

Author: Shafik Yaghmour (shafik)

Changes

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

@llvmbot
Copy link
Member

llvmbot commented Aug 21, 2025

@llvm/pr-subscribers-clang

Author: Shafik Yaghmour (shafik)

Changes

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

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shafik shafik merged commit 436f391 into llvm:main Aug 21, 2025
13 checks passed
@shafik shafik deleted the cgdebuginfo_ruleofthree branch August 24, 2025 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:codegen IR generation bugs: mangling, exceptions, etc. clang Clang issues not falling into any other category debuginfo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants