Edit

kc3-lang/angle/src/compiler/RemoveTree.cpp

Branch :

  • Show log

    Commit

  • Author : daniel@transgaming.com
    Date : 2010-04-20 18:52:13
    Hash : bbf56f75
    Message : Use directory qualified #include files Trac #11408 Signed-off-by: Andrew Lewycky Signed-off-by: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/trunk@165 736b8ea6-26fd-11df-bfd4-992fa37f6226

  • src/compiler/RemoveTree.cpp
  • //
    // 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/intermediate.h"
    #include "compiler/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);
    }