Commit 1397dd35 by alokp@chromium.org

Refactor location tracking.

R=kbr@chromium.org Review URL: https://codereview.appspot.com/9078046 git-svn-id: https://angleproject.googlecode.com/svn/trunk@2202 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent ebc93e08
...@@ -14,24 +14,12 @@ ...@@ -14,24 +14,12 @@
#include "compiler/PoolAlloc.h" #include "compiler/PoolAlloc.h"
// We need two pieces of information to report errors/warnings - string and struct TSourceLoc {
// line number. We encode these into a single int so that it can be easily int first_file;
// incremented/decremented by lexer. The right SOURCE_LOC_LINE_SIZE bits store int first_line;
// line number while the rest store the string number. Since the shaders are int last_file;
// usually small, we should not run out of memory. SOURCE_LOC_LINE_SIZE int last_line;
// can be increased to alleviate this issue. };
typedef int TSourceLoc;
const unsigned int SOURCE_LOC_LINE_SIZE = 16; // in bits.
const unsigned int SOURCE_LOC_LINE_MASK = (1 << SOURCE_LOC_LINE_SIZE) - 1;
inline TSourceLoc EncodeSourceLoc(int string, int line) {
return (string << SOURCE_LOC_LINE_SIZE) | (line & SOURCE_LOC_LINE_MASK);
}
inline void DecodeSourceLoc(TSourceLoc loc, int* string, int* line) {
if (string) *string = loc >> SOURCE_LOC_LINE_SIZE;
if (line) *line = loc & SOURCE_LOC_LINE_MASK;
}
// //
// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme. // Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.
......
...@@ -62,7 +62,8 @@ bool InitializeSymbolTable( ...@@ -62,7 +62,8 @@ bool InitializeSymbolTable(
if (PaParseStrings(1, &builtInShaders, &builtInLengths, &parseContext) != 0) if (PaParseStrings(1, &builtInShaders, &builtInLengths, &parseContext) != 0)
{ {
infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins"); infoSink.info.prefix(EPrefixInternalError);
infoSink.info << "Unable to parse built-ins";
return false; return false;
} }
} }
...@@ -170,8 +171,10 @@ bool TCompiler::compile(const char* const shaderStrings[], ...@@ -170,8 +171,10 @@ bool TCompiler::compile(const char* const shaderStrings[],
// We preserve symbols at the built-in level from compile-to-compile. // We preserve symbols at the built-in level from compile-to-compile.
// Start pushing the user-defined symbols at global level. // Start pushing the user-defined symbols at global level.
symbolTable.push(); symbolTable.push();
if (!symbolTable.atGlobalLevel()) if (!symbolTable.atGlobalLevel()) {
infoSink.info.message(EPrefixInternalError, "Wrong symbol table level"); infoSink.info.prefix(EPrefixInternalError);
infoSink.info << "Wrong symbol table level";
}
// Parse shader. // Parse shader.
bool success = bool success =
...@@ -217,7 +220,8 @@ bool TCompiler::compile(const char* const shaderStrings[], ...@@ -217,7 +220,8 @@ bool TCompiler::compile(const char* const shaderStrings[],
if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) { if (compileOptions & SH_ENFORCE_PACKING_RESTRICTIONS) {
success = enforcePackingRestrictions(); success = enforcePackingRestrictions();
if (!success) { if (!success) {
infoSink.info.message(EPrefixError, "too many uniforms"); infoSink.info.prefix(EPrefixError);
infoSink.info << "too many uniforms";
} }
} }
} }
...@@ -271,10 +275,12 @@ bool TCompiler::detectRecursion(TIntermNode* root) ...@@ -271,10 +275,12 @@ bool TCompiler::detectRecursion(TIntermNode* root)
case DetectRecursion::kErrorNone: case DetectRecursion::kErrorNone:
return true; return true;
case DetectRecursion::kErrorMissingMain: case DetectRecursion::kErrorMissingMain:
infoSink.info.message(EPrefixError, "Missing main()"); infoSink.info.prefix(EPrefixError);
infoSink.info << "Missing main()";
return false; return false;
case DetectRecursion::kErrorRecursion: case DetectRecursion::kErrorRecursion:
infoSink.info.message(EPrefixError, "Function recursion detected"); infoSink.info.prefix(EPrefixError);
infoSink.info << "Function recursion detected";
return false; return false;
default: default:
UNREACHABLE(); UNREACHABLE();
......
...@@ -46,7 +46,7 @@ void TDiagnostics::writeInfo(Severity severity, ...@@ -46,7 +46,7 @@ void TDiagnostics::writeInfo(Severity severity,
TInfoSinkBase& sink = mInfoSink.info; TInfoSinkBase& sink = mInfoSink.info;
/* VC++ format: file(linenum) : error #: 'token' : extrainfo */ /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
sink.prefix(prefix); sink.prefix(prefix);
sink.location(EncodeSourceLoc(loc.file, loc.line)); sink.location(loc.file, loc.line);
sink << "'" << token << "' : " << reason << " " << extra << "\n"; sink << "'" << token << "' : " << reason << " " << extra << "\n";
} }
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "compiler/InfoSink.h" #include "compiler/InfoSink.h"
void TInfoSinkBase::prefix(TPrefixType message) { void TInfoSinkBase::prefix(TPrefixType p) {
switch(message) { switch(p) {
case EPrefixNone: case EPrefixNone:
break; break;
case EPrefixWarning: case EPrefixWarning:
...@@ -31,29 +31,24 @@ void TInfoSinkBase::prefix(TPrefixType message) { ...@@ -31,29 +31,24 @@ void TInfoSinkBase::prefix(TPrefixType message) {
} }
} }
void TInfoSinkBase::location(TSourceLoc loc) { void TInfoSinkBase::location(int file, int line) {
int string = 0, line = 0;
DecodeSourceLoc(loc, &string, &line);
TPersistStringStream stream; TPersistStringStream stream;
if (line) if (line)
stream << string << ":" << line; stream << file << ":" << line;
else else
stream << string << ":? "; stream << file << ":? ";
stream << ": "; stream << ": ";
sink.append(stream.str()); sink.append(stream.str());
} }
void TInfoSinkBase::message(TPrefixType message, const char* s) { void TInfoSinkBase::location(const TSourceLoc& loc) {
prefix(message); location(loc.first_file, loc.first_line);
sink.append(s);
sink.append("\n");
} }
void TInfoSinkBase::message(TPrefixType message, const char* s, TSourceLoc loc) { void TInfoSinkBase::message(TPrefixType p, const TSourceLoc& loc, const char* m) {
prefix(message); prefix(p);
location(loc); location(loc);
sink.append(s); sink.append(m);
sink.append("\n"); sink.append("\n");
} }
...@@ -96,10 +96,10 @@ public: ...@@ -96,10 +96,10 @@ public:
const TPersistString& str() const { return sink; } const TPersistString& str() const { return sink; }
const char* c_str() const { return sink.c_str(); } const char* c_str() const { return sink.c_str(); }
void prefix(TPrefixType message); void prefix(TPrefixType p);
void location(TSourceLoc loc); void location(int file, int line);
void message(TPrefixType message, const char* s); void location(const TSourceLoc& loc);
void message(TPrefixType message, const char* s, TSourceLoc loc); void message(TPrefixType p, const TSourceLoc& loc, const char* m);
private: private:
TPersistString sink; TPersistString sink;
......
...@@ -1238,7 +1238,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1238,7 +1238,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
{ {
if (mInsideFunction) if (mInsideFunction)
{ {
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << "{\n"; out << "{\n";
mScopeDepth++; mScopeDepth++;
...@@ -1255,7 +1255,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1255,7 +1255,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
for (TIntermSequence::iterator sit = node->getSequence().begin(); sit != node->getSequence().end(); sit++) for (TIntermSequence::iterator sit = node->getSequence().begin(); sit != node->getSequence().end(); sit++)
{ {
outputLineDirective((*sit)->getLine()); outputLineDirective((*sit)->getLine().first_line);
traverseStatements(*sit); traverseStatements(*sit);
...@@ -1264,7 +1264,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1264,7 +1264,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
if (mInsideFunction) if (mInsideFunction)
{ {
outputLineDirective(node->getEndLine()); outputLineDirective(node->getLine().last_line);
out << "}\n"; out << "}\n";
mScopeDepth--; mScopeDepth--;
...@@ -1741,7 +1741,7 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node) ...@@ -1741,7 +1741,7 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
out << ")\n"; out << ")\n";
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << "{\n"; out << "{\n";
if (node->getTrueBlock()) if (node->getTrueBlock())
...@@ -1749,20 +1749,20 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node) ...@@ -1749,20 +1749,20 @@ bool OutputHLSL::visitSelection(Visit visit, TIntermSelection *node)
traverseStatements(node->getTrueBlock()); traverseStatements(node->getTrueBlock());
} }
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << ";\n}\n"; out << ";\n}\n";
if (node->getFalseBlock()) if (node->getFalseBlock())
{ {
out << "else\n"; out << "else\n";
outputLineDirective(node->getFalseBlock()->getLine()); outputLineDirective(node->getFalseBlock()->getLine().first_line);
out << "{\n"; out << "{\n";
outputLineDirective(node->getFalseBlock()->getLine()); outputLineDirective(node->getFalseBlock()->getLine().first_line);
traverseStatements(node->getFalseBlock()); traverseStatements(node->getFalseBlock());
outputLineDirective(node->getFalseBlock()->getLine()); outputLineDirective(node->getFalseBlock()->getLine().first_line);
out << ";\n}\n"; out << ";\n}\n";
} }
} }
...@@ -1795,7 +1795,7 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node) ...@@ -1795,7 +1795,7 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
{ {
out << "{do\n"; out << "{do\n";
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << "{\n"; out << "{\n";
} }
else else
...@@ -1823,7 +1823,7 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node) ...@@ -1823,7 +1823,7 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
out << ")\n"; out << ")\n";
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << "{\n"; out << "{\n";
} }
...@@ -1832,12 +1832,12 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node) ...@@ -1832,12 +1832,12 @@ bool OutputHLSL::visitLoop(Visit visit, TIntermLoop *node)
traverseStatements(node->getBody()); traverseStatements(node->getBody());
} }
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << ";}\n"; out << ";}\n";
if (node->getType() == ELoopDoWhile) if (node->getType() == ELoopDoWhile)
{ {
outputLineDirective(node->getCondition()->getLine()); outputLineDirective(node->getCondition()->getLine().first_line);
out << "while(\n"; out << "while(\n";
node->getCondition()->traverse(this); node->getCondition()->traverse(this);
...@@ -2109,7 +2109,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node) ...@@ -2109,7 +2109,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
out << increment; out << increment;
out << ")\n"; out << ")\n";
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << "{\n"; out << "{\n";
if (node->getBody()) if (node->getBody())
...@@ -2117,7 +2117,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node) ...@@ -2117,7 +2117,7 @@ bool OutputHLSL::handleExcessiveLoop(TIntermLoop *node)
node->getBody()->traverse(this); node->getBody()->traverse(this);
} }
outputLineDirective(node->getLine()); outputLineDirective(node->getLine().first_line);
out << ";}\n"; out << ";}\n";
if (!firstLoopFragment) if (!firstLoopFragment)
......
...@@ -63,40 +63,40 @@ struct TParseContext { ...@@ -63,40 +63,40 @@ struct TParseContext {
int numErrors() const { return diagnostics.numErrors(); } int numErrors() const { return diagnostics.numErrors(); }
TInfoSink& infoSink() { return diagnostics.infoSink(); } TInfoSink& infoSink() { return diagnostics.infoSink(); }
void error(TSourceLoc loc, const char *reason, const char* token, void error(const TSourceLoc& loc, const char *reason, const char* token,
const char* extraInfo=""); const char* extraInfo="");
void warning(TSourceLoc loc, const char* reason, const char* token, void warning(const TSourceLoc& loc, const char* reason, const char* token,
const char* extraInfo=""); const char* extraInfo="");
void trace(const char* str); void trace(const char* str);
void recover(); void recover();
bool parseVectorFields(const TString&, int vecSize, TVectorFields&, int line); bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc& line);
bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, int line); bool parseMatrixFields(const TString&, int matSize, TMatrixFields&, const TSourceLoc& line);
bool reservedErrorCheck(int line, const TString& identifier); bool reservedErrorCheck(const TSourceLoc& line, const TString& identifier);
void assignError(int line, const char* op, TString left, TString right); void assignError(const TSourceLoc& line, const char* op, TString left, TString right);
void unaryOpError(int line, const char* op, TString operand); void unaryOpError(const TSourceLoc& line, const char* op, TString operand);
void binaryOpError(int line, const char* op, TString left, TString right); void binaryOpError(const TSourceLoc& line, const char* op, TString left, TString right);
bool precisionErrorCheck(int line, TPrecision precision, TBasicType type); bool precisionErrorCheck(const TSourceLoc& line, TPrecision precision, TBasicType type);
bool lValueErrorCheck(int line, const char* op, TIntermTyped*); bool lValueErrorCheck(const TSourceLoc& line, const char* op, TIntermTyped*);
bool constErrorCheck(TIntermTyped* node); bool constErrorCheck(TIntermTyped* node);
bool integerErrorCheck(TIntermTyped* node, const char* token); bool integerErrorCheck(TIntermTyped* node, const char* token);
bool globalErrorCheck(int line, bool global, const char* token); bool globalErrorCheck(const TSourceLoc& line, bool global, const char* token);
bool constructorErrorCheck(int line, TIntermNode*, TFunction&, TOperator, TType*); bool constructorErrorCheck(const TSourceLoc& line, TIntermNode*, TFunction&, TOperator, TType*);
bool arraySizeErrorCheck(int line, TIntermTyped* expr, int& size); bool arraySizeErrorCheck(const TSourceLoc& line, TIntermTyped* expr, int& size);
bool arrayQualifierErrorCheck(int line, TPublicType type); bool arrayQualifierErrorCheck(const TSourceLoc& line, TPublicType type);
bool arrayTypeErrorCheck(int line, TPublicType type); bool arrayTypeErrorCheck(const TSourceLoc& line, TPublicType type);
bool arrayErrorCheck(int line, TString& identifier, TPublicType type, TVariable*& variable); bool arrayErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType type, TVariable*& variable);
bool voidErrorCheck(int, const TString&, const TPublicType&); bool voidErrorCheck(const TSourceLoc&, const TString&, const TPublicType&);
bool boolErrorCheck(int, const TIntermTyped*); bool boolErrorCheck(const TSourceLoc&, const TIntermTyped*);
bool boolErrorCheck(int, const TPublicType&); bool boolErrorCheck(const TSourceLoc&, const TPublicType&);
bool samplerErrorCheck(int line, const TPublicType& pType, const char* reason); bool samplerErrorCheck(const TSourceLoc& line, const TPublicType& pType, const char* reason);
bool structQualifierErrorCheck(int line, const TPublicType& pType); bool structQualifierErrorCheck(const TSourceLoc& line, const TPublicType& pType);
bool parameterSamplerErrorCheck(int line, TQualifier qualifier, const TType& type); bool parameterSamplerErrorCheck(const TSourceLoc& line, TQualifier qualifier, const TType& type);
bool nonInitConstErrorCheck(int line, TString& identifier, TPublicType& type, bool array); bool nonInitConstErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, bool array);
bool nonInitErrorCheck(int line, TString& identifier, TPublicType& type, TVariable*& variable); bool nonInitErrorCheck(const TSourceLoc& line, TString& identifier, TPublicType& type, TVariable*& variable);
bool paramErrorCheck(int line, TQualifier qualifier, TQualifier paramQualifier, TType* type); bool paramErrorCheck(const TSourceLoc& line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
bool extensionErrorCheck(int line, const TString&); bool extensionErrorCheck(const TSourceLoc& line, const TString&);
const TPragma& pragma() const { return directiveHandler.pragma(); } const TPragma& pragma() const { return directiveHandler.pragma(); }
const TExtensionBehavior& extensionBehavior() const { return directiveHandler.extensionBehavior(); } const TExtensionBehavior& extensionBehavior() const { return directiveHandler.extensionBehavior(); }
...@@ -104,27 +104,27 @@ struct TParseContext { ...@@ -104,27 +104,27 @@ struct TParseContext {
bool containsSampler(TType& type); bool containsSampler(TType& type);
bool areAllChildConst(TIntermAggregate* aggrNode); bool areAllChildConst(TIntermAggregate* aggrNode);
const TFunction* findFunction(int line, TFunction* pfnCall, bool *builtIn = 0); const TFunction* findFunction(const TSourceLoc& line, TFunction* pfnCall, bool *builtIn = 0);
bool executeInitializer(TSourceLoc line, TString& identifier, TPublicType& pType, bool executeInitializer(const TSourceLoc& line, TString& identifier, TPublicType& pType,
TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0); TIntermTyped* initializer, TIntermNode*& intermNode, TVariable* variable = 0);
bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, TSourceLoc); bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, const TSourceLoc&);
TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, TSourceLoc); TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, const TSourceLoc&);
TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type); TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
TIntermTyped* constructStruct(TIntermNode*, TType*, int, TSourceLoc, bool subset); TIntermTyped* constructStruct(TIntermNode*, TType*, int, const TSourceLoc&, bool subset);
TIntermTyped* constructBuiltIn(const TType*, TOperator, TIntermNode*, TSourceLoc, bool subset); TIntermTyped* constructBuiltIn(const TType*, TOperator, TIntermNode*, const TSourceLoc&, bool subset);
TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, TSourceLoc); TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, const TSourceLoc&);
TIntermTyped* addConstMatrixNode(int , TIntermTyped*, TSourceLoc); TIntermTyped* addConstMatrixNode(int , TIntermTyped*, const TSourceLoc&);
TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, TSourceLoc line); TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc& line);
TIntermTyped* addConstStruct(TString& , TIntermTyped*, TSourceLoc); TIntermTyped* addConstStruct(TString& , TIntermTyped*, const TSourceLoc&);
// 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 // Returns true if an error was raised due to the declaration of
// this struct. // this struct.
bool enterStructDeclaration(TSourceLoc line, const TString& identifier); bool enterStructDeclaration(const TSourceLoc& line, const TString& identifier);
void exitStructDeclaration(); void exitStructDeclaration();
bool structNestingErrorCheck(TSourceLoc line, const TType& fieldType); bool structNestingErrorCheck(const TSourceLoc& line, const TType& fieldType);
}; };
int PaParseStrings(size_t count, const char* const string[], const int length[], int PaParseStrings(size_t count, const char* const string[], const int length[],
......
...@@ -214,9 +214,9 @@ struct TPublicType ...@@ -214,9 +214,9 @@ struct TPublicType
bool array; bool array;
int arraySize; int arraySize;
TType* userDef; TType* userDef;
int line; TSourceLoc line;
void setBasic(TBasicType bt, TQualifier q, int ln = 0) void setBasic(TBasicType bt, TQualifier q, const TSourceLoc& ln)
{ {
type = bt; type = bt;
qualifier = q; qualifier = q;
......
...@@ -47,7 +47,10 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). ...@@ -47,7 +47,10 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
#pragma warning(disable : 4102) #pragma warning(disable : 4102)
#endif #endif
#define YY_USER_ACTION yylval->lex.line = yylineno; #define YY_USER_ACTION \
yylloc->first_file = yylloc->last_file = yycolumn; \
yylloc->first_line = yylloc->last_line = yylineno;
#define YY_INPUT(buf, result, max_size) \ #define YY_INPUT(buf, result, max_size) \
result = string_input(buf, max_size, yyscanner); result = string_input(buf, max_size, yyscanner);
...@@ -57,7 +60,7 @@ static int reserved_word(yyscan_t yyscanner); ...@@ -57,7 +60,7 @@ static int reserved_word(yyscan_t yyscanner);
%} %}
%option noyywrap nounput never-interactive %option noyywrap nounput never-interactive
%option yylineno reentrant bison-bridge %option yylineno reentrant bison-bridge bison-locations
%option extra-type="TParseContext*" %option extra-type="TParseContext*"
D [0-9] D [0-9]
...@@ -253,7 +256,8 @@ yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) { ...@@ -253,7 +256,8 @@ yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size(); yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
if (len < max_size) if (len < max_size)
memcpy(buf, token.text.c_str(), len); memcpy(buf, token.text.c_str(), len);
yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line), yyscanner); yyset_column(token.location.file, yyscanner);
yyset_lineno(token.location.line, yyscanner);
if (len >= max_size) if (len >= max_size)
YY_FATAL_ERROR("Input buffer overflow"); YY_FATAL_ERROR("Input buffer overflow");
...@@ -279,18 +283,11 @@ int check_type(yyscan_t yyscanner) { ...@@ -279,18 +283,11 @@ int check_type(yyscan_t yyscanner) {
int reserved_word(yyscan_t yyscanner) { int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
yyextra->error(yylineno, "Illegal use of reserved word", yytext, ""); yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->recover(); yyextra->recover();
return 0; return 0;
} }
void yyerror(TParseContext* context, const char* reason) {
struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
context->error(yylineno, reason, yytext);
context->recover();
}
int glslang_initialize(TParseContext* context) { int glslang_initialize(TParseContext* context) {
yyscan_t scanner = NULL; yyscan_t scanner = NULL;
if (yylex_init_extra(context, &scanner)) if (yylex_init_extra(context, &scanner))
...@@ -313,7 +310,8 @@ int glslang_finalize(TParseContext* context) { ...@@ -313,7 +310,8 @@ int glslang_finalize(TParseContext* context) {
int glslang_scan(size_t count, const char* const string[], const int length[], int glslang_scan(size_t count, const char* const string[], const int length[],
TParseContext* context) { TParseContext* context) {
yyrestart(NULL, context->scanner); yyrestart(NULL, context->scanner);
yyset_lineno(EncodeSourceLoc(0, 1), context->scanner); yyset_column(0, context->scanner);
yyset_lineno(1, context->scanner);
// Initialize preprocessor. // Initialize preprocessor.
if (!context->preprocessor.init(count, string, length)) if (!context->preprocessor.init(count, string, length))
......
...@@ -792,7 +792,10 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). ...@@ -792,7 +792,10 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
#pragma warning(disable : 4102) #pragma warning(disable : 4102)
#endif #endif
#define YY_USER_ACTION yylval->lex.line = yylineno; #define YY_USER_ACTION \
yylloc->first_file = yylloc->last_file = yycolumn; \
yylloc->first_line = yylloc->last_line = yylineno;
#define YY_INPUT(buf, result, max_size) \ #define YY_INPUT(buf, result, max_size) \
result = string_input(buf, max_size, yyscanner); result = string_input(buf, max_size, yyscanner);
...@@ -838,6 +841,8 @@ struct yyguts_t ...@@ -838,6 +841,8 @@ struct yyguts_t
YYSTYPE * yylval_r; YYSTYPE * yylval_r;
YYLTYPE * yylloc_r;
}; /* end struct yyguts_t */ }; /* end struct yyguts_t */
static int yy_init_globals (yyscan_t yyscanner ); static int yy_init_globals (yyscan_t yyscanner );
...@@ -846,6 +851,8 @@ static int yy_init_globals (yyscan_t yyscanner ); ...@@ -846,6 +851,8 @@ static int yy_init_globals (yyscan_t yyscanner );
* from bison output in section 1.*/ * from bison output in section 1.*/
# define yylval yyg->yylval_r # define yylval yyg->yylval_r
# define yylloc yyg->yylloc_r
int yylex_init (yyscan_t* scanner); int yylex_init (yyscan_t* scanner);
int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
...@@ -883,6 +890,10 @@ YYSTYPE * yyget_lval (yyscan_t yyscanner ); ...@@ -883,6 +890,10 @@ YYSTYPE * yyget_lval (yyscan_t yyscanner );
void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
YYLTYPE *yyget_lloc (yyscan_t yyscanner );
void yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in /* Macros after this point can all be overridden by user definitions in
* section 1. * section 1.
*/ */
...@@ -989,10 +1000,10 @@ static int input (yyscan_t yyscanner ); ...@@ -989,10 +1000,10 @@ static int input (yyscan_t yyscanner );
#define YY_DECL_IS_OURS 1 #define YY_DECL_IS_OURS 1
extern int yylex \ extern int yylex \
(YYSTYPE * yylval_param ,yyscan_t yyscanner); (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
#define YY_DECL int yylex \ #define YY_DECL int yylex \
(YYSTYPE * yylval_param , yyscan_t yyscanner) (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
#endif /* !YY_DECL */ #endif /* !YY_DECL */
/* Code executed at the beginning of each rule, after yytext and yyleng /* Code executed at the beginning of each rule, after yytext and yyleng
...@@ -1021,6 +1032,8 @@ YY_DECL ...@@ -1021,6 +1032,8 @@ YY_DECL
yylval = yylval_param; yylval = yylval_param;
yylloc = yylloc_param;
if ( !yyg->yy_init ) if ( !yyg->yy_init )
{ {
yyg->yy_init = 1; yyg->yy_init = 1;
...@@ -2659,6 +2672,18 @@ void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) ...@@ -2659,6 +2672,18 @@ void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
yylval = yylval_param; yylval = yylval_param;
} }
YYLTYPE *yyget_lloc (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yylloc;
}
void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylloc = yylloc_param;
}
/* User-visible API */ /* User-visible API */
/* yylex_init is special because it creates the scanner itself, so it is /* yylex_init is special because it creates the scanner itself, so it is
...@@ -2840,7 +2865,8 @@ yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) { ...@@ -2840,7 +2865,8 @@ yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size(); yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
if (len < max_size) if (len < max_size)
memcpy(buf, token.text.c_str(), len); memcpy(buf, token.text.c_str(), len);
yyset_lineno(EncodeSourceLoc(token.location.file, token.location.line),yyscanner); yyset_column(token.location.file,yyscanner);
yyset_lineno(token.location.line,yyscanner);
if (len >= max_size) if (len >= max_size)
YY_FATAL_ERROR("Input buffer overflow"); YY_FATAL_ERROR("Input buffer overflow");
...@@ -2866,18 +2892,11 @@ int check_type(yyscan_t yyscanner) { ...@@ -2866,18 +2892,11 @@ int check_type(yyscan_t yyscanner) {
int reserved_word(yyscan_t yyscanner) { int reserved_word(yyscan_t yyscanner) {
struct yyguts_t* yyg = (struct yyguts_t*) yyscanner; struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
yyextra->error(yylineno, "Illegal use of reserved word", yytext, ""); yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
yyextra->recover(); yyextra->recover();
return 0; return 0;
} }
void yyerror(TParseContext* context, const char* reason) {
struct yyguts_t* yyg = (struct yyguts_t*) context->scanner;
context->error(yylineno, reason, yytext);
context->recover();
}
int glslang_initialize(TParseContext* context) { int glslang_initialize(TParseContext* context) {
yyscan_t scanner = NULL; yyscan_t scanner = NULL;
if (yylex_init_extra(context,&scanner)) if (yylex_init_extra(context,&scanner))
...@@ -2900,7 +2919,8 @@ int glslang_finalize(TParseContext* context) { ...@@ -2900,7 +2919,8 @@ int glslang_finalize(TParseContext* context) {
int glslang_scan(size_t count, const char* const string[], const int length[], int glslang_scan(size_t count, const char* const string[], const int length[],
TParseContext* context) { TParseContext* context) {
yyrestart(NULL,context->scanner); yyrestart(NULL,context->scanner);
yyset_lineno(EncodeSourceLoc(0, 1),context->scanner); yyset_column(0,context->scanner);
yyset_lineno(1,context->scanner);
// Initialize preprocessor. // Initialize preprocessor.
if (!context->preprocessor.init(count, string, length)) if (!context->preprocessor.init(count, string, length))
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -31,6 +31,14 @@ ...@@ -31,6 +31,14 @@
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
/* "%code requires" blocks. */
#define YYLTYPE TSourceLoc
#define YYLTYPE_IS_DECLARED 1
/* Tokens. */ /* Tokens. */
#ifndef YYTOKENTYPE #ifndef YYTOKENTYPE
...@@ -141,7 +149,6 @@ typedef union YYSTYPE ...@@ -141,7 +149,6 @@ typedef union YYSTYPE
struct { struct {
TSourceLoc line;
union { union {
TString *string; TString *string;
float f; float f;
...@@ -151,7 +158,6 @@ typedef union YYSTYPE ...@@ -151,7 +158,6 @@ typedef union YYSTYPE
TSymbol* symbol; TSymbol* symbol;
} lex; } lex;
struct { struct {
TSourceLoc line;
TOperator op; TOperator op;
union { union {
TIntermNode* intermNode; TIntermNode* intermNode;
...@@ -180,4 +186,18 @@ typedef union YYSTYPE ...@@ -180,4 +186,18 @@ typedef union YYSTYPE
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
typedef struct YYLTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
} YYLTYPE;
# define yyltype YYLTYPE /* obsolescent; will be withdrawn */
# define YYLTYPE_IS_DECLARED 1
# define YYLTYPE_IS_TRIVIAL 1
#endif
...@@ -189,7 +189,9 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node) ...@@ -189,7 +189,9 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
case EOpAny: out << "any"; break; case EOpAny: out << "any"; break;
case EOpAll: out << "all"; break; case EOpAll: out << "all"; break;
default: out.message(EPrefixError, "Bad unary op"); default:
out.prefix(EPrefixError);
out << "Bad unary op";
} }
out << " (" << node->getCompleteString() << ")"; out << " (" << node->getCompleteString() << ")";
...@@ -204,7 +206,8 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node) ...@@ -204,7 +206,8 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
TInfoSinkBase& out = sink; TInfoSinkBase& out = sink;
if (node->getOp() == EOpNull) { if (node->getOp() == EOpNull) {
out.message(EPrefixError, "node is still EOpNull!"); out.prefix(EPrefixError);
out << "node is still EOpNull!";
return true; return true;
} }
...@@ -263,7 +266,9 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node) ...@@ -263,7 +266,9 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
case EOpDeclaration: out << "Declaration: "; break; case EOpDeclaration: out << "Declaration: "; break;
default: out.message(EPrefixError, "Bad aggregation op"); default:
out.prefix(EPrefixError);
out << "Bad aggregation op";
} }
if (node->getOp() != EOpSequence && node->getOp() != EOpParameters) if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
...@@ -334,7 +339,7 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node) ...@@ -334,7 +339,7 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
out << " (const int)\n"; out << " (const int)\n";
break; break;
default: default:
out.message(EPrefixInternalError, "Unknown constant", node->getLine()); out.message(EPrefixInternalError, node->getLine(), "Unknown constant");
break; break;
} }
} }
......
...@@ -206,10 +206,16 @@ class TIntermNode { ...@@ -206,10 +206,16 @@ class TIntermNode {
public: public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
TIntermNode() : line(0) {} TIntermNode() {
// TODO: Move this to TSourceLoc constructor
// after getting rid of TPublicType.
line.first_file = line.last_file = 0;
line.first_line = line.last_line = 0;
}
virtual ~TIntermNode() { }
TSourceLoc getLine() const { return line; } const TSourceLoc& getLine() const { return line; }
void setLine(TSourceLoc l) { line = l; } void setLine(const TSourceLoc& l) { line = l; }
virtual void traverse(TIntermTraverser*) = 0; virtual void traverse(TIntermTraverser*) = 0;
virtual TIntermTyped* getAsTyped() { return 0; } virtual TIntermTyped* getAsTyped() { return 0; }
...@@ -220,7 +226,6 @@ public: ...@@ -220,7 +226,6 @@ public:
virtual TIntermSelection* getAsSelectionNode() { return 0; } virtual TIntermSelection* getAsSelectionNode() { return 0; }
virtual TIntermSymbol* getAsSymbolNode() { return 0; } virtual TIntermSymbol* getAsSymbolNode() { return 0; }
virtual TIntermLoop* getAsLoopNode() { return 0; } virtual TIntermLoop* getAsLoopNode() { return 0; }
virtual ~TIntermNode() { }
protected: protected:
TSourceLoc line; TSourceLoc line;
...@@ -450,7 +455,7 @@ typedef TVector<int> TQualifierList; ...@@ -450,7 +455,7 @@ typedef TVector<int> TQualifierList;
// //
class TIntermAggregate : public TIntermOperator { class TIntermAggregate : public TIntermOperator {
public: public:
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), endLine(0), useEmulatedFunction(false) { } TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), useEmulatedFunction(false) { }
TIntermAggregate(TOperator o) : TIntermOperator(o), useEmulatedFunction(false) { } TIntermAggregate(TOperator o) : TIntermOperator(o), useEmulatedFunction(false) { }
~TIntermAggregate() { } ~TIntermAggregate() { }
...@@ -470,9 +475,6 @@ public: ...@@ -470,9 +475,6 @@ public:
void setDebug(bool d) { debug = d; } void setDebug(bool d) { debug = d; }
bool getDebug() { return debug; } bool getDebug() { return debug; }
void setEndLine(TSourceLoc line) { endLine = line; }
TSourceLoc getEndLine() const { return endLine; }
void setUseEmulatedFunction() { useEmulatedFunction = true; } void setUseEmulatedFunction() { useEmulatedFunction = true; }
bool getUseEmulatedFunction() { return useEmulatedFunction; } bool getUseEmulatedFunction() { return useEmulatedFunction; }
...@@ -485,7 +487,6 @@ protected: ...@@ -485,7 +487,6 @@ protected:
bool optimize; bool optimize;
bool debug; bool debug;
TSourceLoc endLine;
// If set to true, replace the built-in function call with an emulated one // If set to true, replace the built-in function call with an emulated one
// to work around driver bugs. // to work around driver bugs.
......
...@@ -25,34 +25,33 @@ public: ...@@ -25,34 +25,33 @@ public:
POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator) POOL_ALLOCATOR_NEW_DELETE(GlobalPoolAllocator)
TIntermediate(TInfoSink& i) : infoSink(i) { } TIntermediate(TInfoSink& i) : infoSink(i) { }
TIntermSymbol* addSymbol(int Id, const TString&, const TType&, TSourceLoc); TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TSourceLoc&);
TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*); TIntermTyped* addConversion(TOperator, const TType&, TIntermTyped*);
TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc, TSymbolTable&); TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&, TSymbolTable&);
TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc); TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc); TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&);
TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, TSourceLoc, TSymbolTable&); TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&, TSymbolTable&);
TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc); TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&);
TIntermAggregate* makeAggregate(TIntermNode* node, TSourceLoc); TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&);
TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, TSourceLoc); TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, const TSourceLoc&);
TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, TSourceLoc); TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&);
TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc); TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&);
TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc); TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, TSourceLoc); TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&);
TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ; TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*) ;
bool parseConstTree(TSourceLoc, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false); bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TSymbolTable&, TType, bool singleConstantParam = false);
TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, TSourceLoc); TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, TSourceLoc); TIntermBranch* addBranch(TOperator, const TSourceLoc&);
TIntermBranch* addBranch(TOperator, TIntermTyped*, TSourceLoc); TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
TIntermTyped* addSwizzle(TVectorFields&, TSourceLoc); TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&);
bool postProcess(TIntermNode*); bool postProcess(TIntermNode*);
void remove(TIntermNode*); void remove(TIntermNode*);
void outputTree(TIntermNode*); void outputTree(TIntermNode*);
protected:
TInfoSink& infoSink;
private: private:
void operator=(TIntermediate&); // prevent assignments void operator=(TIntermediate&); // prevent assignments
TInfoSink& infoSink;
}; };
#endif // _LOCAL_INTERMEDIATE_INCLUDED_ #endif // _LOCAL_INTERMEDIATE_INCLUDED_
...@@ -61,7 +61,7 @@ protected: ...@@ -61,7 +61,7 @@ protected:
void TConstTraverser::visitSymbol(TIntermSymbol* node) void TConstTraverser::visitSymbol(TIntermSymbol* node)
{ {
infoSink.info.message(EPrefixInternalError, "Symbol Node found in constant constructor", node->getLine()); infoSink.info.message(EPrefixInternalError, node->getLine(), "Symbol Node found in constant constructor");
return; return;
} }
...@@ -74,12 +74,12 @@ bool TConstTraverser::visitBinary(Visit visit, TIntermBinary* node) ...@@ -74,12 +74,12 @@ bool TConstTraverser::visitBinary(Visit visit, TIntermBinary* node)
TString buf; TString buf;
buf.append("'constructor' : assigning non-constant to "); buf.append("'constructor' : assigning non-constant to ");
buf.append(type.getCompleteString()); buf.append(type.getCompleteString());
infoSink.info.message(EPrefixError, buf.c_str(), node->getLine()); infoSink.info.message(EPrefixError, node->getLine(), buf.c_str());
error = true; error = true;
return false; return false;
} }
infoSink.info.message(EPrefixInternalError, "Binary Node found in constant constructor", node->getLine()); infoSink.info.message(EPrefixInternalError, node->getLine(), "Binary Node found in constant constructor");
return false; return false;
} }
...@@ -89,7 +89,7 @@ bool TConstTraverser::visitUnary(Visit visit, TIntermUnary* node) ...@@ -89,7 +89,7 @@ bool TConstTraverser::visitUnary(Visit visit, TIntermUnary* node)
TString buf; TString buf;
buf.append("'constructor' : assigning non-constant to "); buf.append("'constructor' : assigning non-constant to ");
buf.append(type.getCompleteString()); buf.append(type.getCompleteString());
infoSink.info.message(EPrefixError, buf.c_str(), node->getLine()); infoSink.info.message(EPrefixError, node->getLine(), buf.c_str());
error = true; error = true;
return false; return false;
} }
...@@ -100,7 +100,7 @@ bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node) ...@@ -100,7 +100,7 @@ bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
TString buf; TString buf;
buf.append("'constructor' : assigning non-constant to "); buf.append("'constructor' : assigning non-constant to ");
buf.append(type.getCompleteString()); buf.append(type.getCompleteString());
infoSink.info.message(EPrefixError, buf.c_str(), node->getLine()); infoSink.info.message(EPrefixError, node->getLine(), buf.c_str());
error = true; error = true;
return false; return false;
} }
...@@ -144,7 +144,7 @@ bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node) ...@@ -144,7 +144,7 @@ bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node) bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
{ {
infoSink.info.message(EPrefixInternalError, "Selection Node found in constant constructor", node->getLine()); infoSink.info.message(EPrefixInternalError, node->getLine(), "Selection Node found in constant constructor");
error = true; error = true;
return false; return false;
} }
...@@ -213,14 +213,14 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node) ...@@ -213,14 +213,14 @@ void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
bool TConstTraverser::visitLoop(Visit visit, TIntermLoop* node) bool TConstTraverser::visitLoop(Visit visit, TIntermLoop* node)
{ {
infoSink.info.message(EPrefixInternalError, "Loop Node found in constant constructor", node->getLine()); infoSink.info.message(EPrefixInternalError, node->getLine(), "Loop Node found in constant constructor");
error = true; error = true;
return false; return false;
} }
bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node) bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
{ {
infoSink.info.message(EPrefixInternalError, "Branch Node found in constant constructor", node->getLine()); infoSink.info.message(EPrefixInternalError, node->getLine(), "Branch Node found in constant constructor");
error = true; error = true;
return false; return false;
} }
...@@ -230,7 +230,7 @@ bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node) ...@@ -230,7 +230,7 @@ bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
// Individual functions can be initialized to 0 to skip processing of that // Individual functions can be initialized to 0 to skip processing of that
// type of node. It's children will still be processed. // type of node. It's children will still be processed.
// //
bool TIntermediate::parseConstTree(TSourceLoc line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam) bool TIntermediate::parseConstTree(const TSourceLoc& line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TSymbolTable& symbolTable, TType t, bool singleConstantParam)
{ {
if (root == 0) if (root == 0)
return false; return false;
......
...@@ -10,8 +10,8 @@ void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node) ...@@ -10,8 +10,8 @@ void RestrictVertexShaderTiming::visitSymbol(TIntermSymbol* node)
{ {
if (IsSampler(node->getBasicType())) { if (IsSampler(node->getBasicType())) {
++mNumErrors; ++mNumErrors;
mSink.prefix(EPrefixError); mSink.message(EPrefixError,
mSink.location(node->getLine()); node->getLine(),
mSink << "Samplers are not permitted in vertex shaders.\n"; "Samplers are not permitted in vertex shaders");
} }
} }
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