Commit 5da8d8de by Nicolas Capens Committed by Nicolas Capens

Avoid Array<> assignment

The Array<> assignment operator gets auto-generated, but is unsafe as it overwrites the Variable address field. Also delete the Variable assignment operator. Bug b/129356087 Change-Id: If6d5945f2a56f9a81bbc1491a524e3f17c1561da Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28088 Presubmit-Ready: Nicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com>
parent f1beca4f
......@@ -1343,6 +1343,8 @@ namespace sw
// the block.
struct LoopPhi
{
LoopPhi(Object::ID id, uint32_t size) : phiId(id), storage(size) {}
Object::ID phiId; // The Phi identifier.
Object::ID continueValue; // The source merge value from the loop.
Array<SIMD::Int> storage; // The alloca.
......@@ -1359,9 +1361,7 @@ namespace sw
auto &object = getObject(objectId);
auto &type = getType(object.type);
LoopPhi phi;
phi.phiId = Object::ID(insn.word(2));
phi.storage = Array<SIMD::Int>(type.sizeInComponents);
LoopPhi phi(insn.word(2), type.sizeInComponents);
// Start with the Phi set to 0.
for (uint32_t i = 0; i < type.sizeInComponents; i++)
......
......@@ -81,8 +81,15 @@ namespace rr
class Variable
{
protected:
friend class PrintValue;
Variable &operator=(const Variable&) = delete;
public:
Variable() = default;
Variable(const Variable&) = default;
protected:
Value *address;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment