Skip to content

Commit a53cdab

Browse files
Correctly handle negative line changes
1 parent 163933e commit a53cdab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Frontend/PrintPreprocessedOutput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ bool PrintPPOutputPPCallbacks::MoveToLine(unsigned LineNo,
306306
*OS << '\n';
307307
StartedNewLine = true;
308308
} else if (!DisableLineMarkers) {
309-
if (LineNo - CurLine <= 8) {
309+
if (LineNo >= CurLine && LineNo - CurLine <= 8) {
310310
const char *NewLines = "\n\n\n\n\n\n\n\n";
311311
OS->write(NewLines, LineNo - CurLine);
312312
} else {

0 commit comments

Comments
 (0)