Make unique id counter a member of TSymbolTable

This makes unique id counting thread-safe.

BUG=angleproject:624
TEST=angle_unittests

Change-Id: Ie0f2c7e574470b39750d37d2181c790bc874b275
Reviewed-on: https://chromium-review.googlesource.com/570419
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index ef56d1a..7a11b24 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -95,7 +95,7 @@
                               std::vector<Varying> *varyings,
                               std::vector<InterfaceBlock> *interfaceBlocks,
                               ShHashFunction64 hashFunction,
-                              const TSymbolTable &symbolTable,
+                              TSymbolTable *symbolTable,
                               int shaderVersion,
                               const TExtensionBehavior &extensionBehavior);
 
@@ -147,7 +147,6 @@
 
     ShHashFunction64 mHashFunction;
 
-    const TSymbolTable &mSymbolTable;
     int mShaderVersion;
     const TExtensionBehavior &mExtensionBehavior;
 };
@@ -159,10 +158,10 @@
     std::vector<sh::Varying> *varyings,
     std::vector<sh::InterfaceBlock> *interfaceBlocks,
     ShHashFunction64 hashFunction,
-    const TSymbolTable &symbolTable,
+    TSymbolTable *symbolTable,
     int shaderVersion,
     const TExtensionBehavior &extensionBehavior)
-    : TIntermTraverser(true, false, false),
+    : TIntermTraverser(true, false, false, symbolTable),
       mAttribs(attribs),
       mOutputVariables(outputVariables),
       mUniforms(uniforms),
@@ -184,7 +183,6 @@
       mSecondaryFragColorEXTAdded(false),
       mSecondaryFragDataEXTAdded(false),
       mHashFunction(hashFunction),
-      mSymbolTable(symbolTable),
       mShaderVersion(shaderVersion),
       mExtensionBehavior(extensionBehavior)
 {
@@ -194,7 +192,7 @@
                                                               ShaderVariable *info)
 {
     TVariable *symbolTableVar =
-        reinterpret_cast<TVariable *>(mSymbolTable.findBuiltIn(name, mShaderVersion));
+        reinterpret_cast<TVariable *>(mSymbolTable->findBuiltIn(name, mShaderVersion));
     ASSERT(symbolTableVar);
     const TType &type = symbolTableVar->getType();
 
@@ -212,7 +210,7 @@
         Varying info;
         setBuiltInInfoFromSymbolTable(name, &info);
         info.staticUse   = true;
-        info.isInvariant = mSymbolTable.isVaryingInvariant(name);
+        info.isInvariant = mSymbolTable->isVaryingInvariant(name);
         mVaryings->push_back(info);
         (*addedFlag) = true;
     }
@@ -502,7 +500,7 @@
         case EvqSmoothOut:
         case EvqFlatOut:
         case EvqCentroidOut:
-            if (mSymbolTable.isVaryingInvariant(std::string(variable.getSymbol().c_str())) ||
+            if (mSymbolTable->isVaryingInvariant(std::string(variable.getSymbol().c_str())) ||
                 type.isInvariant())
             {
                 varying.isInvariant = true;
@@ -652,7 +650,7 @@
                       std::vector<Varying> *varyings,
                       std::vector<InterfaceBlock> *interfaceBlocks,
                       ShHashFunction64 hashFunction,
-                      const TSymbolTable &symbolTable,
+                      TSymbolTable *symbolTable,
                       int shaderVersion,
                       const TExtensionBehavior &extensionBehavior)
 {