Adding Struct related types

Added TField, TFieldListCollection, TStructure
and TInterfaceBlock for structures and uniform
blocks.

In the TType class, changed structure's type
from TTypeList to TStructure and made related
changes in other files to reflect this change.

Change-Id: Ided4c535651a566952c3314c8c4f31c2d0ccdcca
Reviewed-on: https://swiftshader-review.googlesource.com/3451
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp
index b403feb..22e38a7 100644
--- a/src/OpenGL/compiler/ParseHelper.cpp
+++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -522,7 +522,7 @@
         return true;
     }
 
-    if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->size()) != function.getParamCount()) {
+    if (op == EOpConstructStruct && !type->isArray() && int(type->getStruct()->fields().size()) != function.getParamCount()) {
         error(line, "Number of constructor parameters does not match the number of structure fields", "constructor");
         return true;
     }
@@ -682,9 +682,9 @@
         return true;
 
     if (type.getBasicType() == EbtStruct) {
-        TTypeList& structure = *type.getStruct();
-        for (unsigned int i = 0; i < structure.size(); ++i) {
-            if (containsSampler(*structure[i].type))
+        const TFieldList& fields = type.getStruct()->fields();
+        for(unsigned int i = 0; i < fields.size(); ++i) {
+            if (containsSampler(*fields[i]->type()))
                 return true;
         }
     }
@@ -1232,12 +1232,12 @@
 
     if(op == EOpConstructStruct)
     {
-        TTypeList &fields = *type->getStruct();
+        const TFieldList &fields = type->getStruct()->fields();
         TIntermSequence &args = aggregateArguments->getSequence();
 
         for(size_t i = 0; i < fields.size(); i++)
         {
-            if(args[i]->getAsTyped()->getType() != *fields[i].type)
+            if(args[i]->getAsTyped()->getType() != *fields[i]->type())
             {
                 error(line, "Structure constructor arguments do not match structure fields", "Error");
                 recover();
@@ -1405,17 +1405,17 @@
 //
 TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* node, TSourceLoc line)
 {
-    const TTypeList* fields = node->getType().getStruct();
+    const TFieldList &fields = node->getType().getStruct()->fields();
     TIntermTyped *typedNode;
     int instanceSize = 0;
     unsigned int index = 0;
     TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
 
-    for ( index = 0; index < fields->size(); ++index) {
-        if ((*fields)[index].type->getFieldName() == identifier) {
+    for ( index = 0; index < fields.size(); ++index) {
+        if (fields[index]->name() == identifier) {
             break;
         } else {
-            instanceSize += (*fields)[index].type->getObjectSize();
+            instanceSize += fields[index]->type()->getObjectSize();
         }
     }