Clean up TIntermTraverser usage
Remove default parameters from TIntermTraverser.
Also clean up a few dead function declarations in traversers.
TEST=angle_unittests, angle_end2end_tests
BUG=angleproject:1037
Change-Id: I8d126c6c2d5b53e8b14e23e3d102f204a59323b3
Reviewed-on: https://chromium-review.googlesource.com/275184
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/BuiltInFunctionEmulator.cpp b/src/compiler/translator/BuiltInFunctionEmulator.cpp
index 2005f54..80dbf8f 100644
--- a/src/compiler/translator/BuiltInFunctionEmulator.cpp
+++ b/src/compiler/translator/BuiltInFunctionEmulator.cpp
@@ -12,7 +12,8 @@
{
public:
BuiltInFunctionEmulationMarker(BuiltInFunctionEmulator &emulator)
- : mEmulator(emulator)
+ : TIntermTraverser(true, false, false),
+ mEmulator(emulator)
{
}
diff --git a/src/compiler/translator/FlagStd140Structs.h b/src/compiler/translator/FlagStd140Structs.h
index 07b9a72..53630c8 100644
--- a/src/compiler/translator/FlagStd140Structs.h
+++ b/src/compiler/translator/FlagStd140Structs.h
@@ -18,6 +18,12 @@
class FlagStd140Structs : public TIntermTraverser
{
public:
+
+ FlagStd140Structs()
+ : TIntermTraverser(true, false, false)
+ {
+ }
+
const std::vector<TIntermTyped *> getFlaggedNodes() const { return mFlaggedNodes; }
protected:
diff --git a/src/compiler/translator/ForLoopUnroll.h b/src/compiler/translator/ForLoopUnroll.h
index c8787d5..f0a62dc 100644
--- a/src/compiler/translator/ForLoopUnroll.h
+++ b/src/compiler/translator/ForLoopUnroll.h
@@ -25,7 +25,8 @@
};
ForLoopUnrollMarker(UnrollCondition condition)
- : mUnrollCondition(condition),
+ : TIntermTraverser(true, false, false),
+ mUnrollCondition(condition),
mSamplerArrayIndexIsFloatLoopIndex(false),
mVisitSamplerArrayIndexNodeInsideLoop(false)
{
diff --git a/src/compiler/translator/InitializeVariables.h b/src/compiler/translator/InitializeVariables.h
index 2e87611..44f377a 100644
--- a/src/compiler/translator/InitializeVariables.h
+++ b/src/compiler/translator/InitializeVariables.h
@@ -26,7 +26,8 @@
typedef TVector<InitVariableInfo> InitVariableInfoList;
InitializeVariables(const InitVariableInfoList &vars)
- : mVariables(vars),
+ : TIntermTraverser(true, false, false),
+ mVariables(vars),
mCodeInserted(false)
{
}
diff --git a/src/compiler/translator/IntermNode.h b/src/compiler/translator/IntermNode.h
index ddef33d..e90797c 100644
--- a/src/compiler/translator/IntermNode.h
+++ b/src/compiler/translator/IntermNode.h
@@ -587,8 +587,7 @@
{
public:
POOL_ALLOCATOR_NEW_DELETE();
- // TODO(zmo): remove default values.
- TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false)
+ TIntermTraverser(bool preVisit, bool inVisit, bool postVisit)
: preVisit(preVisit),
inVisit(inVisit),
postVisit(postVisit),
diff --git a/src/compiler/translator/NodeSearch.h b/src/compiler/translator/NodeSearch.h
index a0fbe65..b13b1ba 100644
--- a/src/compiler/translator/NodeSearch.h
+++ b/src/compiler/translator/NodeSearch.h
@@ -19,7 +19,8 @@
{
public:
NodeSearchTraverser()
- : mFound(false)
+ : TIntermTraverser(true, false, false),
+ mFound(false)
{}
bool found() const { return mFound; }
diff --git a/src/compiler/translator/RegenerateStructNames.h b/src/compiler/translator/RegenerateStructNames.h
index 2acd68b..2bc4d82 100644
--- a/src/compiler/translator/RegenerateStructNames.h
+++ b/src/compiler/translator/RegenerateStructNames.h
@@ -17,7 +17,8 @@
public:
RegenerateStructNames(const TSymbolTable &symbolTable,
int shaderVersion)
- : mSymbolTable(symbolTable),
+ : TIntermTraverser(true, false, false),
+ mSymbolTable(symbolTable),
mShaderVersion(shaderVersion),
mScopeDepth(0) {}
diff --git a/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h b/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
index 0726ed4..48d8fb1 100644
--- a/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
+++ b/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h
@@ -14,7 +14,8 @@
public:
ScalarizeVecAndMatConstructorArgs(sh::GLenum shaderType,
bool fragmentPrecisionHigh)
- : mTempVarCount(0),
+ : TIntermTraverser(true, false, false),
+ mTempVarCount(0),
mShaderType(shaderType),
mFragmentPrecisionHigh(fragmentPrecisionHigh) {}
diff --git a/src/compiler/translator/SearchSymbol.cpp b/src/compiler/translator/SearchSymbol.cpp
index fb7a6cd..cccd4d3 100644
--- a/src/compiler/translator/SearchSymbol.cpp
+++ b/src/compiler/translator/SearchSymbol.cpp
@@ -12,7 +12,9 @@
namespace sh
{
-SearchSymbol::SearchSymbol(const TString &symbol) : mSymbol(symbol)
+SearchSymbol::SearchSymbol(const TString &symbol)
+ : TIntermTraverser(true, false, false),
+ mSymbol(symbol)
{
match = false;
}
diff --git a/src/compiler/translator/SeparateExpressionsReturningArrays.cpp b/src/compiler/translator/SeparateExpressionsReturningArrays.cpp
index a2070e8..f409965 100644
--- a/src/compiler/translator/SeparateExpressionsReturningArrays.cpp
+++ b/src/compiler/translator/SeparateExpressionsReturningArrays.cpp
@@ -22,7 +22,6 @@
public:
SeparateExpressionsTraverser();
- void traverse(TIntermNode *node);
bool visitBinary(Visit visit, TIntermBinary *node) override;
bool visitAggregate(Visit visit, TIntermAggregate *node) override;
diff --git a/src/compiler/translator/TranslatorGLSL.cpp b/src/compiler/translator/TranslatorGLSL.cpp
index c76a7ab..96e5b6f 100644
--- a/src/compiler/translator/TranslatorGLSL.cpp
+++ b/src/compiler/translator/TranslatorGLSL.cpp
@@ -21,7 +21,8 @@
{
public:
TFragmentOutSearcher()
- : mUsesGlFragColor(false),
+ : TIntermTraverser(true, false, false),
+ mUsesGlFragColor(false),
mUsesGlFragData(false)
{
}
diff --git a/src/compiler/translator/UnfoldShortCircuitAST.h b/src/compiler/translator/UnfoldShortCircuitAST.h
index 7b698cc..ccf414f 100644
--- a/src/compiler/translator/UnfoldShortCircuitAST.h
+++ b/src/compiler/translator/UnfoldShortCircuitAST.h
@@ -20,7 +20,10 @@
class UnfoldShortCircuitAST : public TIntermTraverser
{
public:
- UnfoldShortCircuitAST() { }
+ UnfoldShortCircuitAST()
+ : TIntermTraverser(true, false, false)
+ {
+ }
virtual bool visitBinary(Visit visit, TIntermBinary *);
};
diff --git a/src/compiler/translator/UnfoldShortCircuitToIf.cpp b/src/compiler/translator/UnfoldShortCircuitToIf.cpp
index dfaf388..33b787a 100644
--- a/src/compiler/translator/UnfoldShortCircuitToIf.cpp
+++ b/src/compiler/translator/UnfoldShortCircuitToIf.cpp
@@ -21,7 +21,6 @@
public:
UnfoldShortCircuitTraverser();
- void traverse(TIntermNode *node);
bool visitBinary(Visit visit, TIntermBinary *node) override;
bool visitAggregate(Visit visit, TIntermAggregate *node) override;
bool visitSelection(Visit visit, TIntermSelection *node) override;
diff --git a/src/compiler/translator/ValidateLimitations.cpp b/src/compiler/translator/ValidateLimitations.cpp
index e247a28..efb0601 100644
--- a/src/compiler/translator/ValidateLimitations.cpp
+++ b/src/compiler/translator/ValidateLimitations.cpp
@@ -26,7 +26,11 @@
{
public:
ValidateConstIndexExpr(TLoopStack& stack)
- : mValid(true), mLoopStack(stack) {}
+ : TIntermTraverser(true, false, false),
+ mValid(true),
+ mLoopStack(stack)
+ {
+ }
// Returns true if the parsed node represents a constant index expression.
bool isValid() const { return mValid; }
@@ -51,7 +55,8 @@
ValidateLimitations::ValidateLimitations(sh::GLenum shaderType,
TInfoSinkBase &sink)
- : mShaderType(shaderType),
+ : TIntermTraverser(true, false, false),
+ mShaderType(shaderType),
mSink(sink),
mNumErrors(0)
{
diff --git a/src/compiler/translator/ValidateOutputs.cpp b/src/compiler/translator/ValidateOutputs.cpp
index ac1c10d..614d790 100644
--- a/src/compiler/translator/ValidateOutputs.cpp
+++ b/src/compiler/translator/ValidateOutputs.cpp
@@ -10,7 +10,8 @@
#include "compiler/translator/ParseContext.h"
ValidateOutputs::ValidateOutputs(TInfoSinkBase& sink, int maxDrawBuffers)
- : mSink(sink),
+ : TIntermTraverser(true, false, false),
+ mSink(sink),
mMaxDrawBuffers(maxDrawBuffers),
mNumErrors(0),
mHasUnspecifiedOutputLocation(false)
diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index 808db95..1075f36 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -134,7 +134,8 @@
std::vector<sh::InterfaceBlock> *interfaceBlocks,
ShHashFunction64 hashFunction,
const TSymbolTable &symbolTable)
- : mAttribs(attribs),
+ : TIntermTraverser(true, false, false),
+ mAttribs(attribs),
mOutputVariables(outputVariables),
mUniforms(uniforms),
mVaryings(varyings),
diff --git a/src/compiler/translator/VersionGLSL.cpp b/src/compiler/translator/VersionGLSL.cpp
index 7e6d4cb..acb46dc 100644
--- a/src/compiler/translator/VersionGLSL.cpp
+++ b/src/compiler/translator/VersionGLSL.cpp
@@ -32,6 +32,7 @@
TVersionGLSL::TVersionGLSL(sh::GLenum type,
const TPragma &pragma,
ShShaderOutput output)
+ : TIntermTraverser(true, false, false)
{
if (output == SH_GLSL_130_OUTPUT)
{
diff --git a/src/compiler/translator/intermOut.cpp b/src/compiler/translator/intermOut.cpp
index d90aa25..0545839 100644
--- a/src/compiler/translator/intermOut.cpp
+++ b/src/compiler/translator/intermOut.cpp
@@ -27,7 +27,10 @@
{
public:
TOutputTraverser(TInfoSinkBase &i)
- : sink(i) { }
+ : TIntermTraverser(true, false, false),
+ sink(i)
+ {
+ }
TInfoSinkBase& sink;
protected:
diff --git a/src/compiler/translator/parseConst.cpp b/src/compiler/translator/parseConst.cpp
index 2ace877..9c23551 100644
--- a/src/compiler/translator/parseConst.cpp
+++ b/src/compiler/translator/parseConst.cpp
@@ -15,7 +15,8 @@
public:
TConstTraverser(TConstantUnion *cUnion, bool singleConstParam,
TOperator constructType, TInfoSink &sink, TType &t)
- : error(false),
+ : TIntermTraverser(true, false, false),
+ error(false),
mIndex(0),
mUnionArray(cUnion),
mType(t),