Classify TSymbols using an enum

Symbols can be either built-ins, user-defined, nameless, or for
ANGLE's internal use. In addition we currently use TFunction symbols
that are not yet resolved - they might later resolve to either a
built-in or a user-defined function. Record this information in each
TSymbol so that TSymbol contains sufficient information for deciding
how to format symbol names in output.

The goal is to eventually replace current uses of TName with pointers
to different TSymbol objects. So far only built-ins and user-defined
symbols have associated TSymbol objects, but that will be expanded to
cover ANGLE's internal symbols as well.

BUG=angleproject:2267
TEST=angle_unittests

Change-Id: I927ce023fe257cc236da82c127700f3bd72bfe96
Reviewed-on: https://chromium-review.googlesource.com/816952
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/OutputGLSLBase.cpp b/src/compiler/translator/OutputGLSLBase.cpp
index 814ee77..488921d 100644
--- a/src/compiler/translator/OutputGLSLBase.cpp
+++ b/src/compiler/translator/OutputGLSLBase.cpp
@@ -310,7 +310,7 @@
 
         declareStruct(structure);
 
-        if (!structure->name().empty())
+        if (structure->symbolType() != SymbolType::Empty)
         {
             mDeclaredStructs.insert(structure->uniqueId().get());
         }
@@ -583,7 +583,8 @@
                 const TField *field               = structure->fields()[index->getIConst(0)];
 
                 TString fieldName = field->name();
-                if (!mSymbolTable->findBuiltIn(structure->name(), mShaderVersion))
+                if (structure->symbolType() == SymbolType::UserDefined ||
+                    structure->symbolType() == SymbolType::Empty)
                     fieldName = hashName(TName(fieldName));
 
                 out << fieldName;
@@ -600,7 +601,8 @@
                 const TField *field               = interfaceBlock->fields()[index->getIConst(0)];
 
                 TString fieldName = field->name();
-                if (!mSymbolTable->findBuiltIn(interfaceBlock->name(), mShaderVersion))
+                ASSERT(interfaceBlock->symbolType() != SymbolType::Empty);
+                if (interfaceBlock->symbolType() == SymbolType::UserDefined)
                 {
                     fieldName = hashName(TName(fieldName));
                 }
@@ -1156,7 +1158,7 @@
 bool TOutputGLSLBase::structDeclared(const TStructure *structure) const
 {
     ASSERT(structure);
-    if (structure->name().empty())
+    if (structure->symbolType() == SymbolType::Empty)
     {
         return false;
     }