Delete dead code for cloning various types.
R=kbr@chromium.org
Review URL: https://codereview.appspot.com/9242043
git-svn-id: http://angleproject.googlecode.com/svn/trunk@2197 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/SymbolTable.cpp b/src/compiler/SymbolTable.cpp
index 847c1e4..a63789d 100644
--- a/src/compiler/SymbolTable.cpp
+++ b/src/compiler/SymbolTable.cpp
@@ -18,8 +18,6 @@
#include <stdio.h>
#include <algorithm>
-#include "common/angleutils.h"
-
TType::TType(const TPublicType &p) :
type(p.type), precision(p.precision), qualifier(p.qualifier), size(p.size), matrix(p.matrix), array(p.array), arraySize(p.arraySize),
maxArraySize(0), arrayInformationType(0), structure(0), structureSize(0), deepestStructNesting(0), fieldName(0), mangled(0), typeName(0)
@@ -203,77 +201,3 @@
}
}
}
-
-TSymbol::TSymbol(const TSymbol& copyOf)
-{
- name = NewPoolTString(copyOf.name->c_str());
- uniqueId = copyOf.uniqueId;
-}
-
-TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
-{
- type.copyType(copyOf.type, remapper);
- userType = copyOf.userType;
- // for builtIn symbol table level, unionArray and arrayInformation pointers should be NULL
- assert(copyOf.arrayInformationType == 0);
- arrayInformationType = 0;
-
- if (copyOf.unionArray) {
- assert(!copyOf.type.getStruct());
- assert(copyOf.type.getObjectSize() == 1);
- unionArray = new ConstantUnion[1];
- unionArray[0] = copyOf.unionArray[0];
- } else
- unionArray = 0;
-}
-
-TVariable* TVariable::clone(TStructureMap& remapper)
-{
- TVariable *variable = new TVariable(*this, remapper);
-
- return variable;
-}
-
-TFunction::TFunction(const TFunction& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
-{
- for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
- TParameter param;
- parameters.push_back(param);
- parameters.back().copyParam(copyOf.parameters[i], remapper);
- }
-
- returnType.copyType(copyOf.returnType, remapper);
- mangledName = copyOf.mangledName;
- op = copyOf.op;
- defined = copyOf.defined;
-}
-
-TFunction* TFunction::clone(TStructureMap& remapper)
-{
- TFunction *function = new TFunction(*this, remapper);
-
- return function;
-}
-
-TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper)
-{
- TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
- tLevel::iterator iter;
- for (iter = level.begin(); iter != level.end(); ++iter) {
- symTableLevel->insert(*iter->second->clone(remapper));
- }
-
- return symTableLevel;
-}
-
-void TSymbolTable::copyTable(const TSymbolTable& copyOf)
-{
- TStructureMap remapper;
- uniqueId = copyOf.uniqueId;
- for (unsigned int i = 0; i < copyOf.table.size(); ++i) {
- table.push_back(copyOf.table[i]->clone(remapper));
- }
- for( unsigned int i = 0; i < copyOf.precisionStack.size(); i++) {
- precisionStack.push_back( copyOf.precisionStack[i] );
- }
-}
diff --git a/src/compiler/SymbolTable.h b/src/compiler/SymbolTable.h
index d27aa33..b9ccd93 100644
--- a/src/compiler/SymbolTable.h
+++ b/src/compiler/SymbolTable.h
@@ -32,6 +32,7 @@
#include <assert.h>
+#include "common/angleutils.h"
#include "compiler/InfoSink.h"
#include "compiler/intermediate.h"
@@ -50,10 +51,10 @@
void setUniqueId(int id) { uniqueId = id; }
int getUniqueId() const { return uniqueId; }
virtual void dump(TInfoSink &infoSink) const = 0;
- TSymbol(const TSymbol&);
- virtual TSymbol* clone(TStructureMap& remapper) = 0;
-protected:
+private:
+ DISALLOW_COPY_AND_ASSIGN(TSymbol);
+
const TString *name;
unsigned int uniqueId; // For real comparing during code generation
};
@@ -100,10 +101,10 @@
delete[] unionArray;
unionArray = constArray;
}
- TVariable(const TVariable&, TStructureMap& remapper); // copy constructor
- virtual TVariable* clone(TStructureMap& remapper);
-protected:
+private:
+ DISALLOW_COPY_AND_ASSIGN(TVariable);
+
TType type;
bool userType;
// we are assuming that Pool Allocator will free the memory allocated to unionArray
@@ -119,11 +120,6 @@
struct TParameter {
TString *name;
TType* type;
- void copyParam(const TParameter& param, TStructureMap& remapper)
- {
- name = NewPoolTString(param.name->c_str());
- type = param.type->clone(remapper);
- }
};
//
@@ -173,10 +169,10 @@
const TParameter& getParam(size_t i) const { return parameters[i]; }
virtual void dump(TInfoSink &infoSink) const;
- TFunction(const TFunction&, TStructureMap& remapper);
- virtual TFunction* clone(TStructureMap& remapper);
-protected:
+private:
+ DISALLOW_COPY_AND_ASSIGN(TFunction);
+
typedef TVector<TParameter> TParamList;
TParamList parameters;
TType returnType;
@@ -231,7 +227,6 @@
void relateToOperator(const char* name, TOperator op);
void relateToExtension(const char* name, const TString& ext);
void dump(TInfoSink &infoSink) const;
- TSymbolTableLevel* clone(TStructureMap& remapper);
protected:
tLevel level;
@@ -321,7 +316,6 @@
}
int getMaxSymbolId() { return uniqueId; }
void dump(TInfoSink &infoSink) const;
- void copyTable(const TSymbolTable& copyOf);
bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){
if (IsSampler(type.type))
diff --git a/src/compiler/Types.h b/src/compiler/Types.h
index d457667..ab9cd16 100644
--- a/src/compiler/Types.h
+++ b/src/compiler/Types.h
@@ -29,9 +29,6 @@
return new(memory) TTypeList;
}
-typedef TMap<TTypeList*, TTypeList*> TStructureMap;
-typedef TMap<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
-
//
// Base class for things that have a type.
//
@@ -53,59 +50,6 @@
typeName = NewPoolTString(n.c_str());
}
- void copyType(const TType& copyOf, TStructureMap& remapper)
- {
- type = copyOf.type;
- precision = copyOf.precision;
- qualifier = copyOf.qualifier;
- size = copyOf.size;
- matrix = copyOf.matrix;
- array = copyOf.array;
- arraySize = copyOf.arraySize;
-
- TStructureMapIterator iter;
- if (copyOf.structure) {
- if ((iter = remapper.find(structure)) == remapper.end()) {
- // create the new structure here
- structure = NewPoolTTypeList();
- for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {
- TTypeLine typeLine;
- typeLine.line = (*copyOf.structure)[i].line;
- typeLine.type = (*copyOf.structure)[i].type->clone(remapper);
- structure->push_back(typeLine);
- }
- } else {
- structure = iter->second;
- }
- } else
- structure = 0;
-
- fieldName = 0;
- if (copyOf.fieldName)
- fieldName = NewPoolTString(copyOf.fieldName->c_str());
- typeName = 0;
- if (copyOf.typeName)
- typeName = NewPoolTString(copyOf.typeName->c_str());
-
- mangled = 0;
- if (copyOf.mangled)
- mangled = NewPoolTString(copyOf.mangled->c_str());
-
- structureSize = copyOf.structureSize;
- maxArraySize = copyOf.maxArraySize;
- deepestStructNesting = copyOf.deepestStructNesting;
- assert(copyOf.arrayInformationType == 0);
- arrayInformationType = 0; // arrayInformationType should not be set for builtIn symbol table level
- }
-
- TType* clone(TStructureMap& remapper)
- {
- TType *newType = new TType();
- newType->copyType(*this, remapper);
-
- return newType;
- }
-
TBasicType getBasicType() const { return type; }
void setBasicType(TBasicType t) { type = t; }
@@ -234,7 +178,7 @@
bool isStructureContainingArrays() const;
-protected:
+private:
void buildMangledName(TString&);
int getStructSize() const;
void computeDeepestStructNesting();