• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2020 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 
7 #ifndef COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_DISCOVERENCLOSINGFUNCTIONTRAVERSER_H_
8 #define COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_DISCOVERENCLOSINGFUNCTIONTRAVERSER_H_
9 
10 #include "compiler/translator/tree_util/IntermTraverse.h"
11 
12 namespace sh
13 {
14 
15 // A TIntermTraverser that supports discovery of the function a node belongs to.
16 class DiscoverEnclosingFunctionTraverser : public TIntermTraverser
17 {
18   public:
19     DiscoverEnclosingFunctionTraverser(bool preVisit,
20                                        bool inVisit,
21                                        bool postVisit,
22                                        TSymbolTable *symbolTable = nullptr);
23 
24     // Returns the function a node belongs inside.
25     // Returns null if the node does not belong inside a function.
26     const TFunction *discoverEnclosingFunction(TIntermNode *node);
27 };
28 
29 }  // namespace sh
30 
31 #endif  // COMPILER_TRANSLATOR_TRANSLATORMETALDIRECT_DISCOVERENCLOSINGFUNCTIONTRAVERSER_H_
32