Remove RemoveTree.
All AST nodes are allocated in a memory pool and get deleted by the pool.
RemoveTree doesn't do anything because delete is overloaded for the nodes.
BUG=18469191
Change-Id: I1dc23e894c441db2e2eb1f6e9b8f0c11b2e52b3c
Reviewed-on: https://swiftshader-review.googlesource.com/1452
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/compiler/Compiler.cpp b/src/OpenGL/compiler/Compiler.cpp
index 28455cf..26e685b 100644
--- a/src/OpenGL/compiler/Compiler.cpp
+++ b/src/OpenGL/compiler/Compiler.cpp
@@ -121,8 +121,6 @@
success = translate(root);
}
- // Cleanup memory.
- intermediate.remove(parseContext.treeRoot);
// Ensure symbol table is returned to the built-in level,
// throwing away all but the built-ins.
while (!symbolTable.atBuiltInLevel())
diff --git a/src/OpenGL/compiler/Compiler.vcxproj b/src/OpenGL/compiler/Compiler.vcxproj
index ca91d73..8e0780a 100644
--- a/src/OpenGL/compiler/Compiler.vcxproj
+++ b/src/OpenGL/compiler/Compiler.vcxproj
@@ -211,7 +211,6 @@
<ClCompile Include="parseConst.cpp" />
<ClCompile Include="ParseHelper.cpp" />
<ClCompile Include="PoolAlloc.cpp" />
- <ClCompile Include="RemoveTree.cpp" />
<ClCompile Include="ShaderLang.cpp" />
<ClCompile Include="SymbolTable.cpp" />
<ClCompile Include="TranslatorASM.cpp" />
@@ -313,7 +312,6 @@
<ClInclude Include="ParseHelper.h" />
<ClInclude Include="PoolAlloc.h" />
<ClInclude Include="Pragma.h" />
- <ClInclude Include="RemoveTree.h" />
<ClInclude Include="ShHandle.h" />
<ClInclude Include="SymbolTable.h" />
<ClInclude Include="TranslatorASM.h" />
diff --git a/src/OpenGL/compiler/Compiler.vcxproj.filters b/src/OpenGL/compiler/Compiler.vcxproj.filters
index d4118f0..09f3041 100644
--- a/src/OpenGL/compiler/Compiler.vcxproj.filters
+++ b/src/OpenGL/compiler/Compiler.vcxproj.filters
@@ -50,9 +50,6 @@
<ClCompile Include="PoolAlloc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="RemoveTree.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="ShaderLang.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -136,9 +133,6 @@
<ClInclude Include="PoolAlloc.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="RemoveTree.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="ShHandle.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/src/OpenGL/compiler/Intermediate.cpp b/src/OpenGL/compiler/Intermediate.cpp
index 6910deb..0676e23 100644
--- a/src/OpenGL/compiler/Intermediate.cpp
+++ b/src/OpenGL/compiler/Intermediate.cpp
@@ -13,7 +13,6 @@
#include <algorithm>
#include "compiler/localintermediate.h"
-#include "compiler/RemoveTree.h"
#include "compiler/SymbolTable.h"
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
@@ -552,15 +551,6 @@
return true;
}
-//
-// This deletes the tree.
-//
-void TIntermediate::remove(TIntermNode* root)
-{
- if (root)
- RemoveAllTreeNodes(root);
-}
-
////////////////////////////////////////////////////////////////
//
// Member functions of the nodes used for building the tree.
diff --git a/src/OpenGL/compiler/RemoveTree.cpp b/src/OpenGL/compiler/RemoveTree.cpp
deleted file mode 100644
index a4b8c1e..0000000
--- a/src/OpenGL/compiler/RemoveTree.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// 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);
-}
-
diff --git a/src/OpenGL/compiler/RemoveTree.h b/src/OpenGL/compiler/RemoveTree.h
deleted file mode 100644
index 97a8216..0000000
--- a/src/OpenGL/compiler/RemoveTree.h
+++ /dev/null
@@ -1,7 +0,0 @@
-//
-// 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.
-//
-
-void RemoveAllTreeNodes(TIntermNode*);
diff --git a/src/OpenGL/compiler/localintermediate.h b/src/OpenGL/compiler/localintermediate.h
index 805744f..1a1c7dc 100644
--- a/src/OpenGL/compiler/localintermediate.h
+++ b/src/OpenGL/compiler/localintermediate.h
@@ -43,7 +43,6 @@
TIntermBranch* addBranch(TOperator, TIntermTyped*, TSourceLoc);
TIntermTyped* addSwizzle(TVectorFields&, TSourceLoc);
bool postProcess(TIntermNode*);
- void remove(TIntermNode*);
void outputTree(TIntermNode*);
protected:
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cbp b/src/OpenGL/libGLESv2/libGLESv2.cbp
index 4ada915..a569eb0 100644
--- a/src/OpenGL/libGLESv2/libGLESv2.cbp
+++ b/src/OpenGL/libGLESv2/libGLESv2.cbp
@@ -272,8 +272,6 @@
<Unit filename="../compiler/PoolAlloc.cpp" />
<Unit filename="../compiler/PoolAlloc.h" />
<Unit filename="../compiler/Pragma.h" />
- <Unit filename="../compiler/RemoveTree.cpp" />
- <Unit filename="../compiler/RemoveTree.h" />
<Unit filename="../compiler/ShHandle.h" />
<Unit filename="../compiler/ShaderLang.cpp" />
<Unit filename="../compiler/SymbolTable.cpp" />
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cpp b/src/OpenGL/libGLESv2/libGLESv2.cpp
index bafd99c..076af75 100644
--- a/src/OpenGL/libGLESv2/libGLESv2.cpp
+++ b/src/OpenGL/libGLESv2/libGLESv2.cpp
@@ -347,13 +347,13 @@
if(context)
{
- if (renderbuffer != 0 && !context->getRenderbuffer(renderbuffer))
- {
+ if(renderbuffer != 0 && !context->getRenderbuffer(renderbuffer))
+ {
// [OpenGL ES 2.0.25] Section 4.4.3 page 112
// [OpenGL ES 3.0.2] Section 4.4.2 page 201
// 'renderbuffer' must be either zero or the name of an existing renderbuffer object of
// type 'renderbuffertarget', otherwise an INVALID_OPERATION error is generated.
- return error(GL_INVALID_OPERATION);
+ return error(GL_INVALID_OPERATION);
}
context->bindRenderbuffer(renderbuffer);
diff --git a/src/Radiance/compiler/Compiler.cpp b/src/Radiance/compiler/Compiler.cpp
index 28455cf..26e685b 100644
--- a/src/Radiance/compiler/Compiler.cpp
+++ b/src/Radiance/compiler/Compiler.cpp
@@ -121,8 +121,6 @@
success = translate(root);
}
- // Cleanup memory.
- intermediate.remove(parseContext.treeRoot);
// Ensure symbol table is returned to the built-in level,
// throwing away all but the built-ins.
while (!symbolTable.atBuiltInLevel())
diff --git a/src/Radiance/compiler/Compiler.vcxproj b/src/Radiance/compiler/Compiler.vcxproj
index 83e4454..e0f31c2 100644
--- a/src/Radiance/compiler/Compiler.vcxproj
+++ b/src/Radiance/compiler/Compiler.vcxproj
@@ -123,7 +123,6 @@
<ClCompile Include="parseConst.cpp" />
<ClCompile Include="ParseHelper.cpp" />
<ClCompile Include="PoolAlloc.cpp" />
- <ClCompile Include="RemoveTree.cpp" />
<ClCompile Include="ShaderLang.cpp" />
<ClCompile Include="SymbolTable.cpp" />
<ClCompile Include="TranslatorASM.cpp" />
@@ -192,7 +191,6 @@
<ClInclude Include="ParseHelper.h" />
<ClInclude Include="PoolAlloc.h" />
<ClInclude Include="Pragma.h" />
- <ClInclude Include="RemoveTree.h" />
<ClInclude Include="ShHandle.h" />
<ClInclude Include="SymbolTable.h" />
<ClInclude Include="TranslatorASM.h" />
diff --git a/src/Radiance/compiler/Compiler.vcxproj.filters b/src/Radiance/compiler/Compiler.vcxproj.filters
index d4118f0..09f3041 100644
--- a/src/Radiance/compiler/Compiler.vcxproj.filters
+++ b/src/Radiance/compiler/Compiler.vcxproj.filters
@@ -50,9 +50,6 @@
<ClCompile Include="PoolAlloc.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="RemoveTree.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="ShaderLang.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -136,9 +133,6 @@
<ClInclude Include="PoolAlloc.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="RemoveTree.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="ShHandle.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/src/Radiance/compiler/Intermediate.cpp b/src/Radiance/compiler/Intermediate.cpp
index 6910deb..0676e23 100644
--- a/src/Radiance/compiler/Intermediate.cpp
+++ b/src/Radiance/compiler/Intermediate.cpp
@@ -13,7 +13,6 @@
#include <algorithm>
#include "compiler/localintermediate.h"
-#include "compiler/RemoveTree.h"
#include "compiler/SymbolTable.h"
bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
@@ -552,15 +551,6 @@
return true;
}
-//
-// This deletes the tree.
-//
-void TIntermediate::remove(TIntermNode* root)
-{
- if (root)
- RemoveAllTreeNodes(root);
-}
-
////////////////////////////////////////////////////////////////
//
// Member functions of the nodes used for building the tree.
diff --git a/src/Radiance/compiler/RemoveTree.cpp b/src/Radiance/compiler/RemoveTree.cpp
deleted file mode 100644
index a4b8c1e..0000000
--- a/src/Radiance/compiler/RemoveTree.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// 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);
-}
-
diff --git a/src/Radiance/compiler/RemoveTree.h b/src/Radiance/compiler/RemoveTree.h
deleted file mode 100644
index 97a8216..0000000
--- a/src/Radiance/compiler/RemoveTree.h
+++ /dev/null
@@ -1,7 +0,0 @@
-//
-// 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.
-//
-
-void RemoveAllTreeNodes(TIntermNode*);
diff --git a/src/Radiance/compiler/localintermediate.h b/src/Radiance/compiler/localintermediate.h
index 805744f..1a1c7dc 100644
--- a/src/Radiance/compiler/localintermediate.h
+++ b/src/Radiance/compiler/localintermediate.h
@@ -43,7 +43,6 @@
TIntermBranch* addBranch(TOperator, TIntermTyped*, TSourceLoc);
TIntermTyped* addSwizzle(TVectorFields&, TSourceLoc);
bool postProcess(TIntermNode*);
- void remove(TIntermNode*);
void outputTree(TIntermNode*);
protected: