Explicitly insert builtins at symbol level 0 and declare variables at the top level.

Bug 19331817

Change-Id: I157c68e00aef3f2726bd72ac7ff96bdb8f191c75
Reviewed-on: https://swiftshader-review.googlesource.com/2350
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp
index 0b14803..62caea8 100644
--- a/src/OpenGL/compiler/ParseHelper.cpp
+++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -751,7 +751,7 @@
         if (type.arraySize)
             variable->getType().setArraySize(type.arraySize);
 
-        if (! symbolTable.insert(*variable)) {
+        if (! symbolTable.declare(*variable)) {
             delete variable;
             error(line, "INTERNAL ERROR inserting new symbol", identifier.c_str());
             return true;
@@ -885,7 +885,7 @@
 
     variable = new TVariable(&identifier, TType(type));
 
-    if (! symbolTable.insert(*variable)) {
+    if (! symbolTable.declare(*variable)) {
         error(line, "redefinition", variable->getName().c_str());
         delete variable;
         variable = 0;
@@ -1012,7 +1012,7 @@
         // add variable to symbol table
         //
         variable = new TVariable(&identifier, type);
-        if (! symbolTable.insert(*variable)) {
+        if (! symbolTable.declare(*variable)) {
             error(line, "redefinition", variable->getName().c_str());
             return true;
             // don't delete variable, it's used by error recovery, and the pool