[MC] Disable default copy ctor and copy assignment operator for CodeViewContext
authorBing1 Yu <bing1.yu@intel.com>
Wed, 31 May 2023 02:34:55 +0000 (10:34 +0800)
committerBing1 Yu <bing1.yu@intel.com>
Wed, 31 May 2023 02:35:19 +0000 (10:35 +0800)
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

llvm/include/llvm/MC/MCCodeView.h

index 3d15c40..3e997b1 100644 (file)
@@ -146,6 +146,9 @@ public:
   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);