Replace EvqInternal with a separate flag to make it more flexible

The internal flag disables decorating a given symbol in output, effectively
placing it to a different namespace than user-defined symbols. This enables the
compiler to insert symbols to the tree when transforming it to be suitable for
HLSL output without running into name conflicts. In this patch the flag is
separated from the qualifiers since sometimes different qualifiers need to be
used with these internal symbols.

TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests
BUG=angleproject:941

Change-Id: I7036bed98fdb1478a383bb959ca03b42c3cb8100
Reviewed-on: https://chromium-review.googlesource.com/266690
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/BaseTypes.h b/src/compiler/translator/BaseTypes.h
index ee1428b..18dcd3e 100644
--- a/src/compiler/translator/BaseTypes.h
+++ b/src/compiler/translator/BaseTypes.h
@@ -286,7 +286,6 @@
 {
     EvqTemporary,     // For temporaries (within a function), read/write
     EvqGlobal,        // For globals read/write
-    EvqInternal,      // For internal use, not visible to the user
     EvqConst,         // User defined constants and non-output parameters in functions
     EvqAttribute,     // Readonly
     EvqVaryingIn,     // readonly, fragment shaders only
diff --git a/src/compiler/translator/IntermNode.h b/src/compiler/translator/IntermNode.h
index 0bacd3d..81231c0 100644
--- a/src/compiler/translator/IntermNode.h
+++ b/src/compiler/translator/IntermNode.h
@@ -212,7 +212,8 @@
     // per compile it is essential to use "symbol = sym" to assign to symbol
     TIntermSymbol(int id, const TString &symbol, const TType &type)
         : TIntermTyped(type),
-          mId(id)
+          mId(id),
+          mInternal(false)
     {
         mSymbol = symbol;
     }
@@ -224,12 +225,16 @@
 
     void setId(int newId) { mId = newId; }
 
+    bool isInternal() const { return mInternal; }
+    void setInternal(bool isInternal) { mInternal = isInternal; }
+
     virtual void traverse(TIntermTraverser *);
     virtual TIntermSymbol *getAsSymbolNode() { return this; }
     virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
 
   protected:
     int mId;
+    bool mInternal;
     TString mSymbol;
 };
 
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index f63a47a..02c5fbd 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1389,7 +1389,7 @@
             mUsesFragDepth = true;
             out << "gl_Depth";
         }
-        else if (qualifier == EvqInternal)
+        else if (node->isInternal())
         {
             out << name;
         }
diff --git a/src/compiler/translator/RewriteElseBlocks.cpp b/src/compiler/translator/RewriteElseBlocks.cpp
index b03beb5..4631b5d 100644
--- a/src/compiler/translator/RewriteElseBlocks.cpp
+++ b/src/compiler/translator/RewriteElseBlocks.cpp
@@ -34,8 +34,10 @@
 
 TIntermSymbol *MakeNewTemporary(const TString &name, TBasicType type)
 {
-    TType variableType(type, EbpHigh, EvqInternal);
-    return new TIntermSymbol(-1, name, variableType);
+    TType variableType(type, EbpHigh, EvqTemporary);
+    TIntermSymbol *node = new TIntermSymbol(-1, name, variableType);
+    node->setInternal(true);
+    return node;
 }
 
 TIntermBinary *MakeNewBinary(TOperator op, TIntermTyped *left, TIntermTyped *right, const TType &resultType)