Add kEmptyImmutableString.

We can use this instead of ImmutableString("").

Bug: angleproject:2665
Change-Id: I8b3d5d3075838b9f2caa1627071202e48a5fdc83
Reviewed-on: https://chromium-review.googlesource.com/1108085
Commit-Queue: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Luc Ferron <lucferron@chromium.org>
diff --git a/src/compiler/translator/HashNames.cpp b/src/compiler/translator/HashNames.cpp
index 6d0ddaf..6994c10 100644
--- a/src/compiler/translator/HashNames.cpp
+++ b/src/compiler/translator/HashNames.cpp
@@ -81,7 +81,7 @@
 {
     if (symbol->symbolType() == SymbolType::Empty)
     {
-        return ImmutableString("");
+        return kEmptyImmutableString;
     }
     if (symbol->symbolType() == SymbolType::AngleInternal ||
         symbol->symbolType() == SymbolType::BuiltIn)
diff --git a/src/compiler/translator/ImmutableString.h b/src/compiler/translator/ImmutableString.h
index b583bc9..4e7f506 100644
--- a/src/compiler/translator/ImmutableString.h
+++ b/src/compiler/translator/ImmutableString.h
@@ -138,6 +138,7 @@
     size_t mLength;
 };
 
+constexpr ImmutableString kEmptyImmutableString("");
 }  // namespace sh
 
 std::ostream &operator<<(std::ostream &os, const sh::ImmutableString &str);
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index e93c3a6..121dd11 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1679,7 +1679,7 @@
         }
         default:
             UNREACHABLE();
-            return ImmutableString("");
+            return kEmptyImmutableString;
     }
 }
 
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 36fc69f..e387575 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2448,7 +2448,7 @@
         if (type->getBasicType() == EbtStruct)
         {
             TVariable *emptyVariable =
-                new TVariable(&symbolTable, ImmutableString(""), type, SymbolType::Empty);
+                new TVariable(&symbolTable, kEmptyImmutableString, type, SymbolType::Empty);
             symbol = new TIntermSymbol(emptyVariable);
         }
         else if (IsAtomicCounter(publicType.getBasicType()))
diff --git a/src/compiler/translator/Symbol.cpp b/src/compiler/translator/Symbol.cpp
index 12d0ef3..b2c4110 100644
--- a/src/compiler/translator/Symbol.cpp
+++ b/src/compiler/translator/Symbol.cpp
@@ -184,7 +184,7 @@
     mParametersVector->push_back(p);
     mParameters  = mParametersVector->data();
     mParamCount  = mParametersVector->size();
-    mMangledName = ImmutableString("");
+    mMangledName = kEmptyImmutableString;
 }
 
 void TFunction::shareParameters(const TFunction &parametersSource)
diff --git a/src/compiler/translator/TranslatorVulkan.cpp b/src/compiler/translator/TranslatorVulkan.cpp
index ebddb0e..5027b3c 100644
--- a/src/compiler/translator/TranslatorVulkan.cpp
+++ b/src/compiler/translator/TranslatorVulkan.cpp
@@ -162,7 +162,7 @@
             new TStructure(mSymbolTable, structure->name(), newFieldList, structure->symbolType());
         TType *newStructType = new TType(newStruct, true);
         TVariable *newStructVar =
-            new TVariable(mSymbolTable, ImmutableString(""), newStructType, SymbolType::Empty);
+            new TVariable(mSymbolTable, kEmptyImmutableString, newStructType, SymbolType::Empty);
         TIntermSymbol *newStructRef = new TIntermSymbol(newStructVar);
 
         TIntermDeclaration *structDecl = new TIntermDeclaration;
