[clang][Diagnostics][NFC] Don't create oversized CaretLine
authorTimm Bäder <tbaeder@redhat.com>
Wed, 24 May 2023 04:44:35 +0000 (06:44 +0200)
committerTimm Bäder <tbaeder@redhat.com>
Wed, 31 May 2023 08:21:24 +0000 (10:21 +0200)
commit01578153ee8228562d0f64d3847e7fc91573da36
treef0af0bfdfc71c34f7c33d8155afe96237fb616f9
parent96816a124994cba1ae254325dc20a669ab57386f
[clang][Diagnostics][NFC] Don't create oversized CaretLine

Instead of creating a CaretLine the size of the SourceLine, just leave
it empty at first, let HighlightRange resize it to fit all the ~, then
resize it to fit the ^. Then we can save ourselves the work to remove
the trailing whitespace again.

Differential Revision: https://reviews.llvm.org/D151286
clang/lib/Frontend/TextDiagnostic.cpp