Refactored the way symbol tables are initialized and stored. This was done in response to the addition of EShSpec.
Symbol table entries depend on three things - language, spec (not now but may eventually), and built-in resources.
We used to build two global symbol-tables - one for each language. During each compile, one of the symbol table was
copied and resource-specific stuff was added. I have moved the symbol table to TCompiler that gets initilized when
compiler is created and reused for each compile. This makes it much cleaner and extensible in case a spec requires
special entries to be added to the symbol table.
PS: Sorry for the long CL, but all of it needed to be done in one CL. I have verified that everything still compiles
and passes all conformance tests.
Review URL: http://codereview.appspot.com/1864044
git-svn-id: https://angleproject.googlecode.com/svn/trunk@351 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/ShHandle.h b/src/compiler/ShHandle.h
index 48a17dd..5ef5d30 100644
--- a/src/compiler/ShHandle.h
+++ b/src/compiler/ShHandle.h
@@ -17,6 +17,7 @@
#include "GLSLANG/ShaderLang.h"
#include "compiler/InfoSink.h"
+#include "compiler/SymbolTable.h"
class TCompiler;
class TIntermNode;
@@ -40,18 +41,24 @@
TCompiler(EShLanguage l, EShSpec s) : language(l), spec(s) { }
virtual ~TCompiler() { }
- EShLanguage getLanguage() { return language; }
- EShSpec getSpec() { return spec; }
- virtual TInfoSink& getInfoSink() { return infoSink; }
+ EShLanguage getLanguage() const { return language; }
+ EShSpec getSpec() const { return spec; }
+ TSymbolTable& getSymbolTable() { return symbolTable; }
+ TInfoSink& getInfoSink() { return infoSink; }
virtual bool compile(TIntermNode* root) = 0;
virtual TCompiler* getAsCompiler() { return this; }
- TInfoSink infoSink;
protected:
EShLanguage language;
EShSpec spec;
+
+ // Built-in symbol table for the given language, spec, and resources.
+ // It is preserved from compile-to-compile.
+ TSymbolTable symbolTable;
+ // Output sink.
+ TInfoSink infoSink;
};
//