Refactor ShaderVariables to store fields in the base.

Instead of only storing structure information in Varyings, Uniforms
and Interface Block Fields, store it in the base class. Also only
store base variable information for struct fields, instead of fully
typed information. This works because stuff like interpolation type,
invariance, and other properties are for the entire variable, not
individual fields.

Also add new fields for interface block instance name, varying
invariance and structure name for all struct types.

BUG=angle:466

Change-Id: If03fc071e6becb7aad6dea5093989bba7daee69e
Reviewed-on: https://chromium-review.googlesource.com/213501
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
diff --git a/src/compiler/translator/ShaderVars.cpp b/src/compiler/translator/ShaderVars.cpp
index 164eaa6..90f3bd0 100644
--- a/src/compiler/translator/ShaderVars.cpp
+++ b/src/compiler/translator/ShaderVars.cpp
@@ -35,7 +35,9 @@
       name(other.name),
       mappedName(other.mappedName),
       arraySize(other.arraySize),
-      staticUse(other.staticUse)
+      staticUse(other.staticUse),
+      fields(other.fields),
+      structName(other.structName)
 {}
 
 ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other)
@@ -46,6 +48,8 @@
     mappedName = other.mappedName;
     arraySize = other.arraySize;
     staticUse = other.staticUse;
+    fields = other.fields;
+    structName = other.structName;
     return *this;
 }
 
@@ -56,14 +60,12 @@
 {}
 
 Uniform::Uniform(const Uniform &other)
-    : ShaderVariable(other),
-      fields(other.fields)
+    : ShaderVariable(other)
 {}
 
 Uniform &Uniform::operator=(const Uniform &other)
 {
     ShaderVariable::operator=(other);
-    fields = other.fields;
     return *this;
 }
 
@@ -95,20 +97,19 @@
 
 InterfaceBlockField::InterfaceBlockField(const InterfaceBlockField &other)
     : ShaderVariable(other),
-      isRowMajorMatrix(other.isRowMajorMatrix),
-      fields(other.fields)
+      isRowMajorMatrix(other.isRowMajorMatrix)
 {}
 
 InterfaceBlockField &InterfaceBlockField::operator=(const InterfaceBlockField &other)
 {
     ShaderVariable::operator=(other);
     isRowMajorMatrix = other.isRowMajorMatrix;
-    fields = other.fields;
     return *this;
 }
 
 Varying::Varying()
-    : interpolation(INTERPOLATION_SMOOTH)
+    : interpolation(INTERPOLATION_SMOOTH),
+      isInvariant(false)
 {}
 
 Varying::~Varying()
@@ -117,16 +118,14 @@
 Varying::Varying(const Varying &other)
     : ShaderVariable(other),
       interpolation(other.interpolation),
-      fields(other.fields),
-      structName(other.structName)
+      isInvariant(other.isInvariant)
 {}
 
 Varying &Varying::operator=(const Varying &other)
 {
     ShaderVariable::operator=(other);
     interpolation = other.interpolation;
-    fields = other.fields;
-    structName = other.structName;
+    isInvariant = other.isInvariant;
     return *this;
 }
 
@@ -143,6 +142,7 @@
 InterfaceBlock::InterfaceBlock(const InterfaceBlock &other)
     : name(other.name),
       mappedName(other.mappedName),
+      instanceName(other.instanceName),
       arraySize(other.arraySize),
       layout(other.layout),
       isRowMajorLayout(other.isRowMajorLayout),
@@ -154,6 +154,7 @@
 {
     name = other.name;
     mappedName = other.mappedName;
+    instanceName = other.instanceName;
     arraySize = other.arraySize;
     layout = other.layout;
     isRowMajorLayout = other.isRowMajorLayout;