Fix empty line handling in line directive callback.
The current line number for the #line directive should be passed in as parameter to the line directive callback. Without it, we don't know how many empty lines we should output.
This commit is contained in:
parent
5cbc990a0a
commit
46ea5396ef
6 changed files with 49 additions and 35 deletions
|
|
@ -639,12 +639,10 @@ struct DoPreprocessing {
|
|||
adjustLine(line);
|
||||
outputStream << "#extension " << extension << " : " << behavior;
|
||||
});
|
||||
parseContext.setLineCallback([&lastLine, &outputStream, &parseContext](
|
||||
int newLineNo, bool hasSource, int sourceNum) {
|
||||
parseContext.setLineCallback([&adjustLine, &lastLine, &outputStream, &parseContext](
|
||||
int curLineNo, int newLineNo, bool hasSource, int sourceNum) {
|
||||
// SourceNum is the number of the source-string that is being parsed.
|
||||
if (lastLine != -1) {
|
||||
outputStream << std::endl;
|
||||
}
|
||||
adjustLine(curLineNo);
|
||||
outputStream << "#line " << newLineNo;
|
||||
if (hasSource) {
|
||||
outputStream << " " << sourceNum;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue