Commit 1283ef62 by Jamie Madill Committed by Commit Bot

translator: Add TIntermPreprocessorDirective.

This new node type can be used to inject preprocessor directives into the intermediate tree. Outputting the preprocessor directive is easy for the GLSL back-end. This can be used to implement workarounds such as the OpenGL line rasterization rules on Vulkan. Also fixes the build that was broken on Win/x64 with a prior change and makes more methods in IntermNode.h const. Bug: angleproject:2598 Change-Id: Ifd6d0ac7912ccf2137997bb9a0187fd063023d5e Reviewed-on: https://chromium-review.googlesource.com/1133420Reviewed-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 9ff9c773
......@@ -202,34 +202,34 @@ void TIntermExpression::setTypePreservePrecision(const TType &t)
return true; \
}
unsigned int TIntermSymbol::getChildCount()
size_t TIntermSymbol::getChildCount() const
{
return 0;
}
TIntermNode *TIntermSymbol::getChildNode(unsigned int index)
TIntermNode *TIntermSymbol::getChildNode(size_t index) const
{
UNREACHABLE();
return nullptr;
}
unsigned int TIntermConstantUnion::getChildCount()
size_t TIntermConstantUnion::getChildCount() const
{
return 0;
}
TIntermNode *TIntermConstantUnion::getChildNode(unsigned int index)
TIntermNode *TIntermConstantUnion::getChildNode(size_t index) const
{
UNREACHABLE();
return nullptr;
}
unsigned int TIntermLoop::getChildCount()
size_t TIntermLoop::getChildCount() const
{
return (mInit ? 1 : 0) + (mCond ? 1 : 0) + (mExpr ? 1 : 0) + (mBody ? 1 : 0);
}
TIntermNode *TIntermLoop::getChildNode(unsigned int index)
TIntermNode *TIntermLoop::getChildNode(size_t index) const
{
TIntermNode *children[4];
unsigned int childIndex = 0;
......@@ -267,12 +267,12 @@ bool TIntermLoop::replaceChildNode(TIntermNode *original, TIntermNode *replaceme
return false;
}
unsigned int TIntermBranch::getChildCount()
size_t TIntermBranch::getChildCount() const
{
return (mExpression ? 1 : 0);
}
TIntermNode *TIntermBranch::getChildNode(unsigned int index)
TIntermNode *TIntermBranch::getChildNode(size_t index) const
{
ASSERT(mExpression);
ASSERT(index == 0);
......@@ -285,12 +285,12 @@ bool TIntermBranch::replaceChildNode(TIntermNode *original, TIntermNode *replace
return false;
}
unsigned int TIntermSwizzle::getChildCount()
size_t TIntermSwizzle::getChildCount() const
{
return 1;
}
TIntermNode *TIntermSwizzle::getChildNode(unsigned int index)
TIntermNode *TIntermSwizzle::getChildNode(size_t index) const
{
ASSERT(mOperand);
ASSERT(index == 0);
......@@ -304,12 +304,12 @@ bool TIntermSwizzle::replaceChildNode(TIntermNode *original, TIntermNode *replac
return false;
}
unsigned int TIntermBinary::getChildCount()
size_t TIntermBinary::getChildCount() const
{
return 2;
}
TIntermNode *TIntermBinary::getChildNode(unsigned int index)
TIntermNode *TIntermBinary::getChildNode(size_t index) const
{
ASSERT(index < 2);
if (index == 0)
......@@ -326,12 +326,12 @@ bool TIntermBinary::replaceChildNode(TIntermNode *original, TIntermNode *replace
return false;
}
unsigned int TIntermUnary::getChildCount()
size_t TIntermUnary::getChildCount() const
{
return 1;
}
TIntermNode *TIntermUnary::getChildNode(unsigned int index)
TIntermNode *TIntermUnary::getChildNode(size_t index) const
{
ASSERT(mOperand);
ASSERT(index == 0);
......@@ -345,12 +345,12 @@ bool TIntermUnary::replaceChildNode(TIntermNode *original, TIntermNode *replacem
return false;
}
unsigned int TIntermInvariantDeclaration::getChildCount()
size_t TIntermInvariantDeclaration::getChildCount() const
{
return 1;
}
TIntermNode *TIntermInvariantDeclaration::getChildNode(unsigned int index)
TIntermNode *TIntermInvariantDeclaration::getChildNode(size_t index) const
{
ASSERT(mSymbol);
ASSERT(index == 0);
......@@ -363,12 +363,12 @@ bool TIntermInvariantDeclaration::replaceChildNode(TIntermNode *original, TInter
return false;
}
unsigned int TIntermFunctionDefinition::getChildCount()
size_t TIntermFunctionDefinition::getChildCount() const
{
return 2;
}
TIntermNode *TIntermFunctionDefinition::getChildNode(unsigned int index)
TIntermNode *TIntermFunctionDefinition::getChildNode(size_t index) const
{
ASSERT(index < 2);
if (index == 0)
......@@ -385,12 +385,12 @@ bool TIntermFunctionDefinition::replaceChildNode(TIntermNode *original, TIntermN
return false;
}
unsigned int TIntermAggregate::getChildCount()
size_t TIntermAggregate::getChildCount() const
{
return mArguments.size();
}
TIntermNode *TIntermAggregate::getChildNode(unsigned int index)
TIntermNode *TIntermAggregate::getChildNode(size_t index) const
{
return mArguments[index];
}
......@@ -400,12 +400,12 @@ bool TIntermAggregate::replaceChildNode(TIntermNode *original, TIntermNode *repl
return replaceChildNodeInternal(original, replacement);
}
unsigned int TIntermBlock::getChildCount()
size_t TIntermBlock::getChildCount() const
{
return mStatements.size();
}
TIntermNode *TIntermBlock::getChildNode(unsigned int index)
TIntermNode *TIntermBlock::getChildNode(size_t index) const
{
return mStatements[index];
}
......@@ -415,12 +415,12 @@ bool TIntermBlock::replaceChildNode(TIntermNode *original, TIntermNode *replacem
return replaceChildNodeInternal(original, replacement);
}
unsigned int TIntermFunctionPrototype::getChildCount()
size_t TIntermFunctionPrototype::getChildCount() const
{
return 0;
}
TIntermNode *TIntermFunctionPrototype::getChildNode(unsigned int index)
TIntermNode *TIntermFunctionPrototype::getChildNode(size_t index) const
{
UNREACHABLE();
return nullptr;
......@@ -431,12 +431,12 @@ bool TIntermFunctionPrototype::replaceChildNode(TIntermNode *original, TIntermNo
return false;
}
unsigned int TIntermDeclaration::getChildCount()
size_t TIntermDeclaration::getChildCount() const
{
return mDeclarators.size();
}
TIntermNode *TIntermDeclaration::getChildNode(unsigned int index)
TIntermNode *TIntermDeclaration::getChildNode(size_t index) const
{
return mDeclarators[index];
}
......@@ -874,12 +874,12 @@ void TIntermDeclaration::appendDeclarator(TIntermTyped *declarator)
mDeclarators.push_back(declarator);
}
unsigned int TIntermTernary::getChildCount()
size_t TIntermTernary::getChildCount() const
{
return 3;
}
TIntermNode *TIntermTernary::getChildNode(unsigned int index)
TIntermNode *TIntermTernary::getChildNode(size_t index) const
{
ASSERT(index < 3);
if (index == 0)
......@@ -901,12 +901,12 @@ bool TIntermTernary::replaceChildNode(TIntermNode *original, TIntermNode *replac
return false;
}
unsigned int TIntermIfElse::getChildCount()
size_t TIntermIfElse::getChildCount() const
{
return 1 + (mTrueBlock ? 1 : 0) + (mFalseBlock ? 1 : 0);
}
TIntermNode *TIntermIfElse::getChildNode(unsigned int index)
TIntermNode *TIntermIfElse::getChildNode(size_t index) const
{
if (index == 0)
{
......@@ -927,12 +927,12 @@ bool TIntermIfElse::replaceChildNode(TIntermNode *original, TIntermNode *replace
return false;
}
unsigned int TIntermSwitch::getChildCount()
size_t TIntermSwitch::getChildCount() const
{
return 2;
}
TIntermNode *TIntermSwitch::getChildNode(unsigned int index)
TIntermNode *TIntermSwitch::getChildNode(size_t index) const
{
ASSERT(index < 2);
if (index == 0)
......@@ -950,12 +950,12 @@ bool TIntermSwitch::replaceChildNode(TIntermNode *original, TIntermNode *replace
return false;
}
unsigned int TIntermCase::getChildCount()
size_t TIntermCase::getChildCount() const
{
return (mCondition ? 1 : 0);
}
TIntermNode *TIntermCase::getChildNode(unsigned int index)
TIntermNode *TIntermCase::getChildNode(size_t index) const
{
ASSERT(index == 0);
ASSERT(mCondition);
......@@ -3739,4 +3739,23 @@ TConstantUnion *TIntermConstantUnion::FoldAggregateBuiltIn(TIntermAggregate *agg
return resultArray;
}
// TIntermPreprocessorDirective implementation.
TIntermPreprocessorDirective::TIntermPreprocessorDirective(PreprocessorDirective directive,
ImmutableString command)
: mDirective(directive), mCommand(std::move(command))
{
}
TIntermPreprocessorDirective::~TIntermPreprocessorDirective() = default;
size_t TIntermPreprocessorDirective::getChildCount() const
{
return 0;
}
TIntermNode *TIntermPreprocessorDirective::getChildNode(size_t index) const
{
UNREACHABLE();
return nullptr;
}
} // namespace sh
......@@ -24,6 +24,7 @@
#include "common/angleutils.h"
#include "compiler/translator/Common.h"
#include "compiler/translator/ConstantUnion.h"
#include "compiler/translator/ImmutableString.h"
#include "compiler/translator/Operator.h"
#include "compiler/translator/SymbolUniqueId.h"
#include "compiler/translator/Types.h"
......@@ -32,8 +33,6 @@
namespace sh
{
class ImmutableString;
class TDiagnostics;
class TIntermTraverser;
......@@ -57,6 +56,7 @@ class TIntermLoop;
class TInfoSink;
class TInfoSinkBase;
class TIntermBranch;
class TIntermPreprocessorDirective;
class TSymbolTable;
class TFunction;
......@@ -84,27 +84,28 @@ class TIntermNode : angle::NonCopyable
virtual void traverse(TIntermTraverser *it);
virtual bool visit(Visit visit, TIntermTraverser *it) = 0;
virtual TIntermTyped *getAsTyped() { return 0; }
virtual TIntermConstantUnion *getAsConstantUnion() { return 0; }
virtual TIntermTyped *getAsTyped() { return nullptr; }
virtual TIntermConstantUnion *getAsConstantUnion() { return nullptr; }
virtual TIntermFunctionDefinition *getAsFunctionDefinition() { return nullptr; }
virtual TIntermAggregate *getAsAggregate() { return 0; }
virtual TIntermAggregate *getAsAggregate() { return nullptr; }
virtual TIntermBlock *getAsBlock() { return nullptr; }
virtual TIntermFunctionPrototype *getAsFunctionPrototypeNode() { return nullptr; }
virtual TIntermInvariantDeclaration *getAsInvariantDeclarationNode() { return nullptr; }
virtual TIntermDeclaration *getAsDeclarationNode() { return nullptr; }
virtual TIntermSwizzle *getAsSwizzleNode() { return nullptr; }
virtual TIntermBinary *getAsBinaryNode() { return 0; }
virtual TIntermUnary *getAsUnaryNode() { return 0; }
virtual TIntermBinary *getAsBinaryNode() { return nullptr; }
virtual TIntermUnary *getAsUnaryNode() { return nullptr; }
virtual TIntermTernary *getAsTernaryNode() { return nullptr; }
virtual TIntermIfElse *getAsIfElseNode() { return nullptr; }
virtual TIntermSwitch *getAsSwitchNode() { return 0; }
virtual TIntermCase *getAsCaseNode() { return 0; }
virtual TIntermSymbol *getAsSymbolNode() { return 0; }
virtual TIntermLoop *getAsLoopNode() { return 0; }
virtual TIntermBranch *getAsBranchNode() { return 0; }
virtual unsigned int getChildCount() = 0;
virtual TIntermNode *getChildNode(unsigned int index) = 0;
virtual TIntermSwitch *getAsSwitchNode() { return nullptr; }
virtual TIntermCase *getAsCaseNode() { return nullptr; }
virtual TIntermSymbol *getAsSymbolNode() { return nullptr; }
virtual TIntermLoop *getAsLoopNode() { return nullptr; }
virtual TIntermBranch *getAsBranchNode() { return nullptr; }
virtual TIntermPreprocessorDirective *getAsPreprocessorDirective() { return nullptr; }
virtual size_t getChildCount() const = 0;
virtual TIntermNode *getChildNode(size_t index) const = 0;
// Replace a child node. Return true if |original| is a child
// node and it is replaced; otherwise, return false.
virtual bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) = 0;
......@@ -195,8 +196,8 @@ class TIntermLoop : public TIntermNode
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
TLoopType getType() const { return mType; }
......@@ -229,8 +230,8 @@ class TIntermBranch : public TIntermNode
TIntermBranch *getAsBranchNode() override { return this; }
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
TOperator getFlowOp() { return mFlowOp; }
......@@ -266,8 +267,8 @@ class TIntermSymbol : public TIntermTyped
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *, TIntermNode *) override { return false; }
private:
......@@ -337,8 +338,8 @@ class TIntermConstantUnion : public TIntermExpression
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *, TIntermNode *) override { return false; }
TConstantUnion *foldUnaryNonComponentWise(TOperator op);
......@@ -410,8 +411,8 @@ class TIntermSwizzle : public TIntermExpression
TIntermSwizzle *getAsSwizzleNode() override { return this; };
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
bool hasSideEffects() const override { return mOperand->hasSideEffects(); }
......@@ -459,8 +460,8 @@ class TIntermBinary : public TIntermOperator
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
bool hasSideEffects() const override
......@@ -509,8 +510,8 @@ class TIntermUnary : public TIntermOperator
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
bool hasSideEffects() const override { return isAssignment() || mOperand->hasSideEffects(); }
......@@ -589,8 +590,8 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
bool hasSideEffects() const override;
......@@ -658,8 +659,8 @@ class TIntermBlock : public TIntermNode, public TIntermAggregateBase
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
// Only intended for initially building the block.
......@@ -684,8 +685,8 @@ class TIntermFunctionPrototype : public TIntermTyped
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
const TType &getType() const override;
......@@ -723,8 +724,8 @@ class TIntermFunctionDefinition : public TIntermNode
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
TIntermFunctionPrototype *getFunctionPrototype() const { return mPrototype; }
......@@ -747,8 +748,8 @@ class TIntermDeclaration : public TIntermNode, public TIntermAggregateBase
TIntermDeclaration *getAsDeclarationNode() override { return this; }
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
// Only intended for initially building the declaration.
......@@ -773,8 +774,8 @@ class TIntermInvariantDeclaration : public TIntermNode
TIntermSymbol *getSymbol() { return mSymbol; }
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
private:
......@@ -790,8 +791,8 @@ class TIntermTernary : public TIntermExpression
TIntermTernary *getAsTernaryNode() override { return this; }
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
TIntermTyped *getCondition() const { return mCondition; }
......@@ -828,8 +829,8 @@ class TIntermIfElse : public TIntermNode
TIntermIfElse *getAsIfElseNode() override { return this; }
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
TIntermTyped *getCondition() const { return mCondition; }
......@@ -853,8 +854,8 @@ class TIntermSwitch : public TIntermNode
TIntermSwitch *getAsSwitchNode() override { return this; }
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
TIntermTyped *getInit() { return mInit; }
......@@ -879,8 +880,8 @@ class TIntermCase : public TIntermNode
TIntermCase *getAsCaseNode() override { return this; }
bool visit(Visit visit, TIntermTraverser *it) final;
unsigned int getChildCount() final;
TIntermNode *getChildNode(unsigned int index) final;
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
bool replaceChildNode(TIntermNode *original, TIntermNode *replacement) override;
bool hasCondition() const { return mCondition != nullptr; }
......@@ -890,6 +891,42 @@ class TIntermCase : public TIntermNode
TIntermTyped *mCondition;
};
//
// Preprocessor Directive.
// #ifdef, #define, #if, #endif, etc.
//
enum class PreprocessorDirective
{
Define,
Ifdef,
If,
Endif,
};
class TIntermPreprocessorDirective : public TIntermNode
{
public:
// This could also take an ImmutbleString as an argument.
TIntermPreprocessorDirective(PreprocessorDirective directive, ImmutableString command);
~TIntermPreprocessorDirective() final;
void traverse(TIntermTraverser *it) final;
bool visit(Visit visit, TIntermTraverser *it) final;
bool replaceChildNode(TIntermNode *, TIntermNode *) final { return false; }
TIntermPreprocessorDirective *getAsPreprocessorDirective() final { return this; }
size_t getChildCount() const final;
TIntermNode *getChildNode(size_t index) const final;
PreprocessorDirective getDirective() const { return mDirective; }
const ImmutableString &getCommand() const { return mCommand; }
private:
PreprocessorDirective mDirective;
ImmutableString mCommand;
};
} // namespace sh
#endif // COMPILER_TRANSLATOR_INTERMNODE_H_
......@@ -46,6 +46,10 @@ bool isSingleStatement(TIntermNode *node)
{
return false;
}
else if (node->getAsPreprocessorDirective())
{
return false;
}
return true;
}
......@@ -1113,6 +1117,40 @@ void TOutputGLSLBase::visitCodeBlock(TIntermBlock *node)
}
}
void TOutputGLSLBase::visitPreprocessorDirective(TIntermPreprocessorDirective *node)
{
TInfoSinkBase &out = objSink();
out << "\n";
switch (node->getDirective())
{
case PreprocessorDirective::Define:
out << "#define";
break;
case PreprocessorDirective::Endif:
out << "#endif";
break;
case PreprocessorDirective::If:
out << "#if";
break;
case PreprocessorDirective::Ifdef:
out << "#ifdef";
break;
default:
UNREACHABLE();
break;
}
if (!node->getCommand().empty())
{
out << " " << node->getCommand();
}
out << "\n";
}
ImmutableString TOutputGLSLBase::getTypeName(const TType &type)
{
return GetTypeName(type, mHashFunction, &mNameMap);
......
......@@ -66,6 +66,7 @@ class TOutputGLSLBase : public TIntermTraverser
bool visitDeclaration(Visit visit, TIntermDeclaration *node) override;
bool visitLoop(Visit visit, TIntermLoop *node) override;
bool visitBranch(Visit visit, TIntermBranch *node) override;
void visitPreprocessorDirective(TIntermPreprocessorDirective *node) override;
void visitCodeBlock(TIntermBlock *node);
......
......@@ -32,8 +32,8 @@ void TIntermTraverser::traverse(T *node)
if (visit)
{
unsigned int childIndex = 0;
unsigned int childCount = node->getChildCount();
size_t childIndex = 0;
size_t childCount = node->getChildCount();
while (childIndex < childCount && visit)
{
......@@ -103,6 +103,11 @@ void TIntermLoop::traverse(TIntermTraverser *it)
it->traverseLoop(this);
}
void TIntermPreprocessorDirective::traverse(TIntermTraverser *it)
{
it->visitPreprocessorDirective(this);
}
bool TIntermSymbol::visit(Visit visit, TIntermTraverser *it)
{
it->visitSymbol(this);
......@@ -191,6 +196,12 @@ bool TIntermCase::visit(Visit visit, TIntermTraverser *it)
return it->visitCase(visit, this);
}
bool TIntermPreprocessorDirective::visit(Visit visit, TIntermTraverser *it)
{
it->visitPreprocessorDirective(this);
return false;
}
TIntermTraverser::TIntermTraverser(bool preVisit,
bool inVisit,
bool postVisit,
......@@ -614,5 +625,4 @@ void TIntermTraverser::traverseLoop(TIntermLoop *node)
{
traverse(node);
}
} // namespace sh
......@@ -63,6 +63,7 @@ class TIntermTraverser : angle::NonCopyable
virtual bool visitDeclaration(Visit visit, TIntermDeclaration *node) { return true; }
virtual bool visitLoop(Visit visit, TIntermLoop *node) { return true; }
virtual bool visitBranch(Visit visit, TIntermBranch *node) { return true; }
virtual void visitPreprocessorDirective(TIntermPreprocessorDirective *node) {}
// The traverse functions contain logic for iterating over the children of the node
// and calling the visit functions in the appropriate places. They also track some
......
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