[clang] Fix clang crash when printing highlighted code in diagnostic (after #66514) (PR #80442)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 07:29:54 PST 2024


================
@@ -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,
----------------
AaronBallman wrote:

Hmmm, we have an existing test that embeds a null character into the source and that doesn't seem to reproduce the issue, but it sure stands to reason it would be something along those lines. Good catch!

https://github.com/llvm/llvm-project/pull/80442


More information about the cfe-commits mailing list