Commit 253fdd10 by Alexis Hetu Committed by Alexis Hétu

Completed conversion of TSourceLoc into a struct

TSourceLoc was defined as an int, but is meant to be used as a struct to carry all the information provided by the parser, so the conversion was made in this cl. Change-Id: I6015d11aafda96914ec7b2c37883ffbc963a08fe Reviewed-on: https://swiftshader-review.googlesource.com/3664Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 76079bcf
...@@ -14,24 +14,12 @@ ...@@ -14,24 +14,12 @@
#include "PoolAlloc.h" #include "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.
......
...@@ -52,7 +52,10 @@ void TDiagnostics::writeInfo(Severity severity, ...@@ -52,7 +52,10 @@ 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)); TSourceLoc sourceLoc;
sourceLoc.first_file = sourceLoc.last_file = loc.file;
sourceLoc.first_line = sourceLoc.last_line = loc.line;
sink.location(sourceLoc);
sink << "'" << token << "' : " << reason << " " << extra << "\n"; sink << "'" << token << "' : " << reason << " " << extra << "\n";
} }
......
...@@ -31,9 +31,8 @@ void TInfoSinkBase::prefix(TPrefixType message) { ...@@ -31,9 +31,8 @@ void TInfoSinkBase::prefix(TPrefixType message) {
} }
} }
void TInfoSinkBase::location(TSourceLoc loc) { void TInfoSinkBase::location(const TSourceLoc& loc) {
int string = 0, line = 0; int string = loc.first_file, line = loc.first_line;
DecodeSourceLoc(loc, &string, &line);
TPersistStringStream stream; TPersistStringStream stream;
if (line) if (line)
......
...@@ -97,7 +97,7 @@ public: ...@@ -97,7 +97,7 @@ public:
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 message);
void location(TSourceLoc loc); void location(const TSourceLoc& loc);
void message(TPrefixType message, const char* s); void message(TPrefixType message, const char* s);
void message(TPrefixType message, const char* s, TSourceLoc loc); void message(TPrefixType message, const char* s, TSourceLoc loc);
......
...@@ -400,9 +400,10 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS ...@@ -400,9 +400,10 @@ void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TS
// Depth range in window coordinates // Depth range in window coordinates
// //
TFieldList *fields = NewPoolTFieldList(); TFieldList *fields = NewPoolTFieldList();
TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"), 0); TSourceLoc zeroSourceLoc = { 0, 0, 0, 0 };
TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"), 0); TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"), zeroSourceLoc);
TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"), 0); TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"), zeroSourceLoc);
TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"), zeroSourceLoc);
fields->push_back(near); fields->push_back(near);
fields->push_back(far); fields->push_back(far);
fields->push_back(diff); fields->push_back(diff);
......
...@@ -177,7 +177,7 @@ const char* getOperatorString(TOperator op) { ...@@ -177,7 +177,7 @@ const char* getOperatorString(TOperator op) {
// //
// Returns the added node. // Returns the added node.
// //
TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, TSourceLoc line) TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, const TSourceLoc &line)
{ {
TIntermSymbol* node = new TIntermSymbol(id, name, type); TIntermSymbol* node = new TIntermSymbol(id, name, type);
node->setLine(line); node->setLine(line);
...@@ -190,7 +190,7 @@ TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType ...@@ -190,7 +190,7 @@ TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType
// //
// Returns the added node. // Returns the added node.
// //
TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line) TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc &line)
{ {
switch (op) { switch (op) {
case EOpEqual: case EOpEqual:
...@@ -247,8 +247,6 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn ...@@ -247,8 +247,6 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
// one and promote it to the right type. // one and promote it to the right type.
// //
TIntermBinary* node = new TIntermBinary(op); TIntermBinary* node = new TIntermBinary(op);
if (line == 0)
line = right->getLine();
node->setLine(line); node->setLine(line);
node->setLeft(left); node->setLeft(left);
...@@ -276,7 +274,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn ...@@ -276,7 +274,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
// //
// Returns the added node. // Returns the added node.
// //
TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line) TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc &line)
{ {
if (left->getType().getStruct() || right->getType().getStruct()) if (left->getType().getStruct() || right->getType().getStruct())
{ {
...@@ -287,8 +285,6 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm ...@@ -287,8 +285,6 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
} }
TIntermBinary* node = new TIntermBinary(op); TIntermBinary* node = new TIntermBinary(op);
if(line == 0)
line = left->getLine();
node->setLine(line); node->setLine(line);
node->setLeft(left); node->setLeft(left);
...@@ -306,11 +302,9 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm ...@@ -306,11 +302,9 @@ TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TInterm
// Returns the added node. // Returns the added node.
// The caller should set the type of the returned node. // The caller should set the type of the returned node.
// //
TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, TSourceLoc line) TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc &line)
{ {
TIntermBinary* node = new TIntermBinary(op); TIntermBinary* node = new TIntermBinary(op);
if (line == 0)
line = index->getLine();
node->setLine(line); node->setLine(line);
node->setLeft(base); node->setLeft(base);
node->setRight(index); node->setRight(index);
...@@ -325,7 +319,7 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT ...@@ -325,7 +319,7 @@ TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermT
// //
// Returns the added node. // Returns the added node.
// //
TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, TSourceLoc line) TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, const TSourceLoc &line)
{ {
TIntermUnary* node; TIntermUnary* node;
TIntermTyped* child = childNode->getAsTyped(); TIntermTyped* child = childNode->getAsTyped();
...@@ -366,8 +360,6 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, ...@@ -366,8 +360,6 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
// Make a new node for the operator. // Make a new node for the operator.
// //
node = new TIntermUnary(op); node = new TIntermUnary(op);
if (line == 0)
line = child->getLine();
node->setLine(line); node->setLine(line);
node->setOperand(child); node->setOperand(child);
...@@ -394,7 +386,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode, ...@@ -394,7 +386,7 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermNode* childNode,
// Returns an aggregate node, which could be the one passed in if // Returns an aggregate node, which could be the one passed in if
// it was already an aggregate but no operator was set. // it was already an aggregate but no operator was set.
// //
TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, TSourceLoc line) TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, const TSourceLoc &line)
{ {
TIntermAggregate* aggNode; TIntermAggregate* aggNode;
...@@ -409,8 +401,6 @@ TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperat ...@@ -409,8 +401,6 @@ TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperat
// //
aggNode = new TIntermAggregate(); aggNode = new TIntermAggregate();
aggNode->getSequence().push_back(node); aggNode->getSequence().push_back(node);
if (line == 0)
line = node->getLine();
} }
} else } else
aggNode = new TIntermAggregate(); aggNode = new TIntermAggregate();
...@@ -419,8 +409,6 @@ TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperat ...@@ -419,8 +409,6 @@ TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperat
// Set the operator. // Set the operator.
// //
aggNode->setOp(op); aggNode->setOp(op);
if (line != 0)
aggNode->setLine(line);
return aggNode; return aggNode;
} }
...@@ -432,7 +420,7 @@ TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperat ...@@ -432,7 +420,7 @@ TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperat
// Returns the resulting aggregate, unless 0 was passed in for // Returns the resulting aggregate, unless 0 was passed in for
// both existing nodes. // both existing nodes.
// //
TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, TSourceLoc line) TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc &line)
{ {
if (left == 0 && right == 0) if (left == 0 && right == 0)
return 0; return 0;
...@@ -449,7 +437,6 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r ...@@ -449,7 +437,6 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r
if (right) if (right)
aggNode->getSequence().push_back(right); aggNode->getSequence().push_back(right);
if (line != 0)
aggNode->setLine(line); aggNode->setLine(line);
return aggNode; return aggNode;
...@@ -460,7 +447,7 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r ...@@ -460,7 +447,7 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r
// //
// Returns an aggregate, unless 0 was passed in for the existing node. // Returns an aggregate, unless 0 was passed in for the existing node.
// //
TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc line) TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc &line)
{ {
if (node == 0) if (node == 0)
return 0; return 0;
...@@ -468,10 +455,7 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc lin ...@@ -468,10 +455,7 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc lin
TIntermAggregate* aggNode = new TIntermAggregate; TIntermAggregate* aggNode = new TIntermAggregate;
aggNode->getSequence().push_back(node); aggNode->getSequence().push_back(node);
if (line != 0)
aggNode->setLine(line); aggNode->setLine(line);
else
aggNode->setLine(node->getLine());
return aggNode; return aggNode;
} }
...@@ -483,7 +467,7 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc lin ...@@ -483,7 +467,7 @@ TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, TSourceLoc lin
// //
// Returns the selection node created. // Returns the selection node created.
// //
TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, TSourceLoc line) TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc &line)
{ {
// //
// For compile time constant selections, prune the code and // For compile time constant selections, prune the code and
...@@ -504,7 +488,7 @@ TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nod ...@@ -504,7 +488,7 @@ TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nod
} }
TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, TSourceLoc line) TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc &line)
{ {
if (left->getType().getQualifier() == EvqConstExpr && right->getType().getQualifier() == EvqConstExpr) { if (left->getType().getQualifier() == EvqConstExpr && right->getType().getQualifier() == EvqConstExpr) {
return right; return right;
...@@ -524,7 +508,7 @@ TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, T ...@@ -524,7 +508,7 @@ TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, T
// //
// Returns the selection node created, or 0 if one could not be. // Returns the selection node created, or 0 if one could not be.
// //
TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, TSourceLoc line) TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc &line)
{ {
if (trueBlock->getType() != falseBlock->getType()) if (trueBlock->getType() != falseBlock->getType())
{ {
...@@ -574,7 +558,7 @@ TIntermCase *TIntermediate::addCase(TIntermTyped *condition, const TSourceLoc &l ...@@ -574,7 +558,7 @@ TIntermCase *TIntermediate::addCase(TIntermTyped *condition, const TSourceLoc &l
// Returns the constant union node created. // Returns the constant union node created.
// //
TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType& t, TSourceLoc line) TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType& t, const TSourceLoc &line)
{ {
TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t); TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t);
node->setLine(line); node->setLine(line);
...@@ -582,7 +566,7 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayP ...@@ -582,7 +566,7 @@ TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayP
return node; return node;
} }
TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line) TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, const TSourceLoc &line)
{ {
TIntermAggregate* node = new TIntermAggregate(EOpSequence); TIntermAggregate* node = new TIntermAggregate(EOpSequence);
...@@ -605,7 +589,7 @@ TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line) ...@@ -605,7 +589,7 @@ TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, TSourceLoc line)
// //
// Create loop nodes. // Create loop nodes.
// //
TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTyped* cond, TIntermTyped* expr, TIntermNode* body, TSourceLoc line) TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTyped* cond, TIntermTyped* expr, TIntermNode* body, const TSourceLoc &line)
{ {
TIntermNode* node = new TIntermLoop(type, init, cond, expr, body); TIntermNode* node = new TIntermLoop(type, init, cond, expr, body);
node->setLine(line); node->setLine(line);
...@@ -616,12 +600,12 @@ TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTy ...@@ -616,12 +600,12 @@ TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTy
// //
// Add branches. // Add branches.
// //
TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TSourceLoc line) TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc &line)
{ {
return addBranch(branchOp, 0, line); return addBranch(branchOp, 0, line);
} }
TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, TSourceLoc line) TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc &line)
{ {
TIntermBranch* node = new TIntermBranch(branchOp, expression); TIntermBranch* node = new TIntermBranch(branchOp, expression);
node->setLine(line); node->setLine(line);
......
...@@ -180,8 +180,7 @@ void TParseContext::error(const TSourceLoc& loc, ...@@ -180,8 +180,7 @@ void TParseContext::error(const TSourceLoc& loc,
const char* reason, const char* token, const char* reason, const char* token,
const char* extraInfo) const char* extraInfo)
{ {
pp::SourceLocation srcLoc; pp::SourceLocation srcLoc(loc.first_file, loc.first_line);
DecodeSourceLoc(loc, &srcLoc.file, &srcLoc.line);
mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR,
srcLoc, reason, token, extraInfo); srcLoc, reason, token, extraInfo);
...@@ -190,8 +189,7 @@ void TParseContext::error(const TSourceLoc& loc, ...@@ -190,8 +189,7 @@ void TParseContext::error(const TSourceLoc& loc,
void TParseContext::warning(const TSourceLoc& loc, void TParseContext::warning(const TSourceLoc& loc,
const char* reason, const char* token, const char* reason, const char* token,
const char* extraInfo) { const char* extraInfo) {
pp::SourceLocation srcLoc; pp::SourceLocation srcLoc(loc.first_file, loc.first_line);
DecodeSourceLoc(loc, &srcLoc.file, &srcLoc.line);
mDiagnostics.writeInfo(pp::Diagnostics::PP_WARNING, mDiagnostics.writeInfo(pp::Diagnostics::PP_WARNING,
srcLoc, reason, token, extraInfo); srcLoc, reason, token, extraInfo);
} }
...@@ -1064,15 +1062,13 @@ bool TParseContext::supportsExtension(const char* extension) ...@@ -1064,15 +1062,13 @@ bool TParseContext::supportsExtension(const char* extension)
void TParseContext::handleExtensionDirective(const TSourceLoc &line, const char* extName, const char* behavior) void TParseContext::handleExtensionDirective(const TSourceLoc &line, const char* extName, const char* behavior)
{ {
pp::SourceLocation loc; pp::SourceLocation loc(line.first_file, line.first_line);
DecodeSourceLoc(line, &loc.file, &loc.line);
mDirectiveHandler.handleExtension(loc, extName, behavior); mDirectiveHandler.handleExtension(loc, extName, behavior);
} }
void TParseContext::handlePragmaDirective(const TSourceLoc &line, const char* name, const char* value) void TParseContext::handlePragmaDirective(const TSourceLoc &line, const char* name, const char* value)
{ {
pp::SourceLocation loc; pp::SourceLocation loc(line.first_file, line.first_line);
DecodeSourceLoc(line, &loc.file, &loc.line);
mDirectiveHandler.handlePragma(loc, name, value); mDirectiveHandler.handlePragma(loc, name, value);
} }
......
...@@ -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);
...@@ -399,7 +402,8 @@ yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) { ...@@ -399,7 +402,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");
...@@ -555,7 +559,8 @@ int glslang_finalize(TParseContext* context) { ...@@ -555,7 +559,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->getScanner()); yyrestart(NULL, context->getScanner());
yyset_lineno(EncodeSourceLoc(0, 1), context->getScanner()); yyset_column(0, context->getScanner());
yyset_lineno(1, context->getScanner());
context->AfterEOF = false; context->AfterEOF = false;
// Initialize preprocessor. // Initialize preprocessor.
......
...@@ -53,7 +53,6 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h). ...@@ -53,7 +53,6 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
%union { %union {
struct { struct {
TSourceLoc line;
union { union {
TString *string; TString *string;
float f; float f;
...@@ -64,7 +63,6 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h). ...@@ -64,7 +63,6 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
TSymbol* symbol; TSymbol* symbol;
} lex; } lex;
struct { struct {
TSourceLoc line;
TOperator op; TOperator op;
union { union {
TIntermNode* intermNode; TIntermNode* intermNode;
...@@ -91,7 +89,21 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h). ...@@ -91,7 +89,21 @@ WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner); extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
extern void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason); extern void yyerror(YYLTYPE* lloc, TParseContext* context, const char* reason);
#define YYLLOC_DEFAULT(Current, Rhs, N) do { (Current) = YYRHSLOC(Rhs, N ? 1 : 0); } while (0) #define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
if (N) { \
(Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
(Current).last_file = YYRHSLOC(Rhs, N).last_file; \
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
} \
else { \
(Current).first_file = YYRHSLOC(Rhs, 0).last_file; \
(Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
(Current).last_file = YYRHSLOC(Rhs, 0).last_file; \
(Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
} \
} while (0)
#define FRAG_VERT_ONLY(S, L) { \ #define FRAG_VERT_ONLY(S, L) { \
if (context->getShaderType() != GL_FRAGMENT_SHADER && \ if (context->getShaderType() != GL_FRAGMENT_SHADER && \
...@@ -300,11 +312,9 @@ function_call_or_method ...@@ -300,11 +312,9 @@ function_call_or_method
function_call_generic function_call_generic
: function_call_header_with_parameters RIGHT_PAREN { : function_call_header_with_parameters RIGHT_PAREN {
$$ = $1; $$ = $1;
$$.line = @2;
} }
| function_call_header_no_parameters RIGHT_PAREN { | function_call_header_no_parameters RIGHT_PAREN {
$$ = $1; $$ = $1;
$$.line = @2;
} }
; ;
...@@ -411,12 +421,12 @@ unary_expression ...@@ -411,12 +421,12 @@ unary_expression
// Grammar Note: No traditional style type casts. // Grammar Note: No traditional style type casts.
unary_operator unary_operator
: PLUS { $$.line = @1; $$.op = EOpNull; } : PLUS { $$.op = EOpNull; }
| DASH { $$.line = @1; $$.op = EOpNegative; } | DASH { $$.op = EOpNegative; }
| BANG { $$.line = @1; $$.op = EOpLogicalNot; } | BANG { $$.op = EOpLogicalNot; }
| TILDE { | TILDE {
ES3_ONLY("~", @1, "bit-wise operator"); ES3_ONLY("~", @1, "bit-wise operator");
$$.line = @1; $$.op = EOpBitwiseNot; $$.op = EOpBitwiseNot;
} }
; ;
// Grammar Note: No '*' or '&' unary ops. Pointers are not supported. // Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
...@@ -548,23 +558,28 @@ assignment_expression ...@@ -548,23 +558,28 @@ assignment_expression
; ;
assignment_operator assignment_operator
: EQUAL { $$.line = @1; $$.op = EOpAssign; } : EQUAL { $$.op = EOpAssign; }
| MUL_ASSIGN { FRAG_VERT_ONLY("*=", @1); $$.line = @1; $$.op = EOpMulAssign; } | MUL_ASSIGN { FRAG_VERT_ONLY("*=", @1); $$.op = EOpMulAssign; }
| DIV_ASSIGN { FRAG_VERT_ONLY("/=", @1); $$.line = @1; $$.op = EOpDivAssign; } | DIV_ASSIGN { FRAG_VERT_ONLY("/=", @1); $$.op = EOpDivAssign; }
| MOD_ASSIGN { ES3_ONLY("%=", @1, "integer modulus operator"); | MOD_ASSIGN { ES3_ONLY("%=", @1, "integer modulus operator");
FRAG_VERT_ONLY("%=", @1); $$.line = @1; $$.op = EOpIModAssign; } FRAG_VERT_ONLY("%=", @1); $$.op = EOpIModAssign; }
| ADD_ASSIGN { $$.line = @1; $$.op = EOpAddAssign; } | ADD_ASSIGN { $$.op = EOpAddAssign; }
| SUB_ASSIGN { $$.line = @1; $$.op = EOpSubAssign; } | SUB_ASSIGN { $$.op = EOpSubAssign; }
| LEFT_ASSIGN { ES3_ONLY("<<=", @1, "bit-wise operator"); | LEFT_ASSIGN { ES3_ONLY("<<=", @1, "bit-wise operator");
FRAG_VERT_ONLY("<<=", @1); $$.line = @1; $$.op = EOpBitShiftLeftAssign; } FRAG_VERT_ONLY("<<=", @1);
$$.op = EOpBitShiftLeftAssign; }
| RIGHT_ASSIGN { ES3_ONLY(">>=", @1, "bit-wise operator"); | RIGHT_ASSIGN { ES3_ONLY(">>=", @1, "bit-wise operator");
FRAG_VERT_ONLY(">>=", @1); $$.line = @1; $$.op = EOpBitShiftRightAssign; } FRAG_VERT_ONLY(">>=", @1);
$$.op = EOpBitShiftRightAssign; }
| AND_ASSIGN { ES3_ONLY("&=", @1, "bit-wise operator"); | AND_ASSIGN { ES3_ONLY("&=", @1, "bit-wise operator");
FRAG_VERT_ONLY("&=", @1); $$.line = @1; $$.op = EOpBitwiseAndAssign; } FRAG_VERT_ONLY("&=", @1);
$$.op = EOpBitwiseAndAssign; }
| XOR_ASSIGN { ES3_ONLY("^=", @1, "bit-wise operator"); | XOR_ASSIGN { ES3_ONLY("^=", @1, "bit-wise operator");
FRAG_VERT_ONLY("^=", @1); $$.line = @1; $$.op = EOpBitwiseXorAssign; } FRAG_VERT_ONLY("^=", @1);
$$.op = EOpBitwiseXorAssign; }
| OR_ASSIGN { ES3_ONLY("|=", @1, "bit-wise operator"); | OR_ASSIGN { ES3_ONLY("|=", @1, "bit-wise operator");
FRAG_VERT_ONLY("|=", @1); $$.line = @1; $$.op = EOpBitwiseOrAssign; } FRAG_VERT_ONLY("|=", @1);
$$.op = EOpBitwiseOrAssign; }
; ;
expression expression
...@@ -686,7 +701,6 @@ function_prototype ...@@ -686,7 +701,6 @@ function_prototype
// being redeclared. So, pass back up this declaration, not the one in the symbol table. // being redeclared. So, pass back up this declaration, not the one in the symbol table.
// //
$$.function = $1; $$.function = $1;
$$.line = @2;
// We're at the inner scope level of the function's arguments and body statement. // We're at the inner scope level of the function's arguments and body statement.
// Add the function prototype to the surrounding scope instead. // Add the function prototype to the surrounding scope instead.
...@@ -763,7 +777,6 @@ parameter_declarator ...@@ -763,7 +777,6 @@ parameter_declarator
if (context->reservedErrorCheck(@2, *$2.string)) if (context->reservedErrorCheck(@2, *$2.string))
context->recover(); context->recover();
TParameter param = {$2.string, new TType($1)}; TParameter param = {$2.string, new TType($1)};
$$.line = @2;
$$.param = param; $$.param = param;
} }
| type_specifier IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET { | type_specifier IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
...@@ -781,7 +794,6 @@ parameter_declarator ...@@ -781,7 +794,6 @@ parameter_declarator
TType* type = new TType($1); TType* type = new TType($1);
TParameter param = { $2.string, type }; TParameter param = { $2.string, type };
$$.line = @2;
$$.param = param; $$.param = param;
} }
; ;
...@@ -990,17 +1002,14 @@ type_qualifier ...@@ -990,17 +1002,14 @@ type_qualifier
storage_qualifier storage_qualifier
: CONST_QUAL { : CONST_QUAL {
$$.qualifier = EvqConstExpr; $$.qualifier = EvqConstExpr;
$$.line = @1;
} }
| IN_QUAL { | IN_QUAL {
ES3_ONLY("in", @1, "storage qualifier"); ES3_ONLY("in", @1, "storage qualifier");
$$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn; $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
$$.line = @1;
} }
| OUT_QUAL { | OUT_QUAL {
ES3_ONLY("out", @1, "storage qualifier"); ES3_ONLY("out", @1, "storage qualifier");
$$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut; $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
$$.line = @1;
} }
| CENTROID IN_QUAL { | CENTROID IN_QUAL {
ES3_ONLY("centroid in", @1, "storage qualifier"); ES3_ONLY("centroid in", @1, "storage qualifier");
...@@ -1010,7 +1019,6 @@ storage_qualifier ...@@ -1010,7 +1019,6 @@ storage_qualifier
context->recover(); context->recover();
} }
$$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn; $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
$$.line = @2;
} }
| CENTROID OUT_QUAL { | CENTROID OUT_QUAL {
ES3_ONLY("centroid out", @1, "storage qualifier"); ES3_ONLY("centroid out", @1, "storage qualifier");
...@@ -1020,13 +1028,11 @@ storage_qualifier ...@@ -1020,13 +1028,11 @@ storage_qualifier
context->recover(); context->recover();
} }
$$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut; $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
$$.line = @2;
} }
| UNIFORM { | UNIFORM {
if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform")) if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
context->recover(); context->recover();
$$.qualifier = EvqUniform; $$.qualifier = EvqUniform;
$$.line = @1;
} }
; ;
...@@ -1480,10 +1486,10 @@ compound_statement_no_new_scope ...@@ -1480,10 +1486,10 @@ compound_statement_no_new_scope
statement_list statement_list
: statement { : statement {
$$ = context->intermediate.makeAggregate($1, 0); $$ = context->intermediate.makeAggregate($1, @$);
} }
| statement_list statement { | statement_list statement {
$$ = context->intermediate.growAggregate($1, $2, 0); $$ = context->intermediate.growAggregate($1, $2, @$);
} }
; ;
...@@ -1628,7 +1634,7 @@ translation_unit ...@@ -1628,7 +1634,7 @@ translation_unit
context->setTreeRoot($$); context->setTreeRoot($$);
} }
| translation_unit external_declaration { | translation_unit external_declaration {
$$ = context->intermediate.growAggregate($1, $2, 0); $$ = context->intermediate.growAggregate($1, $2, @$);
context->setTreeRoot($$); context->setTreeRoot($$);
} }
; ;
...@@ -1736,7 +1742,7 @@ function_definition ...@@ -1736,7 +1742,7 @@ function_definition
context->recover(); context->recover();
} }
$$ = context->intermediate.growAggregate($1.intermAggregate, $3, 0); $$ = context->intermediate.growAggregate($1.intermAggregate, $3, @$);
context->intermediate.setAggregateOperator($$, EOpFunction, @1); context->intermediate.setAggregateOperator($$, EOpFunction, @1);
$$->getAsAggregate()->setName($1.function->getMangledName().c_str()); $$->getAsAggregate()->setName($1.function->getMangledName().c_str());
$$->getAsAggregate()->setType($1.function->getReturnType()); $$->getAsAggregate()->setType($1.function->getReturnType());
......
...@@ -1034,7 +1034,10 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). ...@@ -1034,7 +1034,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);
...@@ -3291,7 +3294,8 @@ yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) { ...@@ -3291,7 +3294,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");
...@@ -3447,7 +3451,8 @@ int glslang_finalize(TParseContext* context) { ...@@ -3447,7 +3451,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->getScanner()); yyrestart(NULL,context->getScanner());
yyset_lineno(EncodeSourceLoc(0, 1),context->getScanner()); yyset_column(0,context->getScanner());
yyset_lineno(1,context->getScanner());
context->AfterEOF = false; context->AfterEOF = false;
// Initialize preprocessor. // Initialize preprocessor.
......
...@@ -183,7 +183,6 @@ typedef union YYSTYPE ...@@ -183,7 +183,6 @@ typedef union YYSTYPE
struct { struct {
TSourceLoc line;
union { union {
TString *string; TString *string;
float f; float f;
...@@ -194,7 +193,6 @@ typedef union YYSTYPE ...@@ -194,7 +193,6 @@ typedef union YYSTYPE
TSymbol* symbol; TSymbol* symbol;
} lex; } lex;
struct { struct {
TSourceLoc line;
TOperator op; TOperator op;
union { union {
TIntermNode* intermNode; TIntermNode* intermNode;
......
...@@ -252,10 +252,16 @@ class TIntermNode { ...@@ -252,10 +252,16 @@ class TIntermNode {
public: public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
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;
}
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; }
...@@ -496,7 +502,7 @@ typedef TVector<int> TQualifierList; ...@@ -496,7 +502,7 @@ typedef TVector<int> TQualifierList;
// //
class TIntermAggregate : public TIntermOperator { class TIntermAggregate : public TIntermOperator {
public: public:
TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), endLine(0) { } TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false) { endLine = { 0, 0, 0, 0 }; }
TIntermAggregate(TOperator o) : TIntermOperator(o) { } TIntermAggregate(TOperator o) : TIntermOperator(o) { }
~TIntermAggregate() { } ~TIntermAggregate() { }
...@@ -516,8 +522,8 @@ public: ...@@ -516,8 +522,8 @@ 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; } void setEndLine(const TSourceLoc& line) { endLine = line; }
TSourceLoc getEndLine() const { return endLine; } const TSourceLoc& getEndLine() const { return endLine; }
protected: protected:
TIntermAggregate(const TIntermAggregate&); // disallow copy constructor TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
......
...@@ -23,26 +23,26 @@ public: ...@@ -23,26 +23,26 @@ public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
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* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc); TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
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); TIntermTyped* addUnaryMath(TOperator op, TIntermNode* child, const TSourceLoc&);
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&);
TIntermSwitch *addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &line); TIntermSwitch *addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &line);
TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &line); TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &line);
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, TType, bool singleConstantParam = false); bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, 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 outputTree(TIntermNode*); void outputTree(TIntermNode*);
......
...@@ -228,7 +228,7 @@ bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node) ...@@ -228,7 +228,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, TType t, bool singleConstantParam) bool TIntermediate::parseConstTree(const TSourceLoc& line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TType t, bool singleConstantParam)
{ {
if (root == 0) if (root == 0)
return false; return false;
......
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