Commit 383b791a by Olli Etuaho Committed by Commit Bot

Remove recover() from ParseContext

This call is a no-op. The shader parser is intended to almost always recover from errors, so including it doesn't clarify the code either. It's simpler to remove it entirely. BUG=angleproject:911 TEST=angle_unittests Change-Id: I0feae097c2807c8e9559672e7a3d50a2fc4fbdea Reviewed-on: https://chromium-review.googlesource.com/367040 Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent b088360f
...@@ -92,7 +92,6 @@ class TParseContext : angle::NonCopyable ...@@ -92,7 +92,6 @@ class TParseContext : angle::NonCopyable
const char *token, const char *token,
const char *extraInfo = ""); const char *extraInfo = "");
void recover();
TIntermNode *getTreeRoot() const { return mTreeRoot; } TIntermNode *getTreeRoot() const { return mTreeRoot; }
void setTreeRoot(TIntermNode *treeRoot) { mTreeRoot = treeRoot; } void setTreeRoot(TIntermNode *treeRoot) { mTreeRoot = treeRoot; }
...@@ -131,35 +130,42 @@ class TParseContext : angle::NonCopyable ...@@ -131,35 +130,42 @@ class TParseContext : angle::NonCopyable
void assignError(const TSourceLoc &line, const char *op, TString left, TString right); void assignError(const TSourceLoc &line, const char *op, TString left, TString right);
void unaryOpError(const TSourceLoc &line, const char *op, TString operand); void unaryOpError(const TSourceLoc &line, const char *op, TString operand);
void binaryOpError(const TSourceLoc &line, const char *op, TString left, TString right); void binaryOpError(const TSourceLoc &line, const char *op, TString left, TString right);
bool precisionErrorCheck(const TSourceLoc &line, TPrecision precision, TBasicType type); void precisionErrorCheck(const TSourceLoc &line, TPrecision precision, TBasicType type);
bool lValueErrorCheck(const TSourceLoc &line, const char *op, TIntermTyped*); bool lValueErrorCheck(const TSourceLoc &line, const char *op, TIntermTyped*);
bool constErrorCheck(TIntermTyped *node); void constErrorCheck(TIntermTyped *node);
bool integerErrorCheck(TIntermTyped *node, const char *token); void integerErrorCheck(TIntermTyped *node, const char *token);
bool globalErrorCheck(const TSourceLoc &line, bool global, const char *token); void globalErrorCheck(const TSourceLoc &line, bool global, const char *token);
bool constructorErrorCheck(const TSourceLoc &line, bool constructorErrorCheck(const TSourceLoc &line,
TIntermNode *argumentsNode, TIntermNode *argumentsNode,
TFunction &function, TFunction &function,
TOperator op, TOperator op,
TType *type); TType *type);
bool arraySizeErrorCheck(const TSourceLoc &line, TIntermTyped *expr, int &size); void arraySizeErrorCheck(const TSourceLoc &line, TIntermTyped *expr, int &size);
bool arrayQualifierErrorCheck(const TSourceLoc &line, const TPublicType &type); bool arrayQualifierErrorCheck(const TSourceLoc &line, const TPublicType &type);
bool arrayTypeErrorCheck(const TSourceLoc &line, const TPublicType &type); bool arrayTypeErrorCheck(const TSourceLoc &line, const TPublicType &type);
bool voidErrorCheck(const TSourceLoc &line, const TString &identifier, const TBasicType &type); bool voidErrorCheck(const TSourceLoc &line, const TString &identifier, const TBasicType &type);
bool boolErrorCheck(const TSourceLoc&, const TIntermTyped*); void boolErrorCheck(const TSourceLoc &, const TIntermTyped *);
bool boolErrorCheck(const TSourceLoc&, const TPublicType&); void boolErrorCheck(const TSourceLoc &, const TPublicType &);
bool samplerErrorCheck(const TSourceLoc &line, const TPublicType &pType, const char *reason); bool samplerErrorCheck(const TSourceLoc &line, const TPublicType &pType, const char *reason);
bool locationDeclaratorListCheck(const TSourceLoc &line, const TPublicType &pType); void locationDeclaratorListCheck(const TSourceLoc &line, const TPublicType &pType);
bool parameterSamplerErrorCheck(const TSourceLoc &line, TQualifier qualifier, const TType &type); void parameterSamplerErrorCheck(const TSourceLoc &line,
bool paramErrorCheck(const TSourceLoc &line, TQualifier qualifier, TQualifier paramQualifier, TType *type); TQualifier qualifier,
const TType &type);
void paramErrorCheck(const TSourceLoc &line,
TQualifier qualifier,
TQualifier paramQualifier,
TType *type);
bool extensionErrorCheck(const TSourceLoc &line, const TString&); bool extensionErrorCheck(const TSourceLoc &line, const TString&);
bool singleDeclarationErrorCheck(const TPublicType &publicType, const TSourceLoc &identifierLocation); void singleDeclarationErrorCheck(const TPublicType &publicType,
bool layoutLocationErrorCheck(const TSourceLoc &location, const TLayoutQualifier &layoutQualifier); const TSourceLoc &identifierLocation);
void layoutLocationErrorCheck(const TSourceLoc &location,
const TLayoutQualifier &layoutQualifier);
void layoutSupportedErrorCheck(const TSourceLoc &location, void layoutSupportedErrorCheck(const TSourceLoc &location,
const TString &layoutQualifierName, const TString &layoutQualifierName,
int versionRequired); int versionRequired);
bool layoutWorkGroupSizeErrorCheck(const TSourceLoc &location, bool layoutWorkGroupSizeErrorCheck(const TSourceLoc &location,
const TLayoutQualifier &layoutQualifier); const TLayoutQualifier &layoutQualifier);
bool functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *); void functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *);
void es3InvariantErrorCheck(const TQualifier qualifier, const TSourceLoc &invariantLocation); void es3InvariantErrorCheck(const TQualifier qualifier, const TSourceLoc &invariantLocation);
void es3InputOutputTypeCheck(const TQualifier qualifier, void es3InputOutputTypeCheck(const TQualifier qualifier,
const TPublicType &type, const TPublicType &type,
...@@ -309,9 +315,7 @@ class TParseContext : angle::NonCopyable ...@@ -309,9 +315,7 @@ class TParseContext : angle::NonCopyable
const TSourceLoc &storageLoc, TQualifier storageQualifier); const TSourceLoc &storageLoc, TQualifier storageQualifier);
// Performs an error check for embedded struct declarations. // Performs an error check for embedded struct declarations.
// Returns true if an error was raised due to the declaration of void enterStructDeclaration(const TSourceLoc &line, const TString &identifier);
// this struct.
bool enterStructDeclaration(const TSourceLoc &line, const TString &identifier);
void exitStructDeclaration(); void exitStructDeclaration();
bool structNestingErrorCheck(const TSourceLoc &line, const TField &field); bool structNestingErrorCheck(const TSourceLoc &line, const TField &field);
...@@ -371,7 +375,7 @@ class TParseContext : angle::NonCopyable ...@@ -371,7 +375,7 @@ class TParseContext : angle::NonCopyable
bool declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type, TVariable **variable); bool declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type, TVariable **variable);
bool nonInitErrorCheck(const TSourceLoc &line, const TString &identifier, TPublicType *type); void nonInitErrorCheck(const TSourceLoc &line, const TString &identifier, TPublicType *type);
TIntermTyped *addBinaryMathInternal( TIntermTyped *addBinaryMathInternal(
TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc); TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
......
...@@ -392,7 +392,6 @@ O [0-7] ...@@ -392,7 +392,6 @@ O [0-7]
<FIELDS>[ \t\v\f\r] {} <FIELDS>[ \t\v\f\r] {}
<FIELDS>. { <FIELDS>. {
yyextra->error(*yylloc, "Illegal character at fieldname start", yytext, ""); yyextra->error(*yylloc, "Illegal character at fieldname start", yytext, "");
yyextra->recover();
return 0; return 0;
} }
...@@ -437,7 +436,6 @@ int reserved_word(yyscan_t yyscanner) { ...@@ -437,7 +436,6 @@ int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
yyextra->error(*yylloc, "Illegal use of reserved word", yytext, ""); yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->recover();
return 0; return 0;
} }
...@@ -487,7 +485,6 @@ int uint_constant(TParseContext *context) ...@@ -487,7 +485,6 @@ int uint_constant(TParseContext *context)
if (context->getShaderVersion() < 300) if (context->getShaderVersion() < 300)
{ {
context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, ""); context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
context->recover();
return 0; return 0;
} }
...@@ -504,7 +501,6 @@ int floatsuffix_check(TParseContext* context) ...@@ -504,7 +501,6 @@ int floatsuffix_check(TParseContext* context)
if (context->getShaderVersion() < 300) if (context->getShaderVersion() < 300)
{ {
context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext); context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
context->recover();
return 0; return 0;
} }
...@@ -518,7 +514,6 @@ int floatsuffix_check(TParseContext* context) ...@@ -518,7 +514,6 @@ int floatsuffix_check(TParseContext* context)
void yyerror(YYLTYPE* lloc, TParseContext* context, void *scanner, const char* reason) { void yyerror(YYLTYPE* lloc, TParseContext* context, void *scanner, const char* reason) {
context->error(*lloc, reason, yyget_text(scanner)); context->error(*lloc, reason, yyget_text(scanner));
context->recover();
} }
int int_constant(TParseContext *context) { int int_constant(TParseContext *context) {
......
...@@ -2075,7 +2075,6 @@ case 237: ...@@ -2075,7 +2075,6 @@ case 237:
YY_RULE_SETUP YY_RULE_SETUP
{ {
yyextra->error(*yylloc, "Illegal character at fieldname start", yytext, ""); yyextra->error(*yylloc, "Illegal character at fieldname start", yytext, "");
yyextra->recover();
return 0; return 0;
} }
YY_BREAK YY_BREAK
...@@ -3275,7 +3274,6 @@ int reserved_word(yyscan_t yyscanner) { ...@@ -3275,7 +3274,6 @@ int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
yyextra->error(*yylloc, "Illegal use of reserved word", yytext, ""); yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->recover();
return 0; return 0;
} }
...@@ -3325,7 +3323,6 @@ int uint_constant(TParseContext *context) ...@@ -3325,7 +3323,6 @@ int uint_constant(TParseContext *context)
if (context->getShaderVersion() < 300) if (context->getShaderVersion() < 300)
{ {
context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, ""); context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
context->recover();
return 0; return 0;
} }
...@@ -3342,7 +3339,6 @@ int floatsuffix_check(TParseContext* context) ...@@ -3342,7 +3339,6 @@ int floatsuffix_check(TParseContext* context)
if (context->getShaderVersion() < 300) if (context->getShaderVersion() < 300)
{ {
context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext); context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
context->recover();
return 0; return 0;
} }
...@@ -3356,7 +3352,6 @@ int floatsuffix_check(TParseContext* context) ...@@ -3356,7 +3352,6 @@ int floatsuffix_check(TParseContext* context)
void yyerror(YYLTYPE* lloc, TParseContext* context, void *scanner, const char* reason) { void yyerror(YYLTYPE* lloc, TParseContext* context, void *scanner, const char* reason) {
context->error(*lloc, reason, yyget_text(scanner)); context->error(*lloc, reason, yyget_text(scanner));
context->recover();
} }
int int_constant(TParseContext *context) { int int_constant(TParseContext *context) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment