Author: Vitaly Buka
Date: 2026-11-13T05:00:51Z
New Revision: 3d68cfd41382cf101be913fb8d7f444ad66f0cde

URL: 
https://github.com/llvm/llvm-project/commit/3d68cfd41382cf101be913fb8d7f444ad66f0cde
DIFF: 
https://github.com/llvm/llvm-project/commit/3d68cfd41382cf101be913fb8d7f444ad66f0cde.diff

LOG: [NFC][Clang][CodeGen] Take const& in deleted copy assignment operators 
(#241713)

436f391d1d56 (#154671) deleted the copy assignment operators of
`ApplyInlineDebugLocation` and `SanitizerDebugLocation` with a non-const
parameter. That still leaves the classes non-copyable, but it breaks
`std::optional<SanitizerDebugLocation>`: libstdc++ fails to default the
copy assignment of its storage.

Use `const &`, matching the deleted copy constructors.

Needed by #241646.

Assisted-by: Gemini

Added: 
    

Modified: 
    clang/lib/CodeGen/CGDebugInfo.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h
index b70671821c920..bf92336743958 100644
--- a/clang/lib/CodeGen/CGDebugInfo.h
+++ b/clang/lib/CodeGen/CGDebugInfo.h
@@ -1028,7 +1028,8 @@ class ApplyInlineDebugLocation {
   /// Restore everything back to the original state.
   ~ApplyInlineDebugLocation();
   ApplyInlineDebugLocation(const ApplyInlineDebugLocation &) = delete;
-  ApplyInlineDebugLocation &operator=(ApplyInlineDebugLocation &) = delete;
+  ApplyInlineDebugLocation &
+  operator=(const ApplyInlineDebugLocation &) = delete;
 };
 
 class SanitizerDebugLocation {
@@ -1041,7 +1042,7 @@ class SanitizerDebugLocation {
                          SanitizerHandler Handler);
   ~SanitizerDebugLocation();
   SanitizerDebugLocation(const SanitizerDebugLocation &) = delete;
-  SanitizerDebugLocation &operator=(SanitizerDebugLocation &) = delete;
+  SanitizerDebugLocation &operator=(const SanitizerDebugLocation &) = delete;
 };
 
 } // namespace CodeGen


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to