[llvm] d5001e4 - [MC] Disable default copy ctor and copy assignment operator for CodeViewContext

Bing1 Yu via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 19:35:28 PDT 2023


Author: Bing1 Yu
Date: 2023-05-31T10:35:19+08:00
New Revision: d5001e4f0daa19d41da8715e511acaa125cef0a4

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

LOG: [MC] Disable default copy ctor and copy assignment operator for CodeViewContext

class CodeViewContext manages resources such as dynamically allocated memory, it's generally a good practice to either implement a custom copy constructor or disable the default one.

Reviewed By: skan

Differential Revision: https://reviews.llvm.org/D151695

Added: 
    

Modified: 
    llvm/include/llvm/MC/MCCodeView.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/MC/MCCodeView.h b/llvm/include/llvm/MC/MCCodeView.h
index 3d15c4009e438..3e997b1be3b8b 100644
--- a/llvm/include/llvm/MC/MCCodeView.h
+++ b/llvm/include/llvm/MC/MCCodeView.h
@@ -146,6 +146,9 @@ class CodeViewContext {
   CodeViewContext();
   ~CodeViewContext();
 
+  CodeViewContext &operator=(const CodeViewContext &other) = delete;
+  CodeViewContext(const CodeViewContext &other) = delete;
+
   bool isValidFileNumber(unsigned FileNumber) const;
   bool addFile(MCStreamer &OS, unsigned FileNumber, StringRef Filename,
                ArrayRef<uint8_t> ChecksumBytes, uint8_t ChecksumKind);


        


More information about the llvm-commits mailing list