-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][Diagnostics] Fix wrong line number display #65238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
This looks good. My only question is, can |
In 8554a55, this was added to fix a range with a lower begin source location than |
When the DisplayLineNo =
std::min(DisplayLineNo, SM.getPresumedLineNumber(I.getBegin())); in L1169, correct? I don't think we need to ignore |
Ouch the inability to comment outside of modified code is going to be painful. The changed code being unsigned DisplayLineNo = Loc.getPresumedLoc().getLine();
for (const auto &I : Ranges) {
DisplayLineNo =
std::min(DisplayLineNo, SM.getPresumedLineNumber(I.getBegin()));
} If the range starts before |
Thanks, that's my point. When I provided an invalid source location, the diagnostics looked like the following. Filename, line/column number and code snippet are not printed.
When |
Okay, makes sense to me. Should probably also be backported to 17. |
could you upload a dummy change to trigger the build? Thanks! |
Empty commit to run CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
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
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 ef5217b)
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