[clang][Diagnostics] Fix wrong line number display (#65238)
authorTakuya Shimizu <shimizu2486@gmail.com>
Tue, 5 Sep 2023 03:12:42 +0000 (12:12 +0900)
committerTobias Hieta <tobias@hieta.se>
Wed, 27 Sep 2023 15:44:34 +0000 (17:44 +0200)
commit178cf5bc8732a010f02e9a262f08afc549a1bc1d
tree748d41b1a9c9be85daebbccd9949f15e0ec3f382
parent25a150b830f6dd0dd8295fe93d0895f262a58592
[clang][Diagnostics] Fix wrong line number display (#65238)

When the caret location is lower than the lowest source range, clang is
printing wrong line numbers. The first line number should consider caret
location line even when there are source ranges provided.

Current wrong line example: https://godbolt.org/z/aj4qEjzs4

(cherry picked from commit ef5217b3c0dcbb58927fe43400b6d1faa677bf98)
clang/lib/Frontend/TextDiagnostic.cpp
clang/test/Misc/diag-style.cpp