Refactor TStructure
Move methods and member variables that generalize to different types
of field lists into TFieldListCollection and put implementations of
methods in cpp files.
This prepares for making TStructure inherit from TSymbol.
BUG=angleproject:2267
TEST=angle_unittests
Change-Id: I63095242dd17aac2d2efd616b49be1143cfc1f92
Reviewed-on: https://chromium-review.googlesource.com/793813
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/RemoveUnreferencedVariables.cpp b/src/compiler/translator/RemoveUnreferencedVariables.cpp
index 74b5e73..f09895a 100644
--- a/src/compiler/translator/RemoveUnreferencedVariables.cpp
+++ b/src/compiler/translator/RemoveUnreferencedVariables.cpp
@@ -72,10 +72,10 @@
const auto *structure = type.getStruct();
if (structure != nullptr)
{
- auto structIter = mStructIdRefCounts.find(structure->uniqueId());
+ auto structIter = mStructIdRefCounts.find(structure->uniqueId().get());
if (structIter == mStructIdRefCounts.end())
{
- mStructIdRefCounts[structure->uniqueId()] = 1u;
+ mStructIdRefCounts[structure->uniqueId().get()] = 1u;
for (const auto &field : structure->fields())
{
@@ -158,8 +158,8 @@
auto *structure = type.getStruct();
if (structure != nullptr)
{
- ASSERT(mStructIdRefCounts->find(structure->uniqueId()) != mStructIdRefCounts->end());
- unsigned int structRefCount = --(*mStructIdRefCounts)[structure->uniqueId()];
+ ASSERT(mStructIdRefCounts->find(structure->uniqueId().get()) != mStructIdRefCounts->end());
+ unsigned int structRefCount = --(*mStructIdRefCounts)[structure->uniqueId().get()];
if (structRefCount == 0)
{
@@ -176,7 +176,7 @@
{
if (declarator->getType().isStructSpecifier() && !declarator->getType().isNamelessStruct())
{
- unsigned int structId = declarator->getType().getStruct()->uniqueId();
+ unsigned int structId = declarator->getType().getStruct()->uniqueId().get();
if ((*mStructIdRefCounts)[structId] > 1u)
{
// If this declaration declares a named struct type that is used elsewhere, we need to