Replace non-copyable macro with a helper class.
This class provides a simpler scheme for blocking default copy
and assignment operators. It also reduces the amount of code
needed since it's inherited to child classes. This also fixes
the conflict between our macro and the same-named macro in
Chromium code.
BUG=angleproject:956
Change-Id: If0dc72aa3f63fbc7b8fa34907418821c64c39e2f
Reviewed-on: https://chromium-review.googlesource.com/263257
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
diff --git a/src/compiler/translator/Diagnostics.h b/src/compiler/translator/Diagnostics.h
index 06608c1..078bc97 100644
--- a/src/compiler/translator/Diagnostics.h
+++ b/src/compiler/translator/Diagnostics.h
@@ -12,7 +12,7 @@
class TInfoSink;
-class TDiagnostics : public pp::Diagnostics
+class TDiagnostics : public pp::Diagnostics, angle::NonCopyable
{
public:
TDiagnostics(TInfoSink& infoSink);
@@ -37,8 +37,6 @@
const std::string& text);
private:
- DISALLOW_COPY_AND_ASSIGN(TDiagnostics);
-
TInfoSink& mInfoSink;
int mNumErrors;
int mNumWarnings;
diff --git a/src/compiler/translator/DirectiveHandler.h b/src/compiler/translator/DirectiveHandler.h
index f7b34da..2a81ee5 100644
--- a/src/compiler/translator/DirectiveHandler.h
+++ b/src/compiler/translator/DirectiveHandler.h
@@ -14,7 +14,7 @@
class TDiagnostics;
-class TDirectiveHandler : public pp::DirectiveHandler
+class TDirectiveHandler : public pp::DirectiveHandler, angle::NonCopyable
{
public:
TDirectiveHandler(TExtensionBehavior& extBehavior,
@@ -42,8 +42,6 @@
int version);
private:
- DISALLOW_COPY_AND_ASSIGN(TDirectiveHandler);
-
TPragma mPragma;
TExtensionBehavior& mExtensionBehavior;
TDiagnostics& mDiagnostics;
diff --git a/src/compiler/translator/EmulatePrecision.h b/src/compiler/translator/EmulatePrecision.h
index 4b4c5b9..f1f560a 100644
--- a/src/compiler/translator/EmulatePrecision.h
+++ b/src/compiler/translator/EmulatePrecision.h
@@ -30,8 +30,6 @@
void writeEmulationHelpers(TInfoSinkBase& sink, ShShaderOutput outputLanguage);
private:
- DISALLOW_COPY_AND_ASSIGN(EmulatePrecision);
-
struct TypePair
{
TypePair(const char *l, const char *r)
diff --git a/src/compiler/translator/IntermNode.h b/src/compiler/translator/IntermNode.h
index 0d02e2c..f2de2d9 100644
--- a/src/compiler/translator/IntermNode.h
+++ b/src/compiler/translator/IntermNode.h
@@ -560,7 +560,7 @@
// When using this, just fill in the methods for nodes you want visited.
// Return false from a pre-visit to skip visiting that node's subtree.
//
-class TIntermTraverser
+class TIntermTraverser : angle::NonCopyable
{
public:
POOL_ALLOCATOR_NEW_DELETE();
@@ -648,9 +648,6 @@
// During traversing, save all the changes that need to happen into
// mReplacements, then do them by calling updateTree().
std::vector<NodeUpdateEntry> mReplacements;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TIntermTraverser);
};
//
@@ -676,9 +673,6 @@
bool depthCheck() const { return mMaxDepth < mDepthLimit; }
int mDepthLimit;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TMaxDepthTraverser);
};
#endif // COMPILER_TRANSLATOR_INTERMNODE_H_
diff --git a/src/compiler/translator/StructureHLSL.h b/src/compiler/translator/StructureHLSL.h
index c62150a..cffe2a4 100644
--- a/src/compiler/translator/StructureHLSL.h
+++ b/src/compiler/translator/StructureHLSL.h
@@ -44,7 +44,7 @@
const std::map<TString, int> *mStructElementIndexes;
};
-class StructureHLSL
+class StructureHLSL : angle::NonCopyable
{
public:
StructureHLSL();
@@ -58,8 +58,6 @@
Std140PaddingHelper getPaddingHelper();
private:
- DISALLOW_COPY_AND_ASSIGN(StructureHLSL);
-
unsigned mUniquePaddingCounter;
std::map<TString, int> mStd140StructElementIndexes;
diff --git a/src/compiler/translator/SymbolTable.h b/src/compiler/translator/SymbolTable.h
index 397e4d6..dfc65cb 100644
--- a/src/compiler/translator/SymbolTable.h
+++ b/src/compiler/translator/SymbolTable.h
@@ -38,7 +38,7 @@
#include "compiler/translator/IntermNode.h"
// Symbol base class. (Can build functions or variables out of these...)
-class TSymbol
+class TSymbol : angle::NonCopyable
{
public:
POOL_ALLOCATOR_NEW_DELETE();
@@ -86,8 +86,6 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(TSymbol);
-
int uniqueId; // For real comparing during code generation
const TString *name;
TString extension;
@@ -158,8 +156,6 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(TVariable);
-
TType type;
bool userType;
// we are assuming that Pool Allocator will free the memory
@@ -249,8 +245,6 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(TFunction);
-
typedef TVector<TParameter> TParamList;
TParamList parameters;
TType returnType;
@@ -307,7 +301,7 @@
const int LAST_BUILTIN_LEVEL = ESSL3_BUILTINS;
const int GLOBAL_LEVEL = 3;
-class TSymbolTable
+class TSymbolTable : angle::NonCopyable
{
public:
TSymbolTable()
diff --git a/src/compiler/translator/Types.h b/src/compiler/translator/Types.h
index 54fbfdb..044f22c 100644
--- a/src/compiler/translator/Types.h
+++ b/src/compiler/translator/Types.h
@@ -17,7 +17,7 @@
class TType;
class TSymbol;
-class TField
+class TField : angle::NonCopyable
{
public:
POOL_ALLOCATOR_NEW_DELETE();
@@ -49,7 +49,6 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(TField);
TType *mType;
TString *mName;
TSourceLoc mLine;
@@ -62,7 +61,7 @@
return new(memory) TFieldList;
}
-class TFieldListCollection
+class TFieldListCollection : angle::NonCopyable
{
public:
const TString &name() const
@@ -151,8 +150,6 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(TStructure);
-
// TODO(zmo): Find a way to get rid of the const_cast in function
// setName(). At the moment keep this function private so only
// friend class RegenerateStructNames may call it.
@@ -214,7 +211,6 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(TInterfaceBlock);
virtual TString mangledNamePrefix() const
{
return "iblock-";
diff --git a/src/compiler/translator/UnfoldShortCircuitAST.h b/src/compiler/translator/UnfoldShortCircuitAST.h
index 1ae36d3..7b698cc 100644
--- a/src/compiler/translator/UnfoldShortCircuitAST.h
+++ b/src/compiler/translator/UnfoldShortCircuitAST.h
@@ -23,9 +23,6 @@
UnfoldShortCircuitAST() { }
virtual bool visitBinary(Visit visit, TIntermBinary *);
-
- private:
- DISALLOW_COPY_AND_ASSIGN(UnfoldShortCircuitAST);
};
#endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_
diff --git a/src/compiler/translator/UniformHLSL.h b/src/compiler/translator/UniformHLSL.h
index 3032df3..4ab9ccd 100644
--- a/src/compiler/translator/UniformHLSL.h
+++ b/src/compiler/translator/UniformHLSL.h
@@ -16,7 +16,7 @@
{
class StructureHLSL;
-class UniformHLSL
+class UniformHLSL : angle::NonCopyable
{
public:
UniformHLSL(StructureHLSL *structureHLSL, ShShaderOutput outputType, const std::vector<Uniform> &uniforms);
@@ -39,8 +39,6 @@
}
private:
- DISALLOW_COPY_AND_ASSIGN(UniformHLSL);
-
TString interfaceBlockString(const TInterfaceBlock &interfaceBlock, unsigned int registerIndex, unsigned int arrayIndex);
TString interfaceBlockMembersString(const TInterfaceBlock &interfaceBlock, TLayoutBlockStorage blockStorage);
TString interfaceBlockStructString(const TInterfaceBlock &interfaceBlock);
diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index b9cf3a4..cf229ec 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -335,8 +335,6 @@
{}
private:
- DISALLOW_COPY_AND_ASSIGN(NameHashingTraverser);
-
virtual void visitVariable(ShaderVariable *variable)
{
TString stringName = TString(variable->name.c_str());
diff --git a/src/compiler/translator/VariableInfo.h b/src/compiler/translator/VariableInfo.h
index 6b752ad..bb1328a 100644
--- a/src/compiler/translator/VariableInfo.h
+++ b/src/compiler/translator/VariableInfo.h
@@ -33,8 +33,6 @@
virtual bool visitBinary(Visit visit, TIntermBinary *binaryNode);
private:
- DISALLOW_COPY_AND_ASSIGN(CollectVariables);
-
template <typename VarT>
void visitVariable(const TIntermSymbol *variable, std::vector<VarT> *infoList) const;
diff --git a/src/compiler/translator/depgraph/DependencyGraph.h b/src/compiler/translator/depgraph/DependencyGraph.h
index a2b3b20..22db633 100644
--- a/src/compiler/translator/depgraph/DependencyGraph.h
+++ b/src/compiler/translator/depgraph/DependencyGraph.h
@@ -186,7 +186,7 @@
//
// When using this, just fill in the methods for nodes you want visited.
//
-class TDependencyGraphTraverser {
+class TDependencyGraphTraverser : angle::NonCopyable {
public:
TDependencyGraphTraverser() : mDepth(0) {}
diff --git a/src/compiler/translator/depgraph/DependencyGraphBuilder.h b/src/compiler/translator/depgraph/DependencyGraphBuilder.h
index 16a3738..f7b3bd4 100644
--- a/src/compiler/translator/depgraph/DependencyGraphBuilder.h
+++ b/src/compiler/translator/depgraph/DependencyGraphBuilder.h
@@ -104,7 +104,7 @@
// An instance of this class pushes a new node set when instantiated.
// When the instance goes out of scope, it and pops the node set.
//
- class TNodeSetMaintainer
+ class TNodeSetMaintainer : angle::NonCopyable
{
public:
TNodeSetMaintainer(TDependencyGraphBuilder *factory)
@@ -115,9 +115,6 @@
~TNodeSetMaintainer() { mSets.popSet(); }
protected:
TNodeSetStack &mSets;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TNodeSetMaintainer);
};
//
@@ -125,7 +122,7 @@
// When the instance goes out of scope, it and pops the top node set and adds
// its contents to the new top node set.
//
- class TNodeSetPropagatingMaintainer
+ class TNodeSetPropagatingMaintainer : angle::NonCopyable
{
public:
TNodeSetPropagatingMaintainer(TDependencyGraphBuilder *factory)
@@ -136,8 +133,6 @@
~TNodeSetPropagatingMaintainer() { mSets.popSetIntoNext(); }
protected:
TNodeSetStack &mSets;
- private:
- DISALLOW_COPY_AND_ASSIGN(TNodeSetPropagatingMaintainer);
};
//
@@ -152,7 +147,7 @@
// kRightSubtree will never be replaced by a real symbol because we are tracking
// the leftmost symbol.
//
- class TLeftmostSymbolMaintainer
+ class TLeftmostSymbolMaintainer : angle::NonCopyable
{
public:
TLeftmostSymbolMaintainer(
@@ -174,8 +169,6 @@
protected:
TSymbolStack& mLeftmostSymbols;
bool mNeedsPlaceholderSymbol;
- private:
- DISALLOW_COPY_AND_ASSIGN(TLeftmostSymbolMaintainer);
};
TDependencyGraphBuilder(TDependencyGraph *graph)
diff --git a/src/compiler/translator/depgraph/DependencyGraphOutput.h b/src/compiler/translator/depgraph/DependencyGraphOutput.h
index dbed837..b201e0a 100644
--- a/src/compiler/translator/depgraph/DependencyGraphOutput.h
+++ b/src/compiler/translator/depgraph/DependencyGraphOutput.h
@@ -23,8 +23,6 @@
void outputAllSpanningTrees(TDependencyGraph& graph);
private:
- DISALLOW_COPY_AND_ASSIGN(TDependencyGraphOutput);
-
void outputIndentation();
TInfoSinkBase& mSink;
diff --git a/src/compiler/translator/timing/RestrictFragmentShaderTiming.h b/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
index f001745..b8c7e82 100644
--- a/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
+++ b/src/compiler/translator/timing/RestrictFragmentShaderTiming.h
@@ -25,8 +25,6 @@
void visitLogicalOp(TGraphLogicalOp *logicalOp) override;
private:
- DISALLOW_COPY_AND_ASSIGN(RestrictFragmentShaderTiming);
-
void beginError(const TIntermNode *node);
void validateUserDefinedFunctionCallUsage(const TDependencyGraph &graph);
bool isSamplingOp(const TIntermAggregate *intermFunctionCall) const;
diff --git a/src/compiler/translator/util.h b/src/compiler/translator/util.h
index da71610..68bae66 100644
--- a/src/compiler/translator/util.h
+++ b/src/compiler/translator/util.h
@@ -37,7 +37,7 @@
InterpolationType GetInterpolationType(TQualifier qualifier);
TString ArrayString(const TType &type);
-class GetVariableTraverser
+class GetVariableTraverser : angle::NonCopyable
{
public:
GetVariableTraverser(const TSymbolTable &symbolTable);
@@ -57,8 +57,6 @@
const TType &type, const TString &name, VarT *variable) {}
const TSymbolTable &mSymbolTable;
-
- DISALLOW_COPY_AND_ASSIGN(GetVariableTraverser);
};
}