Store invariant varying names as ImmutableString

This gets rid of a few extra ImmutableString to std::string
conversions which makes the code clearer. There doesn't seem to be any
significant effect on performance.

BUG=angleproject:2267
TEST=angle_unittests

Change-Id: I36ebbc8a4130ab8f9d6194feca83ec5dcbc95f78
Reviewed-on: https://chromium-review.googlesource.com/916141
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/CollectVariables.cpp b/src/compiler/translator/CollectVariables.cpp
index e0f73ca..12388e6 100644
--- a/src/compiler/translator/CollectVariables.cpp
+++ b/src/compiler/translator/CollectVariables.cpp
@@ -284,7 +284,7 @@
         Varying info;
         setBuiltInInfoFromSymbolTable(name, &info);
         info.staticUse   = true;
-        info.isInvariant = mSymbolTable->isVaryingInvariant(name.data());
+        info.isInvariant = mSymbolTable->isVaryingInvariant(name);
         varyings->push_back(info);
         (*addedFlag) = true;
     }
@@ -677,7 +677,7 @@
         case EvqFlatOut:
         case EvqCentroidOut:
         case EvqGeometryOut:
-            if (mSymbolTable->isVaryingInvariant(varying.name) || type.isInvariant())
+            if (mSymbolTable->isVaryingInvariant(variable.getName()) || type.isInvariant())
             {
                 varying.isInvariant = true;
             }
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 59de39d..1d069a4 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2639,7 +2639,7 @@
                                     typeQualifier.line);
     checkMemoryQualifierIsNotSpecified(typeQualifier.memoryQualifier, typeQualifier.line);
 
-    symbolTable.addInvariantVarying(std::string(identifier.data()));
+    symbolTable.addInvariantVarying(identifier);
 
     TIntermSymbol *intermSymbol = new TIntermSymbol(variable);
     intermSymbol->setLine(identifierLoc);
diff --git a/src/compiler/translator/SymbolTable.cpp b/src/compiler/translator/SymbolTable.cpp
index 94f53c1..6b188c1 100644
--- a/src/compiler/translator/SymbolTable.cpp
+++ b/src/compiler/translator/SymbolTable.cpp
@@ -36,9 +36,9 @@
 
     TSymbol *find(const ImmutableString &name) const;
 
-    void addInvariantVarying(const std::string &name) { mInvariantVaryings.insert(name); }
+    void addInvariantVarying(const ImmutableString &name) { mInvariantVaryings.insert(name); }
 
-    bool isVaryingInvariant(const std::string &name)
+    bool isVaryingInvariant(const ImmutableString &name)
     {
         return (mGlobalInvariant || mInvariantVaryings.count(name) > 0);
     }
@@ -54,7 +54,7 @@
 
     tLevel level;
 
-    std::set<std::string> mInvariantVaryings;
+    std::set<ImmutableString> mInvariantVaryings;
     bool mGlobalInvariant;
 };
 
@@ -717,13 +717,13 @@
     return prec;
 }
 
-void TSymbolTable::addInvariantVarying(const std::string &originalName)
+void TSymbolTable::addInvariantVarying(const ImmutableString &originalName)
 {
     ASSERT(atGlobalLevel());
     mTable.back()->addInvariantVarying(originalName);
 }
 
-bool TSymbolTable::isVaryingInvariant(const std::string &originalName) const
+bool TSymbolTable::isVaryingInvariant(const ImmutableString &originalName) const
 {
     ASSERT(atGlobalLevel());
     return mTable.back()->isVaryingInvariant(originalName);
diff --git a/src/compiler/translator/SymbolTable.h b/src/compiler/translator/SymbolTable.h
index b0ca4e8..f3c5270 100644
--- a/src/compiler/translator/SymbolTable.h
+++ b/src/compiler/translator/SymbolTable.h
@@ -113,13 +113,13 @@
 
     // This records invariant varyings declared through
     // "invariant varying_name;".
-    void addInvariantVarying(const std::string &originalName);
+    void addInvariantVarying(const ImmutableString &originalName);
 
     // If this returns false, the varying could still be invariant
     // if it is set as invariant during the varying variable
     // declaration - this piece of information is stored in the
     // variable's type, not here.
-    bool isVaryingInvariant(const std::string &originalName) const;
+    bool isVaryingInvariant(const ImmutableString &originalName) const;
 
     void setGlobalInvariant(bool invariant);