From: Lang Hames Date: Sun, 26 Oct 2014 21:55:54 +0000 (+0000) Subject: [PBQP] Explicitly define copy/move operations for NodeMetadata to keep VS happy. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6bac95a33babd09b5612381d26a40693d61c37cc;p=platform%2Fupstream%2Fllvm.git [PBQP] Explicitly define copy/move operations for NodeMetadata to keep VS happy. Hopefully this fixes the bug that was introduced in r220642, and not-quite-fixed in r220649. llvm-svn: 220653 --- diff --git a/llvm/include/llvm/CodeGen/RegAllocPBQP.h b/llvm/include/llvm/CodeGen/RegAllocPBQP.h index 0d379ea..4d7e5d5 100644 --- a/llvm/include/llvm/CodeGen/RegAllocPBQP.h +++ b/llvm/include/llvm/CodeGen/RegAllocPBQP.h @@ -82,13 +82,43 @@ public: ConservativelyAllocatable, NotProvablyAllocatable } ReductionState; - NodeMetadata() : RS(Unprocessed), DeniedOpts(0), OptUnsafeEdges(nullptr){} + NodeMetadata() + : RS(Unprocessed), NumOpts(0), DeniedOpts(0), OptUnsafeEdges(nullptr), + VReg(0) {} + // FIXME: Re-implementing default behavior to work around MSVC. Remove once + // MSVC synthesizes move constructors properly. + NodeMetadata(const NodeMetadata &Other) + : RS(Other.RS), NumOpts(Other.NumOpts), DeniedOpts(Other.DeniedOpts), + OptUnsafeEdges(new unsigned[NumOpts]), VReg(Other.VReg), + OptionRegs(Other.OptionRegs) { + std::copy(&Other.OptUnsafeEdges[0], &Other.OptUnsafeEdges[NumOpts], + &OptUnsafeEdges[0]); + } + + // FIXME: Re-implementing default behavior to work around MSVC. Remove once + // MSVC synthesizes move constructors properly. NodeMetadata(NodeMetadata &&Other) : RS(Other.RS), NumOpts(Other.NumOpts), DeniedOpts(Other.DeniedOpts), OptUnsafeEdges(std::move(Other.OptUnsafeEdges)), VReg(Other.VReg), OptionRegs(std::move(Other.OptionRegs)) {} + // FIXME: Re-implementing default behavior to work around MSVC. Remove once + // MSVC synthesizes move constructors properly. + NodeMetadata& operator=(const NodeMetadata &Other) { + RS = Other.RS; + NumOpts = Other.NumOpts; + DeniedOpts = Other.DeniedOpts; + OptUnsafeEdges = std::unique_ptr(new unsigned[NumOpts]); + std::copy(&Other.OptUnsafeEdges[0], &Other.OptUnsafeEdges[NumOpts], + &OptUnsafeEdges[0]); + VReg = Other.VReg; + OptionRegs = Other.OptionRegs; + return *this; + } + + // FIXME: Re-implementing default behavior to work around MSVC. Remove once + // MSVC synthesizes move constructors properly. NodeMetadata& operator=(NodeMetadata &&Other) { RS = Other.RS; NumOpts = Other.NumOpts; @@ -138,9 +168,6 @@ public: } private: - NodeMetadata(const NodeMetadata&) LLVM_DELETED_FUNCTION; - void operator=(const NodeMetadata&) LLVM_DELETED_FUNCTION; - ReductionState RS; unsigned NumOpts; unsigned DeniedOpts;