Skip to content

Commit a986f5e

Browse files
authored
Fix clang crash when printing highlighted code in diagnostic (after #66514) (#80442)
Implements the fix proposed by Evgeny Eltsin on #66514 (comment). No test case provided, since the bug is extremely sensitive to the preprocessor state (headers, macros, including the ones defined on command line), and it turned out to be non-trivial to create an isolated test.
1 parent 66b339a commit a986f5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Frontend/TextDiagnostic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ void TextDiagnostic::emitSnippetAndCaret(
13491349
// Prepare source highlighting information for the lines we're about to
13501350
// emit, starting from the first line.
13511351
std::unique_ptr<SmallVector<StyleRange>[]> SourceStyles =
1352-
highlightLines(BufStart, Lines.first, Lines.second, PP, LangOpts,
1352+
highlightLines(BufData, Lines.first, Lines.second, PP, LangOpts,
13531353
DiagOpts->ShowColors, FID, SM);
13541354

13551355
SmallVector<LineRange> LineRanges =

0 commit comments

Comments
 (0)