translator: Put ShaderLang APIs in "sh" namespace.

Working with glslang in Vulkan means we are static linking libANGLE
with functions that have the same name as our translator APIs. We
can fix this by scoping our APIs. We don't need to scope the types
of the file, since they don't conflict.

This will require a follow-up patch to remove the unscoped APIs
once we switch over Chromium.

We also scope TCompiler and some related classes to avoid multiply
defined link errors with glslang.

BUG=angleproject:1576

Change-Id: I729b19467d2ff7d374a82044b16dbebdf2dc8f16
Reviewed-on: https://chromium-review.googlesource.com/408337
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 344c92f..eb96d2a 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -65,6 +65,50 @@
 
 }  // namespace
 
+TParseContext::TParseContext(TSymbolTable &symt,
+                             TExtensionBehavior &ext,
+                             sh::GLenum type,
+                             ShShaderSpec spec,
+                             ShCompileOptions options,
+                             bool checksPrecErrors,
+                             TInfoSink &is,
+                             const ShBuiltInResources &resources)
+    : intermediate(),
+      symbolTable(symt),
+      mDeferredSingleDeclarationErrorCheck(false),
+      mShaderType(type),
+      mShaderSpec(spec),
+      mCompileOptions(options),
+      mShaderVersion(100),
+      mTreeRoot(nullptr),
+      mLoopNestingLevel(0),
+      mStructNestingLevel(0),
+      mSwitchNestingLevel(0),
+      mCurrentFunctionType(nullptr),
+      mFunctionReturnsValue(false),
+      mChecksPrecisionErrors(checksPrecErrors),
+      mFragmentPrecisionHighOnESSL1(false),
+      mDefaultMatrixPacking(EmpColumnMajor),
+      mDefaultBlockStorage(sh::IsWebGLBasedSpec(spec) ? EbsStd140 : EbsShared),
+      mDiagnostics(is),
+      mDirectiveHandler(ext,
+                        mDiagnostics,
+                        mShaderVersion,
+                        mShaderType,
+                        resources.WEBGL_debug_shader_precision == 1),
+      mPreprocessor(&mDiagnostics, &mDirectiveHandler),
+      mScanner(nullptr),
+      mUsesFragData(false),
+      mUsesFragColor(false),
+      mUsesSecondaryOutputs(false),
+      mMinProgramTexelOffset(resources.MinProgramTexelOffset),
+      mMaxProgramTexelOffset(resources.MaxProgramTexelOffset),
+      mComputeShaderLocalSizeDeclared(false),
+      mDeclaringFunction(false)
+{
+    mComputeShaderLocalSize.fill(-1);
+}
+
 //
 // Look at a '.' field selector string and change it into offsets
 // for a vector.
@@ -481,7 +525,7 @@
             error(line, reservedErrMsg, "gl_");
             return false;
         }
-        if (IsWebGLBasedSpec(mShaderSpec))
+        if (sh::IsWebGLBasedSpec(mShaderSpec))
         {
             if (identifier.compare(0, 6, "webgl_") == 0)
             {
@@ -2844,7 +2888,7 @@
 
 void TParseContext::checkIsBelowStructNestingLimit(const TSourceLoc &line, const TField &field)
 {
-    if (!IsWebGLBasedSpec(mShaderSpec))
+    if (!sh::IsWebGLBasedSpec(mShaderSpec))
     {
         return;
     }
@@ -3134,7 +3178,7 @@
 
     if (qualifierType == "shared")
     {
-        if (IsWebGLBasedSpec(mShaderSpec))
+        if (sh::IsWebGLBasedSpec(mShaderSpec))
         {
             error(qualifierTypeLine, "Only std140 layout is allowed in WebGL", "shared");
         }
@@ -3142,7 +3186,7 @@
     }
     else if (qualifierType == "packed")
     {
-        if (IsWebGLBasedSpec(mShaderSpec))
+        if (sh::IsWebGLBasedSpec(mShaderSpec))
         {
             error(qualifierTypeLine, "Only std140 layout is allowed in WebGL", "packed");
         }