Revert "Make TParseContext a class, with private data."
Causing build errors on Linux:
FAILED: ninja -t msvc -e environment.x86 -- C:\b\build\goma/gomacc "C:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj.rsp /c ..\..\third_party\angle\src\compiler\translator\ParseContext.cpp /Foobj\third_party\angle\src\compiler\translator\translator_lib.ParseContext.obj /Fdobj\third_party\angle\src\translator_lib.cc.pdb
c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : error C2220: warning treated as error - no 'object' file generated
c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\validateglobalinitializer.h(11) : warning C4099: 'TParseContext' : type name first seen using 'class' now seen using 'struct'
c:\b\build\slave\gpu_win_builder__dbg_\build\src\third_party\angle\src\compiler\translator\parsecontext.h(28) : see declaration of 'TParseContext'
BUG=angleproject:995
This reverts commit 6c0c2987fba9dcf2a8d432534c9548092281bfa4.
Change-Id: I49a8b7df9bc8b7c4892bf3af5e2c7a6444fba890
Reviewed-on: https://chromium-review.googlesource.com/270767
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/ParseContext.h b/src/compiler/translator/ParseContext.h
index d328e9a..c1be7c9 100644
--- a/src/compiler/translator/ParseContext.h
+++ b/src/compiler/translator/ParseContext.h
@@ -25,9 +25,8 @@
// The following are extra variables needed during parsing, grouped together so
// they can be passed to the parser without needing a global.
//
-class TParseContext : angle::NonCopyable
+struct TParseContext : angle::NonCopyable
{
- public:
TParseContext(TSymbolTable &symt,
TExtensionBehavior &ext,
TIntermediate &interm,
@@ -39,73 +38,58 @@
bool debugShaderPrecisionSupported)
: intermediate(interm),
symbolTable(symt),
- mShaderType(type),
- mShaderSpec(spec),
- mCompileOptions(options),
- mTreeRoot(nullptr),
+ shaderType(type),
+ shaderSpec(spec),
+ compileOptions(options),
+ treeRoot(nullptr),
mLoopNestingLevel(0),
- mStructNestingLevel(0),
+ structNestingLevel(0),
mSwitchNestingLevel(0),
- mCurrentFunctionType(nullptr),
+ currentFunctionType(nullptr),
mFunctionReturnsValue(false),
- mChecksPrecisionErrors(checksPrecErrors),
- mFragmentPrecisionHigh(false),
- mDefaultMatrixPacking(EmpColumnMajor),
- mDefaultBlockStorage(EbsShared),
- mDiagnostics(is),
- mShaderVersion(100),
- mDirectiveHandler(ext, mDiagnostics, mShaderVersion, debugShaderPrecisionSupported),
- mPreprocessor(&mDiagnostics, &mDirectiveHandler),
- mScanner(nullptr),
+ checksPrecisionErrors(checksPrecErrors),
+ fragmentPrecisionHigh(false),
+ defaultMatrixPacking(EmpColumnMajor),
+ defaultBlockStorage(EbsShared),
+ diagnostics(is),
+ shaderVersion(100),
+ directiveHandler(ext, diagnostics, shaderVersion, debugShaderPrecisionSupported),
+ preprocessor(&diagnostics, &directiveHandler),
+ scanner(nullptr),
mDeferredSingleDeclarationErrorCheck(false)
{
}
- const pp::Preprocessor &getPreprocessor() const { return mPreprocessor; }
- pp::Preprocessor &getPreprocessor() { return mPreprocessor; }
- void *getScanner() const { return mScanner; }
- void setScanner(void *scanner) { mScanner = scanner; }
- int getShaderVersion() const { return mShaderVersion; }
- sh::GLenum getShaderType() const { return mShaderType; }
- ShShaderSpec getShaderSpec() const { return mShaderSpec; }
- int numErrors() const { return mDiagnostics.numErrors(); }
- TInfoSink &infoSink() { return mDiagnostics.infoSink(); }
+ TIntermediate &intermediate; // to hold and build a parse tree
+ TSymbolTable &symbolTable; // symbol table that goes with the language currently being parsed
+ sh::GLenum shaderType; // vertex or fragment language (future: pack or unpack)
+ ShShaderSpec shaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
+ int shaderVersion;
+ int compileOptions;
+ TIntermNode *treeRoot; // root of parse tree being created
+ int mLoopNestingLevel; // 0 if outside all loops
+ int structNestingLevel; // incremented while parsing a struct declaration
+ int mSwitchNestingLevel; // 0 if outside all switch statements
+ const TType *currentFunctionType; // the return type of the function that's currently being parsed
+ bool mFunctionReturnsValue; // true if a non-void function has a return
+ bool checksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
+ bool fragmentPrecisionHigh; // true if highp precision is supported in the fragment language.
+ TLayoutMatrixPacking defaultMatrixPacking;
+ TLayoutBlockStorage defaultBlockStorage;
+ TString HashErrMsg;
+ TDiagnostics diagnostics;
+ TDirectiveHandler directiveHandler;
+ pp::Preprocessor preprocessor;
+ void *scanner;
+
+ int getShaderVersion() const { return shaderVersion; }
+ int numErrors() const { return diagnostics.numErrors(); }
+ TInfoSink &infoSink() { return diagnostics.infoSink(); }
void error(const TSourceLoc &loc, const char *reason, const char *token,
const char *extraInfo="");
void warning(const TSourceLoc &loc, const char *reason, const char *token,
const char *extraInfo="");
void recover();
- TIntermNode *getTreeRoot() const { return mTreeRoot; }
- void setTreeRoot(TIntermNode *treeRoot) { mTreeRoot = treeRoot; }
-
- bool getFragmentPrecisionHigh() const { return mFragmentPrecisionHigh; }
- void setFragmentPrecisionHigh(bool fragmentPrecisionHigh)
- {
- mFragmentPrecisionHigh = fragmentPrecisionHigh;
- }
-
- bool getFunctionReturnsValue() const { return mFunctionReturnsValue; }
- void setFunctionReturnsValue(bool functionReturnsValue)
- {
- mFunctionReturnsValue = functionReturnsValue;
- }
-
- void setLoopNestingLevel(int loopNestintLevel)
- {
- mLoopNestingLevel = loopNestintLevel;
- }
-
- const TType *getCurrentFunctionType() const { return mCurrentFunctionType; }
- void setCurrentFunctionType(const TType *currentFunctionType)
- {
- mCurrentFunctionType = currentFunctionType;
- }
-
- void incrLoopNestingLevel() { ++mLoopNestingLevel; }
- void decrLoopNestingLevel() { --mLoopNestingLevel; }
-
- void incrSwitchNestingLevel() { ++mSwitchNestingLevel; }
- void decrSwitchNestingLevel() { --mSwitchNestingLevel; }
// This method is guaranteed to succeed, even if no variable with 'name' exists.
const TVariable *getNamedVariable(const TSourceLoc &location, const TString *name, const TSymbol *symbol);
@@ -139,8 +123,8 @@
bool functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *);
void es3InvariantErrorCheck(const TQualifier qualifier, const TSourceLoc &invariantLocation);
- const TPragma &pragma() const { return mDirectiveHandler.pragma(); }
- const TExtensionBehavior &extensionBehavior() const { return mDirectiveHandler.extensionBehavior(); }
+ const TPragma &pragma() const { return directiveHandler.pragma(); }
+ const TExtensionBehavior &extensionBehavior() const { return directiveHandler.extensionBehavior(); }
bool supportsExtension(const char *extension);
bool isExtensionEnabled(const char *extension) const;
void handleExtensionDirective(const TSourceLoc &loc, const char *extName, const char *behavior);
@@ -297,10 +281,6 @@
TIntermTyped *addTernarySelection(
TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock, const TSourceLoc &line);
- // TODO(jmadill): make these private
- TIntermediate &intermediate; // to hold and build a parse tree
- TSymbolTable &symbolTable; // symbol table that goes with the language currently being parsed
-
private:
bool declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type, TVariable **variable);
@@ -321,26 +301,6 @@
// Set to true when the last/current declarator list was started with an empty declaration.
bool mDeferredSingleDeclarationErrorCheck;
-
- sh::GLenum mShaderType; // vertex or fragment language (future: pack or unpack)
- ShShaderSpec mShaderSpec; // The language specification compiler conforms to - GLES2 or WebGL.
- int mShaderVersion;
- int mCompileOptions;
- TIntermNode *mTreeRoot; // root of parse tree being created
- int mLoopNestingLevel; // 0 if outside all loops
- int mStructNestingLevel; // incremented while parsing a struct declaration
- int mSwitchNestingLevel; // 0 if outside all switch statements
- const TType *mCurrentFunctionType; // the return type of the function that's currently being parsed
- bool mFunctionReturnsValue; // true if a non-void function has a return
- bool mChecksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
- bool mFragmentPrecisionHigh; // true if highp precision is supported in the fragment language.
- TLayoutMatrixPacking mDefaultMatrixPacking;
- TLayoutBlockStorage mDefaultBlockStorage;
- TString mHashErrMsg;
- TDiagnostics mDiagnostics;
- TDirectiveHandler mDirectiveHandler;
- pp::Preprocessor mPreprocessor;
- void *mScanner;
};
int PaParseStrings(