1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Interpreter: Hack around a series of bugs in MSVC 2012 that copies around this

move-only struct.

I feel terrible now, but at least it's shielded away from proper compilers.

llvm-svn: 217875
This commit is contained in:
Benjamin Kramer 2014-09-16 15:26:41 +00:00
parent 66d0e3b536
commit de5088f312

View File

@ -42,11 +42,17 @@ class AllocaHolder {
public:
AllocaHolder() {}
// Make this type move-only.
AllocaHolder(AllocaHolder &&RHS) : Allocations(std::move(RHS.Allocations)) {}
AllocaHolder &operator=(AllocaHolder &&RHS) {
Allocations = std::move(RHS.Allocations);
#if defined(_MSC_VER) && _MSC_VER < 1800
// Hack around bugs in MSVC 2012. It always tries to copy this class.
AllocaHolder(const AllocaHolder &RHS)
: Allocations(std::move(const_cast<AllocaHolder &>(RHS).Allocations)) {}
AllocaHolder &operator=(const AllocaHolder &RHS) {
Allocations = std::move(const_cast<AllocaHolder &>(RHS).Allocations);
return *this;
}
#else
AllocaHolder(AllocaHolder &&RHS) = default;
#endif
~AllocaHolder() {
for (void *Allocation : Allocations)