Commit ba60ad36 by Nicolas Capens Committed by Shannon Woods

Eliminate unused clone/dump methods.

TRAC #23185 Signed-off-by: Geoff Lang Signed-off-by: Shannon Woods Author: Nicolas Capens
parent 22d63dae
...@@ -144,44 +144,6 @@ bool TType::isStructureContainingArrays() const ...@@ -144,44 +144,6 @@ bool TType::isStructureContainingArrays() const
} }
// //
// Dump functions.
//
void TVariable::dump(TInfoSink& infoSink) const
{
infoSink.debug << getName().c_str() << ": " << type.getQualifierString() << " " << type.getPrecisionString() << " " << type.getBasicString();
if (type.isArray()) {
infoSink.debug << "[0]";
}
infoSink.debug << "\n";
}
void TFunction::dump(TInfoSink &infoSink) const
{
infoSink.debug << getName().c_str() << ": " << returnType.getBasicString() << " " << getMangledName().c_str() << "\n";
}
void TInterfaceBlockName::dump(TInfoSink &infoSink) const
{
infoSink.debug << "interface block " << getName().c_str() << "\n";
}
void TSymbolTableLevel::dump(TInfoSink &infoSink) const
{
tLevel::const_iterator it;
for (it = level.begin(); it != level.end(); ++it)
(*it).second->dump(infoSink);
}
void TSymbolTable::dump(TInfoSink &infoSink) const
{
for (int level = currentLevel(); level >= 0; --level) {
infoSink.debug << "LEVEL " << level << "\n";
table[level]->dump(infoSink);
}
}
//
// Functions have buried pointers to delete. // Functions have buried pointers to delete.
// //
TFunction::~TFunction() TFunction::~TFunction()
...@@ -240,79 +202,6 @@ TSymbol::TSymbol(const TSymbol& copyOf) ...@@ -240,79 +202,6 @@ TSymbol::TSymbol(const TSymbol& copyOf)
uniqueId = copyOf.uniqueId; 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;
}
TInterfaceBlockName* TInterfaceBlockName::clone(TStructureMap& remapper)
{
return new TInterfaceBlockName(this->name);
}
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] );
}
}
TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtIn, bool *sameScope) TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtIn, bool *sameScope)
{ {
int level = currentLevel(); int level = currentLevel();
......
...@@ -49,9 +49,8 @@ public: ...@@ -49,9 +49,8 @@ public:
virtual bool isVariable() const { return false; } virtual bool isVariable() const { return false; }
void setUniqueId(int id) { uniqueId = id; } void setUniqueId(int id) { uniqueId = id; }
int getUniqueId() const { return uniqueId; } int getUniqueId() const { return uniqueId; }
virtual void dump(TInfoSink &infoSink) const = 0;
TSymbol(const TSymbol&); TSymbol(const TSymbol&);
virtual TSymbol* clone(TStructureMap& remapper) = 0;
protected: protected:
const TString *name; const TString *name;
...@@ -80,8 +79,6 @@ public: ...@@ -80,8 +79,6 @@ public:
void updateArrayInformationType(TType *t) { arrayInformationType = t; } void updateArrayInformationType(TType *t) { arrayInformationType = t; }
TType* getArrayInformationType() { return arrayInformationType; } TType* getArrayInformationType() { return arrayInformationType; }
virtual void dump(TInfoSink &infoSink) const;
ConstantUnion* getConstPointer() ConstantUnion* getConstPointer()
{ {
if (!unionArray) if (!unionArray)
...@@ -100,8 +97,6 @@ public: ...@@ -100,8 +97,6 @@ public:
delete[] unionArray; delete[] unionArray;
unionArray = constArray; unionArray = constArray;
} }
TVariable(const TVariable&, TStructureMap& remapper); // copy constructor
virtual TVariable* clone(TStructureMap& remapper);
protected: protected:
TType type; TType type;
...@@ -119,11 +114,6 @@ protected: ...@@ -119,11 +114,6 @@ protected:
struct TParameter { struct TParameter {
TString *name; TString *name;
TType* type; TType* type;
void copyParam(const TParameter& param, TStructureMap& remapper)
{
name = NewPoolTString(param.name->c_str());
type = param.type->clone(remapper);
}
}; };
// //
...@@ -172,10 +162,6 @@ public: ...@@ -172,10 +162,6 @@ public:
size_t getParamCount() const { return parameters.size(); } size_t getParamCount() const { return parameters.size(); }
const TParameter& getParam(size_t i) const { return parameters[i]; } 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: protected:
typedef TVector<TParameter> TParamList; typedef TVector<TParameter> TParamList;
TParamList parameters; TParamList parameters;
...@@ -197,9 +183,6 @@ public: ...@@ -197,9 +183,6 @@ public:
{} {}
virtual ~TInterfaceBlockName() {} virtual ~TInterfaceBlockName() {}
virtual void dump(TInfoSink &infoSink) const;
virtual TInterfaceBlockName* clone(TStructureMap& remapper);
}; };
class TSymbolTableLevel { class TSymbolTableLevel {
...@@ -245,8 +228,6 @@ public: ...@@ -245,8 +228,6 @@ public:
void relateToOperator(const char* name, TOperator op); void relateToOperator(const char* name, TOperator op);
void relateToExtension(const char* name, const TString& ext); void relateToExtension(const char* name, const TString& ext);
void dump(TInfoSink &infoSink) const;
TSymbolTableLevel* clone(TStructureMap& remapper);
protected: protected:
tLevel level; tLevel level;
...@@ -325,8 +306,6 @@ public: ...@@ -325,8 +306,6 @@ public:
table[level]->relateToExtension(name, ext); table[level]->relateToExtension(name, ext);
} }
int getMaxSymbolId() { return uniqueId; } int getMaxSymbolId() { return uniqueId; }
void dump(TInfoSink &infoSink) const;
void copyTable(const TSymbolTable& copyOf);
bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){ bool setDefaultPrecision( const TPublicType& type, TPrecision prec ){
if (IsSampler(type.type)) if (IsSampler(type.type))
......
...@@ -29,9 +29,6 @@ inline TTypeList* NewPoolTTypeList() ...@@ -29,9 +29,6 @@ inline TTypeList* NewPoolTTypeList()
return new(memory) TTypeList; return new(memory) TTypeList;
} }
typedef TMap<TTypeList*, TTypeList*> TStructureMap;
typedef TMap<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
// //
// Base class for things that have a type. // Base class for things that have a type.
// //
...@@ -53,64 +50,6 @@ public: ...@@ -53,64 +50,6 @@ public:
typeName = NewPoolTString(n.c_str()); typeName = NewPoolTString(n.c_str());
} }
void copyType(const TType& copyOf, TStructureMap& remapper)
{
type = copyOf.type;
precision = copyOf.precision;
qualifier = copyOf.qualifier;
primarySize = copyOf.primarySize;
secondarySize = copyOf.secondarySize;
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());
instanceName = 0;
if (copyOf.instanceName)
instanceName = NewPoolTString(copyOf.instanceName->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
interfaceBlockType = 0;
}
TType* clone(TStructureMap& remapper)
{
TType *newType = new TType();
newType->copyType(*this, remapper);
return newType;
}
TBasicType getBasicType() const { return type; } TBasicType getBasicType() const { return type; }
void setBasicType(TBasicType t) { type = t; } void setBasicType(TBasicType t) { type = t; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment