summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/RemoveTree.cpp
blob: 92e5dbbfe148e5cc399471b778da679a1927e757 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// Copyright (c) 2002-2010 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.
//

#include "compiler/translator/intermediate.h"
#include "compiler/translator/RemoveTree.h"

//
// Code to recursively delete the intermediate tree.
//

class RemoveTree : public TIntermTraverser
{
public:
	RemoveTree() : TIntermTraverser(false, false, true)
	{
	}

protected:
	void visitSymbol(TIntermSymbol*);
	void visitConstantUnion(TIntermConstantUnion*);
	bool visitBinary(Visit visit, TIntermBinary*);
	bool visitUnary(Visit visit, TIntermUnary*);
	bool visitSelection(Visit visit, TIntermSelection*);
	bool visitAggregate(Visit visit, TIntermAggregate*);
};

void RemoveTree::visitSymbol(TIntermSymbol* node)
{
	delete node;
}

bool RemoveTree::visitBinary(Visit visit, TIntermBinary* node)
{
	delete node;

	return true;
}

bool RemoveTree::visitUnary(Visit visit, TIntermUnary* node)
{
    delete node;

	return true;
}

bool RemoveTree::visitAggregate(Visit visit, TIntermAggregate* node)
{
	delete node;

	return true;
}

bool RemoveTree::visitSelection(Visit visit, TIntermSelection* node)
{
	delete node;

	return true;
}

void RemoveTree::visitConstantUnion(TIntermConstantUnion* node)
{
	delete node;
}

//
// Entry point.
//
void RemoveAllTreeNodes(TIntermNode* root)
{
    RemoveTree it;

    root->traverse(&it);
}