Non-functional: Remove use of the unused structure 'remapper', and other minor internal improvements. Triggered by some bigger changes in the works. Also, turned on an existing test that was not included in the test list.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23426 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
7ea2f9c39f
commit
3afe67dcc2
8 changed files with 86 additions and 64 deletions
|
|
@ -1757,7 +1757,7 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp
|
|||
return;
|
||||
}
|
||||
|
||||
variable->getWritableType().setArraySizes(type);
|
||||
variable->getWritableType().shareArraySizes(type);
|
||||
}
|
||||
|
||||
bool TParseContext::arraySetMaxSize(TSourceLoc loc, TIntermSymbol *node, int size)
|
||||
|
|
@ -2171,7 +2171,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
|
|||
TType elementType;
|
||||
elementType.shallowCopy(type);
|
||||
if (type.isArray())
|
||||
elementType.dereference(); // TODO: arrays of arrays: shallow copy won't work if sharing same array structure and then doing a dereference
|
||||
elementType.dereference(); // TODO: arrays of arrays: combine this with shallowCopy
|
||||
|
||||
bool singleArg;
|
||||
if (aggrNode) {
|
||||
|
|
@ -2202,7 +2202,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
|
|||
//
|
||||
// Handle list of arguments.
|
||||
//
|
||||
TIntermSequence &sequenceVector = aggrNode->getSequence() ; // Stores the information about the parameter to the constructor
|
||||
TIntermSequence &sequenceVector = aggrNode->getSequence(); // Stores the information about the parameter to the constructor
|
||||
// if the structure constructor contains more than one parameter, then construct
|
||||
// each parameter
|
||||
|
||||
|
|
@ -2221,10 +2221,10 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
|
|||
else
|
||||
newNode = constructBuiltIn(type, op, *p, node->getLoc(), true);
|
||||
|
||||
if (newNode) {
|
||||
p = sequenceVector.erase(p);
|
||||
p = sequenceVector.insert(p, newNode);
|
||||
}
|
||||
if (newNode)
|
||||
*p = newNode;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, type, loc);
|
||||
|
|
@ -2700,8 +2700,8 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TS
|
|||
TIntermTyped* typedNode;
|
||||
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
|
||||
TType arrayElementType;
|
||||
arrayElementType.shallowCopy(node->getType());
|
||||
arrayElementType.dereference(); // TODO: arrays of arrays: shallow copy won't work if sharing same array structure and then doing a dereference
|
||||
arrayElementType.shallowCopy(node->getType()); // TODO: arrays of arrays: combine this with deref.
|
||||
arrayElementType.dereference();
|
||||
|
||||
if (index >= node->getType().getArraySize() || index < 0) {
|
||||
error(loc, "", "[", "array index '%d' out of range", index);
|
||||
|
|
|
|||
|
|
@ -226,9 +226,9 @@ TSymbol::TSymbol(const TSymbol& copyOf)
|
|||
writable = true;
|
||||
}
|
||||
|
||||
TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol(copyOf)
|
||||
TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf)
|
||||
{
|
||||
type.deepCopy(copyOf.type, remapper);
|
||||
type.deepCopy(copyOf.type);
|
||||
userType = copyOf.userType;
|
||||
|
||||
if (! copyOf.unionArray.empty()) {
|
||||
|
|
@ -240,35 +240,35 @@ TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol
|
|||
}
|
||||
}
|
||||
|
||||
TVariable* TVariable::clone(TStructureMap& remapper)
|
||||
TVariable* TVariable::clone()
|
||||
{
|
||||
TVariable *variable = new TVariable(*this, remapper);
|
||||
TVariable *variable = new TVariable(*this);
|
||||
|
||||
return variable;
|
||||
}
|
||||
|
||||
TFunction::TFunction(const TFunction& copyOf, const TStructureMap& remapper) : TSymbol(copyOf)
|
||||
TFunction::TFunction(const TFunction& copyOf) : 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);
|
||||
parameters.back().copyParam(copyOf.parameters[i]);
|
||||
}
|
||||
|
||||
returnType.deepCopy(copyOf.returnType, remapper);
|
||||
returnType.deepCopy(copyOf.returnType);
|
||||
mangledName = copyOf.mangledName;
|
||||
op = copyOf.op;
|
||||
defined = copyOf.defined;
|
||||
}
|
||||
|
||||
TFunction* TFunction::clone(TStructureMap& remapper)
|
||||
TFunction* TFunction::clone()
|
||||
{
|
||||
TFunction *function = new TFunction(*this, remapper);
|
||||
TFunction *function = new TFunction(*this);
|
||||
|
||||
return function;
|
||||
}
|
||||
|
||||
TAnonMember* TAnonMember::clone(TStructureMap& remapper)
|
||||
TAnonMember* TAnonMember::clone()
|
||||
{
|
||||
// need to implement this once built-in symbols include interface blocks
|
||||
assert(0);
|
||||
|
|
@ -276,13 +276,13 @@ TAnonMember* TAnonMember::clone(TStructureMap& remapper)
|
|||
return 0;
|
||||
}
|
||||
|
||||
TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper)
|
||||
TSymbolTableLevel* TSymbolTableLevel::clone()
|
||||
{
|
||||
TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
|
||||
symTableLevel->anonId = anonId;
|
||||
tLevel::iterator iter;
|
||||
for (iter = level.begin(); iter != level.end(); ++iter)
|
||||
symTableLevel->insert(*iter->second->clone(remapper));
|
||||
symTableLevel->insert(*iter->second->clone());
|
||||
|
||||
return symTableLevel;
|
||||
}
|
||||
|
|
@ -291,11 +291,10 @@ void TSymbolTable::copyTable(const TSymbolTable& copyOf)
|
|||
{
|
||||
assert(adoptedLevels == copyOf.adoptedLevels);
|
||||
|
||||
TStructureMap remapper;
|
||||
uniqueId = copyOf.uniqueId;
|
||||
noBuiltInRedeclarations = copyOf.noBuiltInRedeclarations;
|
||||
for (unsigned int i = copyOf.adoptedLevels; i < copyOf.table.size(); ++i)
|
||||
table.push_back(copyOf.table[i]->clone(remapper));
|
||||
table.push_back(copyOf.table[i]->clone());
|
||||
}
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class TSymbol {
|
|||
public:
|
||||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
explicit TSymbol(const TString *n) : name(n), writable(true) { }
|
||||
virtual TSymbol* clone(TStructureMap& remapper) = 0;
|
||||
virtual TSymbol* clone() = 0;
|
||||
virtual ~TSymbol() { }
|
||||
|
||||
const TString& getName() const { return *name; }
|
||||
|
|
@ -126,7 +126,7 @@ protected:
|
|||
class TVariable : public TSymbol {
|
||||
public:
|
||||
TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), userType(uT) { type.shallowCopy(t); }
|
||||
virtual TVariable* clone(TStructureMap& remapper);
|
||||
virtual TVariable* clone();
|
||||
virtual ~TVariable() { }
|
||||
|
||||
virtual TVariable* getAsVariable() { return this; }
|
||||
|
|
@ -142,7 +142,6 @@ public:
|
|||
|
||||
protected:
|
||||
explicit TVariable(const TVariable&);
|
||||
TVariable(const TVariable&, TStructureMap& remapper);
|
||||
TVariable& operator=(const TVariable&);
|
||||
|
||||
TType type;
|
||||
|
|
@ -159,13 +158,13 @@ protected:
|
|||
struct TParameter {
|
||||
TString *name;
|
||||
TType* type;
|
||||
void copyParam(const TParameter& param, const TStructureMap& remapper)
|
||||
void copyParam(const TParameter& param)
|
||||
{
|
||||
if (param.name)
|
||||
name = NewPoolTString(param.name->c_str());
|
||||
else
|
||||
name = 0;
|
||||
type = param.type->clone(remapper);
|
||||
type = param.type->clone();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -183,7 +182,7 @@ public:
|
|||
mangledName(*name + '('),
|
||||
op(tOp),
|
||||
defined(false) { returnType.shallowCopy(retType); }
|
||||
virtual TFunction* clone(TStructureMap& remapper);
|
||||
virtual TFunction* clone();
|
||||
virtual ~TFunction();
|
||||
|
||||
virtual TFunction* getAsFunction() { return this; }
|
||||
|
|
@ -210,8 +209,7 @@ public:
|
|||
virtual void dump(TInfoSink &infoSink) const;
|
||||
|
||||
protected:
|
||||
explicit TFunction(TFunction&);
|
||||
TFunction(const TFunction&, const TStructureMap& remapper);
|
||||
explicit TFunction(const TFunction&);
|
||||
TFunction& operator=(TFunction&);
|
||||
|
||||
typedef TVector<TParameter> TParamList;
|
||||
|
|
@ -225,7 +223,7 @@ protected:
|
|||
class TAnonMember : public TSymbol {
|
||||
public:
|
||||
TAnonMember(const TString* n, unsigned int m, TSymbol& a) : TSymbol(n), anonContainer(a), memberNumber(m) { }
|
||||
virtual TAnonMember* clone(TStructureMap& remapper);
|
||||
virtual TAnonMember* clone();
|
||||
virtual ~TAnonMember() { }
|
||||
|
||||
const TAnonMember* getAsAnonMember() const { return this; }
|
||||
|
|
@ -346,7 +344,7 @@ public:
|
|||
|
||||
void relateToOperator(const char* name, TOperator op);
|
||||
void dump(TInfoSink &infoSink) const;
|
||||
TSymbolTableLevel* clone(TStructureMap& remapper);
|
||||
TSymbolTableLevel* clone();
|
||||
void readOnly();
|
||||
|
||||
protected:
|
||||
|
|
@ -445,7 +443,7 @@ public:
|
|||
//
|
||||
TVariable* copyUp(TVariable* shared)
|
||||
{
|
||||
TVariable* variable = shared->clone(remapper);
|
||||
TVariable* variable = shared->clone();
|
||||
variable->setUniqueId(shared->getUniqueId());
|
||||
table[currentLevel()]->insert(*variable);
|
||||
|
||||
|
|
@ -497,7 +495,6 @@ protected:
|
|||
int uniqueId; // for unique identification in code generation
|
||||
bool noBuiltInRedeclarations;
|
||||
unsigned int adoptedLevels;
|
||||
TStructureMap remapper; // for now, dummy for copyUp(), which is not yet used for structures
|
||||
};
|
||||
|
||||
} // end namespace glslang
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue