1//
2// Copyright (c) 2002-2014 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_TREEOPS_REGENERATESTRUCTNAMES_H_
8#define COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_
9
10#include "compiler/translator/SymbolTable.h"
11#include "compiler/translator/tree_util/IntermTraverse.h"
12
13#include <set>
14
15namespace sh
16{
17
18class RegenerateStructNames : public TIntermTraverser
19{
20 public:
21 RegenerateStructNames(TSymbolTable *symbolTable)
22 : TIntermTraverser(true, false, false, symbolTable), mScopeDepth(0)
23 {}
24
25 protected:
26 void visitSymbol(TIntermSymbol *) override;
27 bool visitBlock(Visit, TIntermBlock *block) override;
28
29 private:
30 // Indicating the depth of the current scope.
31 // The global scope is 1.
32 int mScopeDepth;
33
34 // If a struct's declared globally, push its ID in this set.
35 std::set<int> mDeclaredGlobalStructs;
36};
37
38} // namespace sh
39
40#endif // COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_
41