Commit b5d61dac by Corentin Wallez

Revert "Add deep copying support for typed AST nodes"

This reverts commit d0d59aa4 and commit 76037953 To be fixed will be the newline at the end of IntermNode_tests.cpp and the -Winconsistent-missing-override BUG= Change-Id: I57693bdff01f9e3f03b2fbb5dc53fa21e68c2789 Reviewed-on: https://chromium-review.googlesource.com/294820Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent a7b6db7f
...@@ -395,77 +395,6 @@ bool TIntermCase::replaceChildNode( ...@@ -395,77 +395,6 @@ bool TIntermCase::replaceChildNode(
return false; return false;
} }
TIntermTyped::TIntermTyped(const TIntermTyped &node) : TIntermNode(), mType(node.mType)
{
// Copy constructor is disallowed for TIntermNode in order to disallow it for subclasses that
// don't explicitly allow it, so normal TIntermNode constructor is used to construct the copy.
// We need to manually copy any fields of TIntermNode besides handling fields in TIntermTyped.
mLine = node.mLine;
}
TIntermConstantUnion::TIntermConstantUnion(const TIntermConstantUnion &node) : TIntermTyped(node)
{
size_t arraySize = mType.getObjectSize();
mUnionArrayPointer = new TConstantUnion[arraySize];
for (size_t i = 0u; i < arraySize; ++i)
{
mUnionArrayPointer[i] = node.mUnionArrayPointer[i];
}
}
TIntermAggregate::TIntermAggregate(const TIntermAggregate &node)
: TIntermOperator(node),
mName(node.mName),
mUserDefined(node.mUserDefined),
mFunctionId(node.mFunctionId),
mOptimize(node.mOptimize),
mDebug(node.mDebug),
mUseEmulatedFunction(node.mUseEmulatedFunction),
mGotPrecisionFromChildren(node.mGotPrecisionFromChildren)
{
for (TIntermNode *child : node.mSequence)
{
TIntermTyped *typedChild = child->getAsTyped();
ASSERT(typedChild != nullptr);
TIntermTyped *childCopy = typedChild->deepCopy();
mSequence.push_back(childCopy);
}
}
TIntermBinary::TIntermBinary(const TIntermBinary &node)
: TIntermOperator(node), mAddIndexClamp(node.mAddIndexClamp)
{
TIntermTyped *leftCopy = node.mLeft->deepCopy();
TIntermTyped *rightCopy = node.mRight->deepCopy();
ASSERT(leftCopy != nullptr && rightCopy != nullptr);
mLeft = leftCopy;
mRight = rightCopy;
}
TIntermUnary::TIntermUnary(const TIntermUnary &node)
: TIntermOperator(node), mUseEmulatedFunction(node.mUseEmulatedFunction)
{
TIntermTyped *operandCopy = node.mOperand->deepCopy();
ASSERT(operandCopy != nullptr);
mOperand = operandCopy;
}
TIntermSelection::TIntermSelection(const TIntermSelection &node) : TIntermTyped(node)
{
// Only supported for ternary nodes, not if statements.
TIntermTyped *trueTyped = node.mTrueBlock->getAsTyped();
TIntermTyped *falseTyped = node.mFalseBlock->getAsTyped();
ASSERT(trueTyped != nullptr);
ASSERT(falseTyped != nullptr);
TIntermTyped *conditionCopy = node.mCondition->deepCopy();
TIntermTyped *trueCopy = trueTyped->deepCopy();
TIntermTyped *falseCopy = falseTyped->deepCopy();
ASSERT(conditionCopy != nullptr && trueCopy != nullptr && falseCopy != nullptr);
mCondition = conditionCopy;
mTrueBlock = trueCopy;
mFalseBlock = falseCopy;
}
// //
// Say whether or not an operation node changes the value of a variable. // Say whether or not an operation node changes the value of a variable.
// //
......
...@@ -52,8 +52,6 @@ class TName ...@@ -52,8 +52,6 @@ class TName
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
explicit TName(const TString &name) : mName(name), mIsInternal(false) {} explicit TName(const TString &name) : mName(name), mIsInternal(false) {}
TName() : mName(), mIsInternal(false) {} TName() : mName(), mIsInternal(false) {}
TName(const TName &) = default;
TName &operator=(const TName &) = default;
const TString &getString() const { return mName; } const TString &getString() const { return mName; }
void setString(const TString &string) { mName = string; } void setString(const TString &string) { mName = string; }
...@@ -68,7 +66,7 @@ class TName ...@@ -68,7 +66,7 @@ class TName
// //
// Base class for the tree nodes // Base class for the tree nodes
// //
class TIntermNode : angle::NonCopyable class TIntermNode
{ {
public: public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
...@@ -122,9 +120,6 @@ class TIntermTyped : public TIntermNode ...@@ -122,9 +120,6 @@ class TIntermTyped : public TIntermNode
{ {
public: public:
TIntermTyped(const TType &t) : mType(t) { } TIntermTyped(const TType &t) : mType(t) { }
virtual TIntermTyped *deepCopy() const = 0;
TIntermTyped *getAsTyped() override { return this; } TIntermTyped *getAsTyped() override { return this; }
virtual bool hasSideEffects() const = 0; virtual bool hasSideEffects() const = 0;
...@@ -155,8 +150,6 @@ class TIntermTyped : public TIntermNode ...@@ -155,8 +150,6 @@ class TIntermTyped : public TIntermNode
protected: protected:
TType mType; TType mType;
TIntermTyped(const TIntermTyped &node);
}; };
// //
...@@ -242,8 +235,6 @@ class TIntermSymbol : public TIntermTyped ...@@ -242,8 +235,6 @@ class TIntermSymbol : public TIntermTyped
{ {
} }
TIntermTyped *deepCopy() const override { return new TIntermSymbol(*this); }
bool hasSideEffects() const override { return false; } bool hasSideEffects() const override { return false; }
int getId() const { return mId; } int getId() const { return mId; }
...@@ -261,9 +252,6 @@ class TIntermSymbol : public TIntermTyped ...@@ -261,9 +252,6 @@ class TIntermSymbol : public TIntermTyped
protected: protected:
int mId; int mId;
TName mSymbol; TName mSymbol;
private:
TIntermSymbol(const TIntermSymbol &) = default; // Note: not deleted, just private!
}; };
// A Raw node stores raw code, that the translator will insert verbatim // A Raw node stores raw code, that the translator will insert verbatim
...@@ -275,13 +263,6 @@ class TIntermRaw : public TIntermTyped ...@@ -275,13 +263,6 @@ class TIntermRaw : public TIntermTyped
TIntermRaw(const TType &type, const TString &rawText) TIntermRaw(const TType &type, const TString &rawText)
: TIntermTyped(type), : TIntermTyped(type),
mRawText(rawText) { } mRawText(rawText) { }
TIntermRaw(const TIntermRaw &) = delete;
TIntermTyped *deepCopy() const
{
UNREACHABLE();
return nullptr;
}
bool hasSideEffects() const override { return false; } bool hasSideEffects() const override { return false; }
...@@ -303,8 +284,6 @@ class TIntermConstantUnion : public TIntermTyped ...@@ -303,8 +284,6 @@ class TIntermConstantUnion : public TIntermTyped
: TIntermTyped(type), : TIntermTyped(type),
mUnionArrayPointer(unionPointer) { } mUnionArrayPointer(unionPointer) { }
TIntermTyped *deepCopy() const override { return new TIntermConstantUnion(*this); }
bool hasSideEffects() const override { return false; } bool hasSideEffects() const override { return false; }
const TConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; } const TConstantUnion *getUnionArrayPointer() const { return mUnionArrayPointer; }
...@@ -349,8 +328,6 @@ class TIntermConstantUnion : public TIntermTyped ...@@ -349,8 +328,6 @@ class TIntermConstantUnion : public TIntermTyped
private: private:
typedef float(*FloatTypeUnaryFunc) (float); typedef float(*FloatTypeUnaryFunc) (float);
bool foldFloatTypeUnary(const TConstantUnion &parameter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, TConstantUnion *result) const; bool foldFloatTypeUnary(const TConstantUnion &parameter, FloatTypeUnaryFunc builtinFunc, TInfoSink &infoSink, TConstantUnion *result) const;
TIntermConstantUnion(const TIntermConstantUnion &node); // Note: not deleted, just private!
}; };
// //
...@@ -376,8 +353,6 @@ class TIntermOperator : public TIntermTyped ...@@ -376,8 +353,6 @@ class TIntermOperator : public TIntermTyped
: TIntermTyped(type), : TIntermTyped(type),
mOp(op) {} mOp(op) {}
TIntermOperator(const TIntermOperator &) = default;
TOperator mOp; TOperator mOp;
}; };
...@@ -391,8 +366,6 @@ class TIntermBinary : public TIntermOperator ...@@ -391,8 +366,6 @@ class TIntermBinary : public TIntermOperator
: TIntermOperator(op), : TIntermOperator(op),
mAddIndexClamp(false) {} mAddIndexClamp(false) {}
TIntermTyped *deepCopy() const override { return new TIntermBinary(*this); }
TIntermBinary *getAsBinaryNode() override { return this; }; TIntermBinary *getAsBinaryNode() override { return this; };
void traverse(TIntermTraverser *it) override; void traverse(TIntermTraverser *it) override;
bool replaceChildNode( bool replaceChildNode(
...@@ -419,9 +392,6 @@ class TIntermBinary : public TIntermOperator ...@@ -419,9 +392,6 @@ class TIntermBinary : public TIntermOperator
// If set to true, wrap any EOpIndexIndirect with a clamp to bounds. // If set to true, wrap any EOpIndexIndirect with a clamp to bounds.
bool mAddIndexClamp; bool mAddIndexClamp;
private:
TIntermBinary(const TIntermBinary &node); // Note: not deleted, just private!
}; };
// //
...@@ -439,8 +409,6 @@ class TIntermUnary : public TIntermOperator ...@@ -439,8 +409,6 @@ class TIntermUnary : public TIntermOperator
mOperand(NULL), mOperand(NULL),
mUseEmulatedFunction(false) {} mUseEmulatedFunction(false) {}
TIntermTyped *deepCopy() const override { return new TIntermUnary(*this); }
void traverse(TIntermTraverser *it) override; void traverse(TIntermTraverser *it) override;
TIntermUnary *getAsUnaryNode() override { return this; } TIntermUnary *getAsUnaryNode() override { return this; }
bool replaceChildNode( bool replaceChildNode(
...@@ -465,9 +433,6 @@ class TIntermUnary : public TIntermOperator ...@@ -465,9 +433,6 @@ class TIntermUnary : public TIntermOperator
// If set to true, replace the built-in function call with an emulated one // If set to true, replace the built-in function call with an emulated one
// to work around driver bugs. // to work around driver bugs.
bool mUseEmulatedFunction; bool mUseEmulatedFunction;
private:
TIntermUnary(const TIntermUnary &node); // note: not deleted, just private!
}; };
typedef TVector<TIntermNode *> TIntermSequence; typedef TVector<TIntermNode *> TIntermSequence;
...@@ -494,9 +459,6 @@ class TIntermAggregate : public TIntermOperator ...@@ -494,9 +459,6 @@ class TIntermAggregate : public TIntermOperator
} }
~TIntermAggregate() { } ~TIntermAggregate() { }
// Note: only supported for nodes that can be a part of an expression.
TIntermTyped *deepCopy() const override { return new TIntermAggregate(*this); }
TIntermAggregate *getAsAggregate() override { return this; } TIntermAggregate *getAsAggregate() override { return this; }
void traverse(TIntermTraverser *it) override; void traverse(TIntermTraverser *it) override;
bool replaceChildNode( bool replaceChildNode(
...@@ -536,6 +498,8 @@ class TIntermAggregate : public TIntermOperator ...@@ -536,6 +498,8 @@ class TIntermAggregate : public TIntermOperator
bool gotPrecisionFromChildren() const { return mGotPrecisionFromChildren; } bool gotPrecisionFromChildren() const { return mGotPrecisionFromChildren; }
protected: protected:
TIntermAggregate(const TIntermAggregate &); // disallow copy constructor
TIntermAggregate &operator=(const TIntermAggregate &); // disallow assignment operator
TIntermSequence mSequence; TIntermSequence mSequence;
TName mName; TName mName;
bool mUserDefined; // used for user defined function names bool mUserDefined; // used for user defined function names
...@@ -549,9 +513,6 @@ class TIntermAggregate : public TIntermOperator ...@@ -549,9 +513,6 @@ class TIntermAggregate : public TIntermOperator
bool mUseEmulatedFunction; bool mUseEmulatedFunction;
bool mGotPrecisionFromChildren; bool mGotPrecisionFromChildren;
private:
TIntermAggregate(const TIntermAggregate &node); // note: not deleted, just private!
}; };
// //
...@@ -572,9 +533,6 @@ class TIntermSelection : public TIntermTyped ...@@ -572,9 +533,6 @@ class TIntermSelection : public TIntermTyped
mTrueBlock(trueB), mTrueBlock(trueB),
mFalseBlock(falseB) {} mFalseBlock(falseB) {}
// Note: only supported for ternary operator nodes.
TIntermTyped *deepCopy() const override { return new TIntermSelection(*this); }
void traverse(TIntermTraverser *it) override; void traverse(TIntermTraverser *it) override;
bool replaceChildNode( bool replaceChildNode(
TIntermNode *original, TIntermNode *replacement) override; TIntermNode *original, TIntermNode *replacement) override;
...@@ -588,13 +546,10 @@ class TIntermSelection : public TIntermTyped ...@@ -588,13 +546,10 @@ class TIntermSelection : public TIntermTyped
TIntermNode *getFalseBlock() const { return mFalseBlock; } TIntermNode *getFalseBlock() const { return mFalseBlock; }
TIntermSelection *getAsSelectionNode() override { return this; } TIntermSelection *getAsSelectionNode() override { return this; }
protected: protected:
TIntermTyped *mCondition; TIntermTyped *mCondition;
TIntermNode *mTrueBlock; TIntermNode *mTrueBlock;
TIntermNode *mFalseBlock; TIntermNode *mFalseBlock;
private:
TIntermSelection(const TIntermSelection &node); // Note: not deleted, just private!
}; };
// //
......
...@@ -269,9 +269,6 @@ class TType ...@@ -269,9 +269,6 @@ class TType
{ {
} }
TType(const TType &) = default;
TType &operator=(const TType &) = default;
TBasicType getBasicType() const TBasicType getBasicType() const
{ {
return type; return type;
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
'<(angle_path)/src/tests/compiler_tests/DebugShaderPrecision_test.cpp', '<(angle_path)/src/tests/compiler_tests/DebugShaderPrecision_test.cpp',
'<(angle_path)/src/tests/compiler_tests/ExpressionLimit_test.cpp', '<(angle_path)/src/tests/compiler_tests/ExpressionLimit_test.cpp',
'<(angle_path)/src/tests/compiler_tests/EXT_blend_func_extended_test.cpp', '<(angle_path)/src/tests/compiler_tests/EXT_blend_func_extended_test.cpp',
'<(angle_path)/src/tests/compiler_tests/IntermNode_test.cpp',
'<(angle_path)/src/tests/compiler_tests/MalformedShader_test.cpp', '<(angle_path)/src/tests/compiler_tests/MalformedShader_test.cpp',
'<(angle_path)/src/tests/compiler_tests/NV_draw_buffers_test.cpp', '<(angle_path)/src/tests/compiler_tests/NV_draw_buffers_test.cpp',
'<(angle_path)/src/tests/compiler_tests/Pack_Unpack_test.cpp', '<(angle_path)/src/tests/compiler_tests/Pack_Unpack_test.cpp',
......
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