Store TVariable* in TIntermSymbol instead of storing id

This is an intermediate step to only storing a TVariable * in
TIntermSymbol instead of copying the name.

This makes it possible to get a constant value out of a TIntermSymbol
without doing a symbol table lookup.

BUG=angleproject:2267
TEST=angle_unittests

Change-Id: Ibff588241a4ad4ac330063296273288b20a072c9
Reviewed-on: https://chromium-review.googlesource.com/829142
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/RemoveUnreferencedVariables.cpp b/src/compiler/translator/RemoveUnreferencedVariables.cpp
index 0f845cd..9b5339e 100644
--- a/src/compiler/translator/RemoveUnreferencedVariables.cpp
+++ b/src/compiler/translator/RemoveUnreferencedVariables.cpp
@@ -92,10 +92,10 @@
 {
     incrementStructTypeRefCount(node->getType());
 
-    auto iter = mSymbolIdRefCounts.find(node->getId());
+    auto iter = mSymbolIdRefCounts.find(node->uniqueId().get());
     if (iter == mSymbolIdRefCounts.end())
     {
-        mSymbolIdRefCounts[node->getId()] = 1u;
+        mSymbolIdRefCounts[node->uniqueId().get()] = 1u;
         return;
     }
     ++(iter->second);
@@ -234,14 +234,14 @@
         TIntermSymbol *symbolNode = declarator->getAsSymbolNode();
         if (symbolNode != nullptr)
         {
-            canRemoveVariable =
-                (*mSymbolIdRefCounts)[symbolNode->getId()] == 1u || symbolNode->getSymbol().empty();
+            canRemoveVariable = (*mSymbolIdRefCounts)[symbolNode->uniqueId().get()] == 1u ||
+                                symbolNode->getSymbol().empty();
         }
         TIntermBinary *initNode = declarator->getAsBinaryNode();
         if (initNode != nullptr)
         {
             ASSERT(initNode->getLeft()->getAsSymbolNode());
-            int symbolId = initNode->getLeft()->getAsSymbolNode()->getId();
+            int symbolId = initNode->getLeft()->getAsSymbolNode()->uniqueId().get();
             canRemoveVariable =
                 (*mSymbolIdRefCounts)[symbolId] == 1u && !initNode->getRight()->hasSideEffects();
         }
@@ -262,8 +262,8 @@
 {
     if (mRemoveReferences)
     {
-        ASSERT(mSymbolIdRefCounts->find(node->getId()) != mSymbolIdRefCounts->end());
-        --(*mSymbolIdRefCounts)[node->getId()];
+        ASSERT(mSymbolIdRefCounts->find(node->uniqueId().get()) != mSymbolIdRefCounts->end());
+        --(*mSymbolIdRefCounts)[node->uniqueId().get()];
 
         decrementStructTypeRefCount(node->getType());
     }