Index: llvm/include/llvm/IR/Metadata.h =================================================================== --- llvm/include/llvm/IR/Metadata.h +++ llvm/include/llvm/IR/Metadata.h @@ -775,10 +775,22 @@ public: MDOperand() = default; - MDOperand(MDOperand &&) = delete; - MDOperand(const MDOperand &) = delete; - MDOperand &operator=(MDOperand &&) = delete; - MDOperand &operator=(const MDOperand &) = delete; + MDOperand(const MDOperand &&Op) { + MD = Op.MD; + track(nullptr); + } + MDOperand(const MDOperand &Op) { + MD = Op.MD; + track(nullptr); + } + MDOperand &operator=(const MDOperand &&Op) { + reset(Op.MD, nullptr); + return *this; + } + MDOperand &operator=(const MDOperand &Op) { + reset(Op.MD, nullptr); + return *this; + } ~MDOperand() { untrack(); } Metadata *get() const { return MD; }