[all-commits] [llvm/llvm-project] d0e208: [analyzer] Fix -analyzer-output=html assert on rev...
Balázs Benics via All-commits
all-commits at lists.llvm.org
Thu Aug 6 05:03:06 PDT 2026
Branch: refs/heads/users/steakhal/csa/output-crashes-4
Home: https://github.com/llvm/llvm-project
Commit: d0e2087771fb2951ff3ab938a5e3571268f88457
https://github.com/llvm/llvm-project/commit/d0e2087771fb2951ff3ab938a5e3571268f88457
Author: Balazs Benics <benicsbalazs at gmail.com>
Date: 2026-08-06 (Thu, 06 Aug 2026)
Changed paths:
M clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
A clang/test/Analysis/html_diagnostics/highlight-range-mapping.cpp
Log Message:
-----------
[analyzer] Fix -analyzer-output=html assert on reversed and macro ranges
HTMLDiagnostics::HighlightRange guarded against a reversed range by
comparing line numbers, so a same-line reversal - which is what the piece for
an implicit copy constructor carries - reached html::HighlightRange.
Its scan walks from begin to end, ran off the end of the buffer, and asserted:
https://godbolt.org/z/sTb5qfjjd
Invalid position to insert! (RewriteRope.h)
It also added the end token's length itself and then passed a token range to
html::HighlightRange, which measured the token again, this time from the
interior. For most tokens the two cancel, but where the tail re-lexes longer
the highlight reached past the end of the range, e.g. over a trailing ';'.
Use getExpansionRangeInFile(), which rejects reversed and cross-file ranges,
then convert once and tell html::HighlightRange the range is already
char-granular.
A range ending inside a macro expansion now covers the whole macro use, so
the highlight nests around the 'macro' element rather than ending inside it.
Assisted-By: claude
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list