zenilib: zenilib/jni/external/angle/src/compiler/RemoveTree.cpp Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RemoveTree.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2002-2010 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 #include "compiler/intermediate.h"
8 #include "compiler/RemoveTree.h"
9
10 //
11 // Code to recursively delete the intermediate tree.
12 //
13
14 class RemoveTree : public TIntermTraverser
15 {
16 public:
17 RemoveTree() : TIntermTraverser(false, false, true)
18 {
19 }
20
21 protected:
22 void visitSymbol(TIntermSymbol*);
23 void visitConstantUnion(TIntermConstantUnion*);
24 bool visitBinary(Visit visit, TIntermBinary*);
25 bool visitUnary(Visit visit, TIntermUnary*);
26 bool visitSelection(Visit visit, TIntermSelection*);
27 bool visitAggregate(Visit visit, TIntermAggregate*);
28 };
29
30 void RemoveTree::visitSymbol(TIntermSymbol* node)
31 {
32 delete node;
33 }
34
35 bool RemoveTree::visitBinary(Visit visit, TIntermBinary* node)
36 {
37 delete node;
38
39 return true;
40 }
41
42 bool RemoveTree::visitUnary(Visit visit, TIntermUnary* node)
43 {
44 delete node;
45
46 return true;
47 }
48
49 bool RemoveTree::visitAggregate(Visit visit, TIntermAggregate* node)
50 {
51 delete node;
52
53 return true;
54 }
55
56 bool RemoveTree::visitSelection(Visit visit, TIntermSelection* node)
57 {
58 delete node;
59
60 return true;
61 }
62
63 void RemoveTree::visitConstantUnion(TIntermConstantUnion* node)
64 {
65 delete node;
66 }
67
68 //
69 // Entry point.
70 //
71 void RemoveAllTreeNodes(TIntermNode* root)
72 {
73 RemoveTree it;
74
75 root->traverse(&it);
76 }
77
Visit
Visit
Definition: intermediate.h:524
TIntermTraverser::visitAggregate
virtual bool visitAggregate(Visit visit, TIntermAggregate *)
Definition: intermediate.h:557
intermediate.h
TIntermAggregate
Definition: intermediate.h:460
TIntermBinary
Definition: intermediate.h:404
TIntermSelection
Definition: intermediate.h:503
TIntermTraverser::visitUnary
virtual bool visitUnary(Visit visit, TIntermUnary *)
Definition: intermediate.h:555
TIntermTraverser::visitSymbol
virtual void visitSymbol(TIntermSymbol *)
Definition: intermediate.h:552
TIntermTraverser::visitBinary
virtual bool visitBinary(Visit visit, TIntermBinary *)
Definition: intermediate.h:554
true
#define true
Definition: ftrandom.c:49
RemoveAllTreeNodes
void RemoveAllTreeNodes(TIntermNode *root)
Definition: RemoveTree.cpp:71
TIntermNode::traverse
virtual void traverse(TIntermTraverser *)=0
TIntermTraverser
Definition: intermediate.h:539
TIntermTraverser::visitSelection
virtual bool visitSelection(Visit visit, TIntermSelection *)
Definition: intermediate.h:556
RemoveTree.h
TIntermSymbol
Definition: intermediate.h:340
TIntermTraverser::visitConstantUnion
virtual void visitConstantUnion(TIntermConstantUnion *)
Definition: intermediate.h:553
TIntermUnary
Definition: intermediate.h:431
TIntermNode
Definition: intermediate.h:206
false
#define false
Definition: ftrandom.c:50
TIntermConstantUnion
Definition: intermediate.h:365