Simplify AST transformations that need to find main

Share code for finding the main function from the AST between
InitializeVariables, DeferGlobalInitializers,
EmulateGLFragColorBroadcast and UseInterfaceBlockFields. This makes
InitializeVariables simpler in particular, as it doesn't need an AST
traverser anymore.

BUG=angleproject:2033
TEST=angle_unittests, WebGL conformance tests

Change-Id: I14c994bbde58a904f6684d2f0b72bd8004f70902
Reviewed-on: https://chromium-review.googlesource.com/501166
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/Compiler.h b/src/compiler/translator/Compiler.h
index ffc063f..c39766e 100644
--- a/src/compiler/translator/Compiler.h
+++ b/src/compiler/translator/Compiler.h
@@ -146,15 +146,15 @@
     // Insert statements to reference all members in unused uniform blocks with standard and shared
     // layout. This is to work around a Mac driver that treats unused standard/shared
     // uniform blocks as inactive.
-    void useAllMembersInUnusedStandardAndSharedBlocks(TIntermNode *root);
+    void useAllMembersInUnusedStandardAndSharedBlocks(TIntermBlock *root);
     // Insert statements to initialize output variables in the beginning of main().
     // This is to avoid undefined behaviors.
-    void initializeOutputVariables(TIntermNode *root);
+    void initializeOutputVariables(TIntermBlock *root);
     // Insert gl_Position = vec4(0,0,0,0) to the beginning of main().
     // It is to work around a Linux driver bug where missing this causes compile failure
     // while spec says it is allowed.
     // This function should only be applied to vertex shaders.
-    void initializeGLPosition(TIntermNode *root);
+    void initializeGLPosition(TIntermBlock *root);
     // Return true if the maximum expression complexity is below the limit.
     bool limitExpressionComplexity(TIntermNode *root);
     // Get built-in extensions with default behavior.