// // Copyright 2017 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // IntermTraverse.h : base classes for AST traversers that walk the AST and // also have the ability to transform it by replacing nodes. #ifndef COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_ #define COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_ #include "compiler/translator/IntermNode.h" #include "compiler/translator/tree_util/Visit.h" namespace sh { class TCompiler; class TSymbolTable; class TSymbolUniqueId; // For traversing the tree. User should derive from this class overriding the visit functions, // and then pass an object of the subclass to a traverse method of a node. // // The traverse*() functions may also be overridden to do other bookkeeping on the tree to provide // contextual information to the visit functions, such as whether the node is the target of an // assignment. This is complex to maintain and so should only be done in special cases. // // 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. // // See also how to write AST transformations documentation: // https://github.com/google/angle/blob/master/doc/WritingShaderASTTransformations.md class TIntermTraverser : angle::NonCopyable { … }; // Traverser parent class that tracks where a node is a destination of a write operation and so is // required to be an l-value. class TLValueTrackingTraverser : public TIntermTraverser { … }; } // namespace sh #endif // COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_