[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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220653 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Lang Hames 2014-10-26 21:55:54 +00:00
parent b26fb77d9b
commit 2666eacaf5

View File

@ -82,13 +82,43 @@ public:
ConservativelyAllocatable, ConservativelyAllocatable,
NotProvablyAllocatable } ReductionState; 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) NodeMetadata(NodeMetadata &&Other)
: RS(Other.RS), NumOpts(Other.NumOpts), DeniedOpts(Other.DeniedOpts), : RS(Other.RS), NumOpts(Other.NumOpts), DeniedOpts(Other.DeniedOpts),
OptUnsafeEdges(std::move(Other.OptUnsafeEdges)), VReg(Other.VReg), OptUnsafeEdges(std::move(Other.OptUnsafeEdges)), VReg(Other.VReg),
OptionRegs(std::move(Other.OptionRegs)) {} 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<unsigned[]>(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) { NodeMetadata& operator=(NodeMetadata &&Other) {
RS = Other.RS; RS = Other.RS;
NumOpts = Other.NumOpts; NumOpts = Other.NumOpts;
@ -138,9 +168,6 @@ public:
} }
private: private:
NodeMetadata(const NodeMetadata&) LLVM_DELETED_FUNCTION;
void operator=(const NodeMetadata&) LLVM_DELETED_FUNCTION;
ReductionState RS; ReductionState RS;
unsigned NumOpts; unsigned NumOpts;
unsigned DeniedOpts; unsigned DeniedOpts;