Commit b12531c9 by Olli Etuaho

Invalidate mangled name of TType if the type is changed

Sometimes, the mangled name of a type is already generated when the type is still being changed. For example, this could happen when the type of A[i] is generated by copying the type of A (already mangled) and calling clearArrayness() on the copy. Make sure that the mangled name gets updated if the type is changed by clearing the mangled name when something affecting it is changed. BUG=angleproject:1170 BUG=538692 TEST=angle_unittests Change-Id: I9dfacea653f56536e1573a6dbf60ff21da7cc5ab Reviewed-on: https://chromium-review.googlesource.com/303846Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org>
parent f0aa8429
......@@ -275,7 +275,11 @@ class TType
}
void setBasicType(TBasicType t)
{
type = t;
if (type != t)
{
type = t;
invalidateMangledName();
}
}
TPrecision getPrecision() const
......@@ -330,11 +334,19 @@ class TType
}
void setPrimarySize(unsigned char ps)
{
primarySize = ps;
if (primarySize != ps)
{
primarySize = ps;
invalidateMangledName();
}
}
void setSecondarySize(unsigned char ss)
{
secondarySize = ss;
if (secondarySize != ss)
{
secondarySize = ss;
invalidateMangledName();
}
}
// Full size of single instance of type
......@@ -362,13 +374,21 @@ class TType
}
void setArraySize(int s)
{
array = true;
arraySize = s;
if (!array || arraySize != s)
{
array = true;
arraySize = s;
invalidateMangledName();
}
}
void clearArrayness()
{
array = false;
arraySize = 0;
if (array)
{
array = false;
arraySize = 0;
invalidateMangledName();
}
}
TInterfaceBlock *getInterfaceBlock() const
......@@ -377,7 +397,11 @@ class TType
}
void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn)
{
interfaceBlock = interfaceBlockIn;
if (interfaceBlock != interfaceBlockIn)
{
interfaceBlock = interfaceBlockIn;
invalidateMangledName();
}
}
bool isInterfaceBlock() const
{
......@@ -403,7 +427,11 @@ class TType
}
void setStruct(TStructure *s)
{
structure = s;
if (structure != s)
{
structure = s;
invalidateMangledName();
}
}
const TString &getMangledName() const
......@@ -507,7 +535,8 @@ class TType
getMangledName();
}
protected:
private:
void invalidateMangledName() { mangled = ""; }
TString buildMangledName() const;
size_t getStructSize() const;
......
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