@@ -329,13 +329,13 @@
                        const TStructure *oldStructure)
     {
         // struct <structName> { ... };
-        TStructure *structure = new TStructure(mSymbolTable, ImmutableString(""),
+        TStructure *structure = new TStructure(mSymbolTable, kEmptyImmutableString,
                                                &oldStructure->fields(), SymbolType::AngleInternal);
         TType *namedType      = new TType(structure, true);
         namedType->setQualifier(EvqGlobal);
 
         TVariable *structVariable =
-            new TVariable(mSymbolTable, ImmutableString(""), namedType, SymbolType::Empty);
+            new TVariable(mSymbolTable, kEmptyImmutableString, namedType, SymbolType::Empty);
         TIntermSymbol *structDeclarator       = new TIntermSymbol(structVariable);
         TIntermDeclaration *structDeclaration = new TIntermDeclaration;
         structDeclaration->appendDeclarator(structDeclarator);
diff --git a/src/compiler/translator/glslang.y b/src/compiler/translator/glslang.y
index 499fda2..f0597ff 100644
--- a/src/compiler/translator/glslang.y
+++ b/src/compiler/translator/glslang.y
@@ -607,7 +607,7 @@
     }
     | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON {
         ES3_OR_NEWER(ImmutableString($2.string), @1, "interface blocks");
-        $$ = context->addInterfaceBlock(*$1, @2, ImmutableString($2.string), $3, ImmutableString(""), @$, NULL, @$);
+        $$ = context->addInterfaceBlock(*$1, @2, ImmutableString($2.string), $3, kEmptyImmutableString, @$, NULL, @$);
     }
     | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON {
         ES3_OR_NEWER(ImmutableString($2.string), @1, "interface blocks");
@@ -740,7 +740,7 @@
 single_declaration
     : fully_specified_type {
         $$.type = $1;
-        $$.intermDeclaration = context->parseSingleDeclaration($$.type, @1, ImmutableString(""));
+        $$.intermDeclaration = context->parseSingleDeclaration($$.type, @1, kEmptyImmutableString);
     }
     | fully_specified_type identifier {
         $$.type = $1;
@@ -1200,8 +1200,8 @@
     : STRUCT identifier LEFT_BRACE { context->enterStructDeclaration(@2, ImmutableString($2.string)); } struct_declaration_list RIGHT_BRACE {
         $$ = context->addStructure(@1, @2, ImmutableString($2.string), $5);
     }
-    | STRUCT LEFT_BRACE { context->enterStructDeclaration(@2, ImmutableString("")); } struct_declaration_list RIGHT_BRACE {
-        $$ = context->addStructure(@1, @$, ImmutableString(""), $4);
+    | STRUCT LEFT_BRACE { context->enterStructDeclaration(@2, kEmptyImmutableString); } struct_declaration_list RIGHT_BRACE {
+        $$ = context->addStructure(@1, @$, kEmptyImmutableString, $4);
     }
     ;
 
diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
index f974748..0ae74fb 100644
--- a/src/compiler/translator/glslang_tab.cpp
+++ b/src/compiler/translator/glslang_tab.cpp
@@ -3196,7 +3196,7 @@
 
     {
         ES3_OR_NEWER(ImmutableString((yyvsp[-3].lex).string), (yylsp[-4]), "interface blocks");
-        (yyval.interm.intermNode) = context->addInterfaceBlock(*(yyvsp[-4].interm.typeQualifierBuilder), (yylsp[-3]), ImmutableString((yyvsp[-3].lex).string), (yyvsp[-2].interm.fieldList), ImmutableString(""), (yyloc), NULL, (yyloc));
+        (yyval.interm.intermNode) = context->addInterfaceBlock(*(yyvsp[-4].interm.typeQualifierBuilder), (yylsp[-3]), ImmutableString((yyvsp[-3].lex).string), (yyvsp[-2].interm.fieldList), kEmptyImmutableString, (yyloc), NULL, (yyloc));
     }
 
     break;
@@ -3414,7 +3414,7 @@
 
     {
         (yyval.interm).type = (yyvsp[0].interm.type);
-        (yyval.interm).intermDeclaration = context->parseSingleDeclaration((yyval.interm).type, (yylsp[0]), ImmutableString(""));
+        (yyval.interm).intermDeclaration = context->parseSingleDeclaration((yyval.interm).type, (yylsp[0]), kEmptyImmutableString);
     }
 
     break;
@@ -4398,14 +4398,14 @@
 
   case 229:
 
-    { context->enterStructDeclaration((yylsp[0]), ImmutableString("")); }
+    { context->enterStructDeclaration((yylsp[0]), kEmptyImmutableString); }
 
     break;
 
   case 230:
 
     {
-        (yyval.interm.typeSpecifierNonArray) = context->addStructure((yylsp[-4]), (yyloc), ImmutableString(""), (yyvsp[-1].interm.fieldList));
+        (yyval.interm.typeSpecifierNonArray) = context->addStructure((yylsp[-4]), (yyloc), kEmptyImmutableString, (yyvsp[-1].interm.fieldList));
     }
 
     break;
diff --git a/src/compiler/translator/tree_ops/PruneNoOps.cpp b/src/compiler/translator/tree_ops/PruneNoOps.cpp
index 9e80c38..0c02773 100644
--- a/src/compiler/translator/tree_ops/PruneNoOps.cpp
+++ b/src/compiler/translator/tree_ops/PruneNoOps.cpp
@@ -115,7 +115,7 @@
                     type->setQualifier(EvqTemporary);
                 }
                 TVariable *variable =
-                    new TVariable(mSymbolTable, ImmutableString(""), type, SymbolType::Empty);
+                    new TVariable(mSymbolTable, kEmptyImmutableString, type, SymbolType::Empty);
                 queueReplacementWithParent(node, declaratorSymbol, new TIntermSymbol(variable),
                                            OriginalNode::IS_DROPPED);
             }
diff --git a/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp b/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp
index 2a14e0f..c7117ad 100644
--- a/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp
+++ b/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp
@@ -207,7 +207,7 @@
                 return;
             }
             TVariable *emptyVariable =
-                new TVariable(mSymbolTable, ImmutableString(""), new TType(declarator->getType()),
+                new TVariable(mSymbolTable, kEmptyImmutableString, new TType(declarator->getType()),
                               SymbolType::Empty);
             queueReplacementWithParent(node, declarator, new TIntermSymbol(emptyVariable),
                                        OriginalNode::IS_DROPPED);
diff --git a/src/compiler/translator/tree_util/IntermNode_util.cpp b/src/compiler/translator/tree_util/IntermNode_util.cpp
index d5c822a..7f5abc4 100644
--- a/src/compiler/translator/tree_util/IntermNode_util.cpp
+++ b/src/compiler/translator/tree_util/IntermNode_util.cpp
@@ -150,7 +150,7 @@
     ASSERT(symbolTable != nullptr);
     // TODO(oetuaho): Might be useful to sanitize layout qualifier etc. on the type of the created
     // variable. This might need to be done in other places as well.
-    return new TVariable(symbolTable, ImmutableString(""), type, SymbolType::AngleInternal);
+    return new TVariable(symbolTable, kEmptyImmutableString, type, SymbolType::AngleInternal);
 }
 
 TVariable *CreateTempVariable(TSymbolTable *symbolTable, const TType *type, TQualifier qualifier)
diff --git a/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp b/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp
index 4f6160b..bd00b8a 100644
--- a/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp
+++ b/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp
@@ -69,8 +69,9 @@
                        TSymbolTable *symbolTable)
 {
     // Replace main() with main0() with the same body.
-    TFunction *oldMain = new TFunction(symbolTable, ImmutableString(""), SymbolType::AngleInternal,
-                                       StaticType::GetBasic<EbtVoid>(), false);
+    TFunction *oldMain =
+        new TFunction(symbolTable, kEmptyImmutableString, SymbolType::AngleInternal,
+                      StaticType::GetBasic<EbtVoid>(), false);
     TIntermFunctionDefinition *oldMainDefinition =
         CreateInternalFunctionDefinitionNode(*oldMain, main->getBody());