Skip to content

Commit

Permalink
Fix clang crash when printing highlighted code in diagnostic (after #…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
alexfh committed Feb 2, 2024
1 parent 66b339a commit a986f5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Frontend/TextDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ void TextDiagnostic::emitSnippetAndCaret(
// Prepare source highlighting information for the lines we're about to
// emit, starting from the first line.
std::unique_ptr<SmallVector<StyleRange>[]> SourceStyles =
highlightLines(BufStart, Lines.first, Lines.second, PP, LangOpts,
highlightLines(BufData, Lines.first, Lines.second, PP, LangOpts,
DiagOpts->ShowColors, FID, SM);

SmallVector<LineRange> LineRanges =
Expand Down

0 comments on commit a986f5e

Please sign in to comment.