Fix line number handling in line directive callback.
The line argument passed into the lineCallback function is the literal value of the first argument of the #line directive. lastLine in DoPreprocessing() should be updated taking into consideration the different definitions for #line between specs. Add a test to reveal the bug.
This commit is contained in:
parent
3a194f7ba4
commit
5cbc990a0a
9 changed files with 40 additions and 13 deletions
|
|
@ -2654,6 +2654,19 @@ void TParseContext::updateImplicitArraySize(TSourceLoc loc, TIntermNode *node, i
|
|||
symbol->getWritableType().setImplicitArraySize(index + 1);
|
||||
}
|
||||
|
||||
// Returns true if the first argument to the #line directive is the line number for the next line.
|
||||
//
|
||||
// Desktop, pre-version 3.30: "After processing this directive
|
||||
// (including its new-line), the implementation will behave as if it is compiling at line number line+1 and
|
||||
// source string number source-string-number."
|
||||
//
|
||||
// Desktop, version 3.30 and later, and ES: "After processing this directive
|
||||
// (including its new-line), the implementation will behave as if it is compiling at line number line and
|
||||
// source string number source-string-number.
|
||||
bool TParseContext::lineDirectiveShouldSetNextLine() const {
|
||||
return profile == EEsProfile || version >= 330;
|
||||
}
|
||||
|
||||
//
|
||||
// Enforce non-initializer type/qualifier rules.
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue